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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ DATABASE_URL=postgresql://bytesend:changeme@localhost:5432/bytesend

REDIS_URL=redis://localhost:6379

# Optional: Spamhaus Data Query Service key. Public DNSBL queries from cloud resolvers are refused, so blacklist checks report "unknown" without it.
SPAMHAUS_DQS_KEY=

# Development only: print every SQL query Prisma runs (very noisy).
# PRISMA_LOG_QUERIES=true

# Optional: prefix all Redis keys (useful when sharing a Redis instance)
# REDIS_KEY_PREFIX=bytesend:

Expand Down
156 changes: 109 additions & 47 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,142 @@
![ByteSend](../apps/web/public/nameplate.png)
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="../apps/web/public/brand/wordmark-dark.png">
<img alt="ByteSend" src="../apps/web/public/brand/wordmark-light.png" width="420">
</picture>
</p>

<p align="center">
<strong>Open-source email infrastructure for developers.</strong><br>
Transactional and marketing email through a REST API, SMTP relay and SDKs managed on
<a href="https://bytesend.cloud">bytesend.cloud</a> or self-hosted on your own AWS account.
</p>

<p align="center">
<a href="https://bytesend.cloud">Website</a> ·
<a href="https://docs.bytesend.cloud">Docs</a> ·
<a href="https://docs.bytesend.cloud/api-reference/introduction">API reference</a> ·
<a href="https://github.com/NodeByteLTD/ByteSend/releases">Releases</a> ·
<a href="https://https://discord.gg/C2Q4GHXKQA">Discord</a>
</p>

<p align="center">
<a href="../LICENSE"><img alt="License: AGPL-3.0" src="https://img.shields.io/badge/license-AGPL--3.0-0057ff"></a>
<a href="https://github.com/NodeByteLTD/ByteSend/releases"><img alt="Latest release" src="https://img.shields.io/github/v/release/NodeByteLTD/ByteSend?color=1fb5ff"></a>
<a href="https://https://discord.gg/C2Q4GHXKQA"><img alt="Discord" src="https://img.shields.io/badge/chat-discord-00c3d6"></a>
</p>

**Open-source email infrastructure that works.** REST API, SMTP relay, campaigns, contact management, and real-time webhooks self-hosted or managed on [bytesend.cloud](https://bytesend.cloud).
---

[Dashboard](https://bytesend.cloud) · [Docs](https://docs.bytesend.cloud) · [API Reference](https://docs.bytesend.cloud/api-reference/introduction) · [Discord](https://discord.gg/nodebyte)
## Send your first email

---
```ts
import { ByteSend } from "bytesend-js";

const bytesend = new ByteSend("bs_your_api_key");

## Cloud
await bytesend.emails.send({
from: "Acme <hello@acme.com>",
to: "customer@example.com",
subject: "Welcome to Acme",
html: "<p>Thanks for signing up!</p>",
});
```

The fastest way to get started is the managed cloud at [bytesend.cloud](https://bytesend.cloud). No infrastructure to manage just sign up, verify a domain, and start sending.
Prefer another language or no code at all? Use the [Python](../packages/python-sdk) or [Go](../packages/go-sdk) SDK, call the [REST API](https://docs.bytesend.cloud/api-reference/introduction) directly, or point any app at the [SMTP relay](https://docs.bytesend.cloud/get-started/smtp).

## What's included

---
**Sending**
- REST API, SMTP relay, and SDKs for TypeScript, Python and Go
- Scheduled sends, batch sends of up to 100 emails, idempotency keys and custom headers
- Templates built in a visual editor, with variables
- Per-domain open and click tracking

**Marketing**
- Contact books with double opt-in and one-click (RFC 8058) unsubscribe
- Campaigns with batching and send windows

## Self-Hosting
**Deliverability**
- Guided domain setup with DKIM, SPF (custom MAIL FROM) and DMARC checks
- Automatic suppression of hard bounces and complaints
- Bounce and complaint rates enforced per team at Google and Yahoo sender thresholds
- Outbound spam scoring: suspicious mail is flagged, high-risk mail is held for review
- Daily domain blocklist monitoring (Spamhaus DBL, SURBL, URIBL)
- Move a domain between SES regions without downtime

ByteSend is fully self-hostable under the AGPL-3.0 license.
**Operations**
- Signed webhooks with retries for every email and domain event
- Team notifications to Discord, Slack, Microsoft Teams, Telegram or any webhook
- Teams with roles, API keys scoped by permission and domain, and 2FA
- An admin panel with platform overview, audit log, email explorer and spam review

## Cloud or self-hosted

**Cloud** — [bytesend.cloud](https://bytesend.cloud) is the fastest start: sign up, verify a domain and send. No infrastructure to run.

**Self-hosted** — ByteSend is free to self-host under AGPL-3.0. You bring PostgreSQL, Redis and an AWS account with SES.

```bash
git clone https://github.com/NodeByteLTD/ByteSend.git
cp docker/prod/.env.example docker/prod/.env
# fill in your values
cd ByteSend
cp docker/prod/.env.example docker/prod/.env # fill in your values
docker compose -f docker/prod/compose.yml --env-file docker/prod/.env up -d
docker compose -f docker/prod/compose.yml --env-file docker/prod/.env exec web pnpm db:migrate-deploy
```

Full setup guide (reverse proxy, TLS, firewall, SMTP relay): [docs.bytesend.cloud/self-hosting/overview](https://docs.bytesend.cloud/self-hosting/overview)

---

## Tech Stack
The [self-hosting guide](https://docs.bytesend.cloud/self-hosting/overview) covers SES setup, reverse proxy and TLS, the SMTP relay and upgrades.

| | |
|---|---|
| Framework | Next.js 15 (App Router) |
| Language | TypeScript |
| Database | PostgreSQL + Prisma |
| Cache | Redis |
| Email delivery | AWS SES |
| Auth | NextAuth.js v5 |
| Monorepo | Turborepo + pnpm |

---
## Local development

## Development
You need Node.js 20.19+, pnpm 9+ and Docker.

```bash
pnpm install
cp .env.example .env # fill in values, then symlink: ln -s ../../.env apps/web/.env
pnpm dev # starts app at http://localhost:3000
pnpm db:migrate-dev # run migrations
cp .env.example .env # fill in values
pnpm dx:up # Postgres, Redis and MinIO in Docker
pnpm db:migrate-dev # apply database migrations
pnpm dev # web app on http://localhost:3000
```

See [docs.bytesend.cloud/get-started/local](https://docs.bytesend.cloud/get-started/local) for the full local setup guide.
| Command | What it does |
|---|---|
| `pnpm dev` | Run every app in watch mode |
| `pnpm build` | Production build |
| `pnpm lint` | Lint all packages |
| `pnpm test:web` | Web unit tests (Vitest) |
| `pnpm test:web:all` | Unit and integration tests (needs `pnpm dx:up`) |
| `pnpm db:studio` | Open Prisma Studio |
| `pnpm dx:down` | Stop the local Docker services |

---
The [local setup guide](https://docs.bytesend.cloud/get-started/local) walks through the environment variables.

## Contributing
## Repository layout

1. Fork the repo and create a feature branch
2. Commit with [Conventional Commits](https://www.conventionalcommits.org/)
3. Open a pull request against `main`
| Path | What's there |
|---|---|
| [`apps/web`](../apps/web) | Next.js dashboard, tRPC API, public REST API (Hono) and background jobs |
| [`apps/smtp-server`](../apps/smtp-server) | SMTP relay that forwards mail to the ByteSend API |
| [`apps/docs`](../apps/docs) | Documentation site |
| [`packages/sdk`](../packages/sdk) | TypeScript SDK (`bytesend-js`) |
| [`packages/python-sdk`](../packages/python-sdk) | Python SDK (`bytesend`) |
| [`packages/go-sdk`](../packages/go-sdk) | Go SDK (`github.com/nodebyteltd/bytesend-go`) |
| [`packages/ui`](../packages/ui) | Shared UI components |
| [`packages/email-editor`](../packages/email-editor) | Visual email template editor |

Please check existing issues before opening a new one.
**Built with** Next.js 16 · TypeScript · tRPC · Hono · Prisma · PostgreSQL · Redis · BullMQ · AWS SES · NextAuth · Tailwind CSS · Turborepo

See also:
## Contributing

- [Contributing Guide](CONTRIBUTING.md)
- [Code of Conduct](CODE_OF_CONDUCT.md)
- [Security Policy](SECURITY.md)
- [Support](SUPPORT.md)
Contributions are welcome.

---
1. Open or comment on an issue first, so work doesn't overlap.
2. Branch from `develop` and use [Conventional Commits](https://www.conventionalcommits.org/) (`feat(scope): …`, `fix(scope): …`).
3. Open your pull request against `develop`.

## License
Read the [contributing guide](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) before you start. Notes for AI coding agents are in [AGENTS.md](../AGENTS.md).

Found a security issue? Please report it privately as described in the [security policy](SECURITY.md) rather than opening an issue. For help, see [support](SUPPORT.md).

ByteSend is licensed under the **GNU Affero General Public License v3.0** (AGPL-3.0).
## License

See [LICENSE](LICENSE) for full details.
ByteSend is licensed under the [GNU Affero General Public License v3.0](../LICENSE). If you run a modified version as a network service, the AGPL requires you to make your changes available to its users.
2 changes: 1 addition & 1 deletion .github/SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Need help with ByteSend?

## Community Support

- Discord: https://discord.gg/nodebyte
- Discord: https://https://discord.gg/C2Q4GHXKQA
- Docs: https://docs.bytesend.cloud

## Commercial / Cloud Support
Expand Down
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [0.4.0] - 2026-10-18

### Added

#### Brand
- **New identity: "Speed Ribbon"** — nested envelope-arrows trailing into motion lines, in the existing four blues (`#85FCFF`, `#00C3D6`, `#1FB5FF`, `#0057FF`) on ink `#05070D`, with a two-tone Sora wordmark; ships in full, compact (≤40px) and glyph (≤20px) detail levels so it stays legible down to a 16px favicon
- **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

#### 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
- **Grouped admin navigation** and **Ctrl/⌘+K global search** across users, teams, domains and emails
- **Audit log** (`/admin/audit`) — every admin mutation is recorded with actor, target and a before/after diff; filterable, and shown per team and per user
- **Team detail pages** (`/admin/teams/[id]`) — usage, 7-day deliverability gauges, members, domains (with blacklist and region-move status), API keys, webhooks, subscription, limits, plan assignment, audited block/unblock with a reason, and typed-confirmation delete
- **User detail pages** (`/admin/users/[id]`) — flags, 2FA, sign-in methods, active sessions, backup emails and teams
- **Deliverability** (`/admin/deliverability`) — every team's 7-day hard-bounce and complaint rates against the enforcement thresholds, with block/unblock
- **Email explorer** (`/admin/emails`) — cross-team sending history with status, recipient, sender and subject filters and an event timeline; viewing a message body is audited and rendered in a fully sandboxed frame
- **Domain blacklist monitoring** (`/admin/blacklists`) — verified sending domains checked daily against Spamhaus DBL, SURBL and URIBL with Discord alerts on new listings and manual re-checks; refused public-resolver queries report "Unknown" instead of a false "clean"
- **Spam review** (`/admin/spam`) — queue of held and flagged outbound messages with rule hits, release and reject

#### Sending
- **Outbound spam detection** — rule-based scoring for phishing phrases, brand impersonation, mismatched/IP/shortened/punycode links, `javascript:`/`data:` links, executable attachments, hidden text and more; score ≥ 5 is flagged and sent, ≥ 10 is held for review with the new `HELD` email status; campaigns are scanned once at launch; five holds in 24 hours blocks the team automatically
- **Change sending region** — team admins can move a verified domain to another SES region from the domain page with no downtime: the new identity is registered under a region-specific DKIM selector, sending stays on the old region until the new DKIM and MAIL FROM verify, then switches automatically; the old identity is retired 24 hours later

#### Account
- **Connected accounts** — connect, reconnect and disconnect GitHub, Google and Discord from account settings; "Use this email" adopts a provider's email through the existing two-step email-change verification
- Email changes are now available to users who signed up with OAuth

### Changed
- **Campaign scheduler** — skips the database entirely while no campaign is due (Redis idle flag, cleared whenever a campaign is scheduled, resumed or sent), and registers its tick with `upsertJobScheduler` after removing stale repeatable jobs left by earlier tick intervals
- **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

### Fixed
- **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`

### 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)
- Team roles corrected to Admin and Member (the guide previously described Editor and Viewer roles that don't exist), and built-in two-factor authentication documented
- `HELD` added to the email status enums in the OpenAPI spec; TypeScript SDK types regenerated (also picks up the previously missing `/v1/smtp/auth` types)
- TypeScript SDK README now installs the correct package, `bytesend-js`
- Docs site and repository README use the new brand

### Migrations
- `20261018200000_add_admin_audit_log`, `20261018210000_add_domain_blacklist_checks`, `20261018220000_add_account_email`, `20261018230000_add_domain_region_move`, `20261019000000_add_spam_scans`

### Environment
- `SPAMHAUS_DQS_KEY` (optional) — Spamhaus Data Query Service key for reliable DBL lookups
- `PRISMA_LOG_QUERIES` (optional, development)

---

## [0.3.2] - 2026-06-23

### Added
Expand Down
6 changes: 4 additions & 2 deletions apps/docs/api-reference/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,8 @@
"COMPLAINED",
"FAILED",
"CANCELLED",
"SUPPRESSED"
"SUPPRESSED",
"HELD"
]
},
"createdAt": { "type": "string" },
Expand Down Expand Up @@ -755,7 +756,8 @@
"COMPLAINED",
"FAILED",
"CANCELLED",
"SUPPRESSED"
"SUPPRESSED",
"HELD"
]
},
"scheduledAt": {
Expand Down
Loading
Loading