The row is durable
The notification and the outbox event share one Postgres transaction. A crash after 202 still leaves work the dispatcher can publish.
Notification platform
A client gets HTTP 202 when the notification, its outbox event, and the idempotency record commit together. Workers publish that event and talk to the provider after the request is already done.
ready · postgres ok · redis ok · api-2-1-nvo9d9
Every page shares the navigation bar at the top. The other routes are machine-facing APIs, webhooks, health checks, and metrics—not separate user interfaces.
The system design, request path, reliability guarantees, and technology stack.
/ Interactive consoleSend demo notifications, trigger failures and retries, inspect attempts, audit events, queue state, and captured email.
/console/ API documentationExplore the OpenAPI contract, authentication methods, request schemas, responses, and every supported endpoint.
/docs/ Test inboxEvery email the simulator sent, captured by Mailpit over SMTP. Read the subject and body without emailing a real person. The full Mailpit UI stays available at /mailpit/.
Nginx spreads traffic across two API instances of the same application. They run identical code, share Postgres and Redis, and keep no notification state in process memory. The API does not wait for the provider.
The notification and the outbox event share one Postgres transaction. A crash after 202 still leaves work the dispatcher can publish.
Email, SMS, and push are a simulator behind the worker. Captured mail shows up in the console inbox.
The same idempotency key returns the original accept. A Redis lock and the provider’s own idempotency keep a second worker from double-delivering.
Nginx receives the call and picks between two instances of the same API service using the fewest open connections. Both are stateless and stamp x-nplat-instance.
The API checks an API key or a JWT, applies a Redis token bucket, and validates the body with Zod. Marketing mail that the user opted out of is cancelled here.
If send_at is due, the dispatcher claims the row with FOR UPDATE SKIP LOCKED and appends it to the Redis stream nplat:jobs.
The consumer group workers reads the stream. A future send_at waits for the scheduler, which inserts the outbox row when it is time.
A failed attempt is acknowledged, then stored as retrying with full-jitter backoff. The base is 500ms and the cap is 30 seconds. Exhausted jobs land on nplat:jobs:dlq.
The provider calls back through Nginx with an HMAC webhook. The console shows the status, attempts, audit rows, and the message Mailpit captured.
One Docker Compose stack. Postgres and Redis stay the source of truth and the queue. Prometheus and Grafana read the same process metrics the API and workers expose.