Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ contact_links:
url: https://github.com/NodeByteLTD/ByteSend/blob/main/SECURITY.md
about: Please report vulnerabilities privately.
- name: Community support (Discord)
url: https://discord.gg/xqkqzVRC4S
url: https://discord.gg/C2Q4GHXKQA
about: Ask questions and get help from the community.
- name: Documentation
url: https://docs.bytesend.cloud
Expand Down
23 changes: 17 additions & 6 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,32 @@ jobs:
with:
version: 9.0.0

- name: Set up Node.js 20.x
uses: actions/setup-node@v4
# Trusted publishing needs npm 11.5+, which ships with Node 24.
- name: Set up Node.js 24.x
uses: actions/setup-node@v5
with:
node-version: 20.x
node-version: 24.x
registry-url: "https://registry.npmjs.org"
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Upgrade npm
run: npm install -g npm@latest

- name: Install dependencies
run: pnpm install --filter "./packages/sdk..." --frozen-lockfile

- name: Check whether this version is already published
id: version
working-directory: packages/sdk
run: |
VERSION=$(node -p "require('./package.json').version")
if npm view "bytesend-js@${VERSION}" version >/dev/null 2>&1; then
echo "bytesend-js@${VERSION} is already on npm; bump the version in packages/sdk/package.json to publish."
echo "publish=false" >> "$GITHUB_OUTPUT"
else
echo "publish=true" >> "$GITHUB_OUTPUT"
fi

- name: Publish SDK
if: steps.version.outputs.publish == 'true'
working-directory: packages/sdk
run: |
pnpm run build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Relase Python SDK
name: Release Python SDK

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
Expand Down Expand Up @@ -46,4 +46,6 @@ jobs:
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: packages/python-sdk/dist
packages-dir: packages/python-sdk/dist
# Pushes that don't bump the version in pyproject.toml would otherwise fail on the duplicate upload.
skip-existing: true
2 changes: 1 addition & 1 deletion .github/workflows/website-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Brand asset kit** (`public/brand/`) — SVG marks (colour, mono black/white, compact, glyph), light/dark wordmarks, 1024px app icon, social avatar, GitHub social preview (1280×640), Discord banner (960×540) and invite splash (1920×1080), X/Twitter header (1500×500)
- **`pnpm --filter web brand:generate`** — regenerates every logo, favicon, app icon and banner from the shared geometry in `src/lib/brand.tsx`
- **Open Graph & Twitter images** — generated `opengraph-image` / `twitter-image` routes for the site and the changelog using `next/og`, replacing the externally hosted share image
- **Discord emoji set** (`public/brand/discord-emojis/`) — static `bs_logo`, `bs_send`, `bs_api`, `bs_delivered`, `bs_bounced`, `bs_held`, `bs_verified` and animated `bs_sending`, `bs_loading`, `bs_mailfly`, all 128×128 and well under Discord's 256 KB limit; regenerate with `pnpm --filter web brand:emojis`

#### Website
- **Refreshed homepage** — reordered to hero → proof points → developer quick-start → features → how it works → pricing → comparison → call to action, with smooth anchor scrolling and gentle scroll-in animations that respect reduced-motion settings
- New hero copy with a "What's new" link to the changelog, and the brand palette across headings, feature icons and accents
- Features rewritten as a bento grid that now covers deliverability guardrails, spam protection and sending regions
- New "How it works" section: verify a domain, send, watch it land
- Proof strip now lists verifiable facts (free tier, AGPL-3.0, REST + SMTP + three SDKs, self-hosting) in place of unverified uptime and delivery-time figures
- Free-tier copy clarifies that the 12,500 free emails a month are transactional
- Comparison table re-checked against each provider's published plans (SendGrid's free plan is now a 60-day trial; Resend has a visual editor) and dated
- All Discord links point to the new ByteSend community server

#### Admin Panel
- **Overview dashboard** (`/admin`) — 7/30/90-day KPIs with prior-period deltas, sending and signup charts, SES quota and sandbox status per region, a "Needs attention" panel (teams over bounce/complaint warning thresholds, blocked teams, failing domains) and recent admin activity
Expand All @@ -45,14 +56,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Prisma query logging** is now opt-in in development via `PRISMA_LOG_QUERIES=true`
- Teams and users admin pages are now searchable lists that open the new detail pages; domains, webhooks, billing and email analytics share the refreshed admin layout
- Bounce/complaint thresholds moved to `src/lib/constants/deliverability.ts`, shared by `LimitService` and the admin views
- **`/api/version`** caches the release lookup for 10 minutes and falls back to the last known version, instead of calling GitHub up to three times on every dashboard load; the sidebar no longer shows a stale hard-coded version when the lookup fails
- **Syntax highlighting** loads only the eight languages and two themes the site uses instead of every Shiki grammar, shrinking the homepage bundle and dev compile
- **SDKs** — `bytesend-js` 0.1.3 and the `bytesend` Python package 0.1.2 add the `HELD` email status
- Release workflows skip versions that are already published instead of failing, and the npm release runs on Node 24 (npm 12 no longer supports Node 20)

### Fixed
- **Security: dashboard route gate** — the middleware treated every path as public because `/` matched every route as a prefix, so the dashboard was never gated at the edge. It now requires a session for all dashboard routes and sends signed-out visitors to the login page, which returns them to the page they asked for. (Sessions are stored in the database, so bans and 2FA continue to be enforced on the server for every request.)
- **Security: OAuth account takeover** — sign-in with GitHub, Google or Discord now requires the provider to have verified the email address; previously an unverified provider email could be linked to an existing ByteSend account
- Webhook-call cleanup job was never started, so call history was never pruned
- "Paid users only" in admin email analytics only counted the BASIC plan
- Admin team settings reset dropped extra domain/member slots after saving; literal `…`/`–` text in the teams page
- Web manifest pointed at icon paths that did not exist
- Discord notification icon URL now uses `bytesend.cloud`
- The campaign scheduler no longer removes and re-creates its own job on every start
- CI: unit and tRPC test mocks updated for the per-request ban check, and the email-change tests rewritten for the two-step verification flow

### Documentation
- New guides: [Spam Protection](https://docs.bytesend.cloud/guides/spam-protection), [Changing Sending Region](https://docs.bytesend.cloud/guides/sending-regions), [Connected Accounts](https://docs.bytesend.cloud/guides/connected-accounts) and, for self-hosters, [Admin Panel](https://docs.bytesend.cloud/self-hosting/admin-panel)
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/guides/admin-operations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ For privacy inquiries:
- [Manage your team members](/guides/plan-management)
- [Configure notification alerts](https://bytesend.cloud/settings/notifications)
- [Explore your usage](https://bytesend.cloud/settings/usage)
- [Contact support](https://discord.gg/xqkqzVRC4S)
- [Contact support](https://discord.gg/C2Q4GHXKQA)
4 changes: 2 additions & 2 deletions apps/docs/guides/discord-notifications.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ To reduce alert noise:
If messages don't look formatted:
- Ensure the bot has embed permissions
- Try deleting and recreating the webhook
- Contact [ByteSend Support](https://discord.gg/xqkqzVRC4S)
- Contact [ByteSend Support](https://discord.gg/C2Q4GHXKQA)

### Webhook URL Expired

Expand Down Expand Up @@ -280,4 +280,4 @@ Discord webhooks don't expire, but:
- [Return to notification providers](/guides/notification-providers)
- [Set up Slack notifications](/guides/slack-notifications)
- [Manage all notifications settings](https://bytesend.cloud/settings/notifications)
- [Join the community Discord](https://discord.gg/xqkqzVRC4S)
- [Join the community Discord](https://discord.gg/C2Q4GHXKQA)
6 changes: 3 additions & 3 deletions apps/docs/guides/github-oauth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ If you click "Cancel" during GitHub authorization:

If your accounts didn't merge as expected:

1. Contact [ByteSend Support](https://discord.gg/xqkqzVRC4S)
1. Contact [ByteSend Support](https://discord.gg/C2Q4GHXKQA)
2. We can manually verify and link your accounts
3. Include the email address of both accounts in your support message

Expand All @@ -119,7 +119,7 @@ If you have multiple GitHub organizations:

If you need to use traditional email/password authentication:

1. Contact [ByteSend Support](https://discord.gg/xqkqzVRC4S)
1. Contact [ByteSend Support](https://discord.gg/C2Q4GHXKQA)
2. We can reset your authentication method
3. You'll be able to set a traditional password

Expand All @@ -129,4 +129,4 @@ After logging in with GitHub OAuth:

- [Set up your first domain](/guides/getting-started)
- [Explore the dashboard](https://bytesend.cloud/dashboard)
- [Join our community](https://discord.gg/xqkqzVRC4S)
- [Join our community](https://discord.gg/C2Q4GHXKQA)
4 changes: 2 additions & 2 deletions apps/docs/guides/plans-and-pricing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Yes! With the LIFETIME plan:

### Do you offer enterprise plans?

Yes! For high-volume needs (1M+ emails/month), we offer custom enterprise pricing. [Contact sales](https://discord.gg/xqkqzVRC4S) to discuss your requirements.
Yes! For high-volume needs (1M+ emails/month), we offer custom enterprise pricing. [Contact sales](https://discord.gg/C2Q4GHXKQA) to discuss your requirements.

### Can I cancel my subscription?

Expand Down Expand Up @@ -196,7 +196,7 @@ All invoices are available in your dashboard:

For billing questions or concerns:

- **Free Plan**: Community support via [Discord](https://discord.gg/xqkqzVRC4S)
- **Free Plan**: Community support via [Discord](https://discord.gg/C2Q4GHXKQA)
- **BASIC/LIFETIME Plans**: Priority email and Discord support

## Next Steps
Expand Down
99 changes: 53 additions & 46 deletions apps/web/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,69 @@ import { NextRequest, NextResponse } from "next/server";
import { getToken } from "next-auth/jwt";
import { validateTwoFactorCookieEdge, TWO_FACTOR_COOKIE } from "~/lib/edge-2fa-utils";

export async function middleware(request: NextRequest) {
const pathname = request.nextUrl.pathname;
const PROTECTED_PREFIXES = [
"/admin",
"/broadcasts",
"/campaigns",
"/contacts",
"/dashboard",
"/dev-settings",
"/domains",
"/emails",
"/logs",
"/payments",
"/settings",
"/suppressions",
"/templates",
"/webhooks",
];

const SESSION_COOKIES = ["__Secure-next-auth.session-token", "next-auth.session-token"];

const publicPaths = [
"/login",
"/signup",
"/banned",
"/api",
"/auth",
"/",
"/privacy",
"/terms",
"/cookie-policy",
"/dmca",
"/dpa",
"/acceptable-use",
"/legal",
"/changelog",
"/_next",
"/favicon.ico",
];
function matchesPrefix(pathname: string, prefix: string) {
return pathname === prefix || pathname.startsWith(`${prefix}/`);
}

if (publicPaths.some((path) => pathname.startsWith(path))) {
export async function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;

if (!PROTECTED_PREFIXES.some((prefix) => matchesPrefix(pathname, prefix))) {
return NextResponse.next();
}

if (pathname.startsWith("/dashboard") || pathname.startsWith("/broadcasts") || pathname.startsWith("/campaigns")) {
const token = await getToken({ req: request, secret: process.env.NEXTAUTH_SECRET });
// Sessions are stored in the database, so the edge can only check that a session cookie exists;
// the server validates it (and enforces bans and 2FA) on every request.
const hasSessionCookie = SESSION_COOKIES.some((name) => request.cookies.has(name));
if (!hasSessionCookie) {
const loginUrl = new URL("/login", request.url);
loginUrl.searchParams.set("callbackUrl", `${pathname}${request.nextUrl.search}`);
return NextResponse.redirect(loginUrl);
}

if (!token) {
return NextResponse.redirect(new URL("/login", request.url));
}
// Only populated if the app switches to JWT sessions; database sessions have no decodable token.
const token = await getToken({ req: request, secret: process.env.NEXTAUTH_SECRET });
if (!token) {
return NextResponse.next();
}

if (token.isBanned) {
return NextResponse.redirect(new URL("/banned", request.url));
}
if (token.isBanned) {
return NextResponse.redirect(new URL("/banned", request.url));
}

const cookieValue = request.cookies.get(TWO_FACTOR_COOKIE)?.value;
const userId = token.sub ? parseInt(token.sub, 10) : null;
const cookieValue = request.cookies.get(TWO_FACTOR_COOKIE)?.value;
const userId = token.sub ? parseInt(token.sub, 10) : null;

if (cookieValue && userId) {
const isValid = await validateTwoFactorCookieEdge(
cookieValue,
userId,
process.env.NEXTAUTH_SECRET ?? "dev-secret"
);
if (!isValid) {
const url = new URL("/auth/2fa-verify", request.url);
const res = NextResponse.redirect(url);
res.cookies.delete(TWO_FACTOR_COOKIE);
return res;
}
return NextResponse.next();
if (cookieValue && userId) {
const isValid = await validateTwoFactorCookieEdge(
cookieValue,
userId,
process.env.NEXTAUTH_SECRET ?? "dev-secret",
);
if (!isValid) {
const res = NextResponse.redirect(new URL("/auth/2fa-verify", request.url));
res.cookies.delete(TWO_FACTOR_COOKIE);
return res;
}

return NextResponse.next();
}

return NextResponse.next();
Expand Down
8 changes: 3 additions & 5 deletions apps/web/src/app/(marketing)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import Image from "next/image";
import Link from "next/link";
import { redirect } from "next/navigation";
import { Button } from "@bytesend/ui/src/button";
import { PricingCalculator } from "~/components/marketing/PricingCalculator";
import { CallToAction } from "~/components/marketing/CallToAction";
import { ComparisonTable } from "~/components/marketing/Comparison";
import { TrustStrip } from "~/components/marketing/TrustStrip";
import { Pricing } from "~/components/marketing/PricingSection";
import { DevSection } from "~/components/marketing/DevSection";
import { Features } from "~/components/marketing/Features";
import { Hero } from "~/components/marketing/Hero";
import { HowItWorks } from "~/components/marketing/HowItWorks";

import { env } from "~/env";

Expand All @@ -22,8 +19,9 @@ export default function Page() {
<main className="min-h-screen text-foreground bg-background">
<Hero />
<TrustStrip />
<Features />
<DevSection />
<Features />
<HowItWorks />
<Pricing />
<ComparisonTable />
<CallToAction />
Expand Down
43 changes: 43 additions & 0 deletions apps/web/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,46 @@
@source "../../../../packages/lib/src/**/*.{js,jsx,ts,tsx,mdx}";

@import "@bytesend/ui/styles/globals.css";

@theme {
--color-brand-ice: #85fcff;
--color-brand-teal: #00c3d6;
--color-brand-sky: #1fb5ff;
--color-brand-blue: #0057ff;
--color-brand-ink: #05070d;
}

html {
scroll-behavior: smooth;
}

/* Anchored sections land below the fixed marketing nav instead of under it. */
section[id] {
scroll-margin-top: 5rem;
}

[data-reveal] {
opacity: 0;
transform: translateY(16px);
transition:
opacity 600ms cubic-bezier(0.22, 1, 0.36, 1),
transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal="visible"] {
opacity: 1;
transform: none;
}

@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}

[data-reveal] {
opacity: 1;
transform: none;
transition: none;
}
}
8 changes: 7 additions & 1 deletion apps/web/src/app/login/login-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ export default function LoginPage({
const isVerifying = searchParams.get("verify") === "1";
const errorParam = searchParams.get("error");

const requestedCallback = searchParams.get("callbackUrl");
// Only same-site paths are honoured so the parameter can't be used as an open redirect.
const safeCallback =
requestedCallback && requestedCallback.startsWith("/") && !requestedCallback.startsWith("//")
? requestedCallback
: null;
const callbackUrl = inviteId
? `/join-team?inviteId=${inviteId}`
: "/dashboard";
: (safeCallback ?? "/dashboard");

// When NextAuth redirects to ?verify=1 after the user clicks the magic link,
// restore the email we stored in sessionStorage before submitting
Expand Down
Loading
Loading