Email Scheduler & Rate-Limited Delivery
A queue that doesn't break when the load spikes
Features
- REST API hands jobs to Redis/BullMQ workers, so the API stays fast while delivery happens async across concurrent workers.
- Per-user quotas enforced with atomic Redis counters. Two workers can't double-count the same user.
- Retries fire on a configurable backoff. Temporary failures resolve themselves; permanent ones land in a dead-letter table with the reason attached.
- React dashboard streams send events over SSE. No polling. Job history + retry counts live in Postgres.
System Design & Architectural Pattern
Express API just enqueues. Never sends. A worker pool consumes jobs from BullMQ queues backed by Redis.
Rate limiting
The check-and-increment runs in a Lua script so multiple workers can't race. Quotas reset on a sliding window.
Observability
Every send writes to Postgres with timestamps, retry count, and a failure category. The same events go out on SSE for the dashboard.