SaaS Application
Web ApplicationProductionTeam-scale productBaseline SaaS architecture with sync APIs, async job processing, webhook billing, and cache layer. Suitable for scalable web apps with background workloads.
Recommended for: SaaS teams shipping subscription products
Scope Notes
Intended for SaaS teams shipping subscription products at Production complexity and Team-scale product scope. Treat the graph as a starting shape rather than a fixed stack: keep the topology and the signals below, then swap providers to match your platform.
Review Checklist
Use Case
SaaS products, subscription platforms, dashboards
Best Fit Scenarios
- B2B SaaS with billing and user roles
- Product teams splitting sync APIs from async workers
- Teams that need error visibility from day one
Stack Breakdown
Architecture Layers
Components by Category
frontend
backend
async
database
external
infra
Why This Topology Works
Frontend concerns stay separate from business logic behind an API gateway. Auth, billing and monitoring are distinct services, and the BullMQ queue keeps expensive work off the request path. Stripe webhooks arrive through the gateway rather than being triggered by the auth service.
Scaling Notes
NestJS and the workers scale horizontally behind the gateway. Redis caches sessions and hot reads, PostgreSQL is the system of record, and Auth Service owns identity tables. Vault injects the Stripe key and JWT signing material.
Observability
Sentry captures frontend, API and worker errors. The DLQ is alert-only by design: a non-empty queue pages the owner instead of silently retrying forever.
Typical Bottlenecks
- API throughput during tenant spikes
- Background job backlog around billing cycles
- PostgreSQL write pressure on high-cardinality events
Async Flow and Reliability
User actions stay fast on synchronous APIs while expensive work is queued to BullMQ and consumed by the worker service. Exhausted jobs land in the DLQ instead of disappearing, so failures are visible and replayable.
Upgrade Path
Start with one API service, one worker and PostgreSQL. Split billing, auth and reporting into independently deployable services once usage stabilises, then add read replicas for analytics traffic.