Start with product boundaries, not servers
A scalable SaaS platform is not created by adding more servers after traffic grows. It starts by making tenancy, identity, data ownership, background work, and observability explicit while the product is still small. The goal is controlled growth: each new customer should increase business load without multiplying operational uncertainty.
The five foundations of a scalable SaaS
- Tenant identity must be available at every data boundary, not inferred from UI state.
- Domain rules belong in services or domain modules so HTTP routes remain thin.
- Slow or retryable work should move to durable queues with idempotent consumers.
- Metrics should expose tenant-aware latency, failures, queue depth, and saturation rather than infrastructure numbers alone.
- Schema changes must be forward-compatible so application and database versions can overlap during deployment.
A request through the platform
The synchronous path validates tenant and authorization before reaching domain logic. Long-running side effects leave the request through a durable queue so failure and retry are visible.
SaaS request path from edge to durable work
The synchronous path validates tenant and authorization before reaching domain logic. Long-running side effects leave the request through a durable queue so failure and retry are visible.
A realistic launch path
Keep the durable boundary visible in code
A transaction that stores both the business record and an outbox event prevents a successful invoice from being lost between the database and a queue.
await db.transaction(async (tx) => {
const invoice = await tx.invoice.create({ data: input });
await tx.outbox.create({
data: { type: 'invoice.created', aggregateId: invoice.id }
});
});Architecture shortcuts that become expensive
Production checklist
- Define tenant isolation and authorization tests.
- Make writes idempotent where retries can happen.
- Use queues for non-critical side effects.
- Add readiness, health, metrics, and correlation IDs.
- Rehearse migrations and rollback on a copy of production-like data.
