Examples
Working examples you can clone and run
The repository includes a set of runnable examples that cover common patterns — from a single email send to multi-provider failover, custom channels, middleware composition, and observability. Each example is self-contained and can be run with a single command.
What's included
Single send
Send one email through a typed procedure with schema validation.
Batch send
Send to multiple recipients with interval spacing.
SMTP
Deliver through Gmail SMTP with a real transport.
React Email
Use React components as email templates.
Multi-channel
Email, SMS, and push through a single catalog.
Custom channel
Build a Slack channel with defineChannel and a custom HTTP transport.
Failover
Multi-transport with automatic failover between providers.
Round-robin / Race / Parallel / Mirrored
All multi-transport strategies with working configurations.
Dry run
Short-circuit sends in development without delivering.
Rate limiting
Throttle sends per recipient with withRateLimit.
Hooks
Observe the send lifecycle with onBeforeSend, onAfterSend, and onError.
Plugins
Bundle middleware and hooks into reusable plugins.
Observability
Combine tracing, event logging, and rate limiting in one setup.
Web push
Hono server with VAPID key generation, subscription management, and a browser client.
Kitchen sink
Everything together — multi-channel, middleware, hooks, plugins, and multi-transport.
Running an example
git clone https://github.com/better-notify/better-notify.git
cd better-notify
pnpm install
pnpm devThe pnpm dev command starts the canonical demo example. To run a specific example, check the examples/ directory for instructions.
All examples work with Node 22+ and Bun.