Designing a backend system means turning a fuzzy product idea into a set of services, data stores, and interfaces that stay correct and fast under real load. The short version: pin down requirements and quality targets first, sketch the API and data model, pick a simple architecture you can operate, then stress-test the design on paper before you write much code. Requirements come before technology choices every time; the stack you pick last is usually the stack you keep.
That ordering matters because most failed backends are not defeated by a missing framework. They're defeated by an unclear load target, a data model that fights the queries, or an architecture the team can't run at 3 a.m. This guide walks through a design sequence you can apply to a small internal tool or a consumer service with millions of users, with the checkpoints that tell you when a decision is solid enough to build on.
Pin down functional requirements before naming any technology
Functional requirements are the verbs of your system: who does what, and what the system promises back. Write them as user-facing capabilities with inputs, outputs, and failure behavior. "Users can upload a receipt image and get an extracted total within five seconds, or a clear error" is a requirement. "Use a message queue" is not.
A practical format is a short list of use cases, each with a trigger, the happy path, and the two or three most likely failure paths. For a subscription billing backend, that list might include sign-up, plan change, payment retry, invoice retrieval, and refund. Each one surfaces a data question (what must be stored), an interface question (what the client calls), and a consistency question (what must be true immediately versus eventually).
Scope discipline is the hard part. Teams routinely design for the product they hope to have in three years and ship something that serves the product they have now badly. An explicit non-goals list—"no multi-region writes in v1," "no self-service admin console"—protects the design from speculative complexity and gives you a defensible reason to say no. You can always add scope; removing a half-built distributed system is far more expensive.
Turn quality attributes into testable targets
Non-functional requirements decide the architecture far more than features do. Translate each quality attribute into a number, a condition, and a measurement point, because "fast" and "highly available" are not design inputs.
| Attribute | Weak phrasing | Usable target |
|---|---|---|
| Latency | "Fast responses" | p95 server latency under 200 ms for reads at 500 requests/second, measured at the load balancer |
| Throughput | "Handle scale" | Sustain 2,000 requests/second at peak with headroom for 2x growth in 12 months |
| Availability | "Always up" | 99.9% monthly availability for the public API, excluding planned maintenance windows |
| Durability | "Don't lose data" | Zero acknowledged-write loss; recovery point objective under 5 minutes |
| Consistency | "Accurate" | Read-your-writes for a user's own profile; order totals must never be stale |
| Cost | "Cheap" | Infrastructure under a stated monthly ceiling at launch volume |
Percentiles matter more than averages because averages hide the slow tail that users actually notice. State the measurement point too—latency at the server is not latency at the phone. And make targets falsifiable: if you can't describe a load test that would prove or disprove a target, it isn't a target yet.
One useful discipline is to model the read/write ratio and the peak-to-average ratio early. A system that is 95% reads with a 3x peak spike needs a different data strategy than one with heavy, contention-prone writes. Both numbers shape caching, replication, and queueing decisions later.
Sketch the API contract and the data model together
API and data model constrain each other, so design them in the same pass rather than sequentially. Start from the client's needs, then ask what storage shape makes those calls cheap and correct.
For each endpoint, define the resource, the request and response shape, status codes, pagination, idempotency behavior for writes, and versioning policy. A create-payment endpoint should accept an idempotency key so a client retry after a timeout doesn't double-charge. A list endpoint should specify cursor-based pagination if the underlying data changes often, because offset pagination drifts and gets slower deep into large tables.
Then sketch tables. For a typical order system: users, orders, order_items, payments, and an events or outbox table. Write down the access patterns before the schema—"get a user's last 20 orders by created time," "sum order totals per day"—and check that each pattern maps to an index or a natural key. A schema that can't serve its top access patterns without full scans is a design defect, not an optimization to defer.
Two data-model decisions carry outsized weight:
Identity and keys. Choose stable identifiers (UUIDs or a sequenced ID with a public opaque token) and decide whether keys are generated by the database or the application. This affects idempotency, sharding later, and how you expose IDs to clients. Normalization versus denormalization. Keep transactional data normalized for correctness, and denormalize deliberately where read volume demands it—a cached order summary, a materialized count—with a documented refresh path. Undocumented duplication is how systems drift out of sync.
If a relational database fits your access patterns and scale, take it. PostgreSQL or MySQL handles a very large share of real workloads, gives you transactions and constraints, and keeps operational complexity low. Reach for alternatives when a specific requirement pushes you off that path, not because a different store sounds more modern.
Choose an architecture you can actually operate
The architecture decision is really about decomposition and communication. Three broad shapes cover most systems:
Modular monolith. One deployable unit with clear internal module boundaries. Simplest to build, test, and operate; excellent default for most teams and most products. Service-oriented. A handful of services split along genuine domain boundaries, communicating over HTTP or a message broker. Buys independent scaling and team autonomy at the cost of network failure modes and operational overhead. Event-driven. Services publish and consume events, decoupling producers from consumers. Great for workflows with fan-out and slow side effects (email, search indexing, analytics), but it introduces eventual consistency you must design for.
The trap is splitting into services too early. Every service boundary is a network call that can time out, a deployment you must coordinate, and a data consistency problem you now own. A modular monolith with disciplined internal interfaces lets you extract services later when a module genuinely needs independent scaling or ownership. That extraction is much easier than merging services you split prematurely.
When you do need asynchronous work, the transactional outbox pattern is a reliable way to avoid "saved to the database but the event never fired": write the event to an outbox table in the same transaction as the business change, then relay it to the broker. It costs one extra table and a relay process, and it removes a whole class of silent data loss.
For failure isolation, apply timeouts, retries with backoff and jitter, circuit breakers on outbound calls, and bulkheads so one slow dependency can't exhaust all workers. These are design-time decisions, not library switches you flip after launch.
Build in reliability, security, and observability from the start
Reliability features such as backups are cheaper to design in than to bolt on. Decide early:
Backups and restore drills. A backup you've never restored is a hope. Pick a recovery time objective and test the restore path on a schedule. Replication and failover. For a single primary database, know what happens when it dies: how long promotion takes and whether clients reconnect cleanly. Rate limiting and quotas. Protect the system from one noisy client and from itself. Token-bucket limits per API key are a common, understandable default. Graceful degradation. Decide which features can fail independently—recommendations can go stale, checkout cannot—and make the failure explicit rather than letting it cascade.
Security belongs in the design, not a later hardening phase. Authenticate and authorize at a defined trust boundary, keep secrets out of code and version control, encrypt traffic in transit and sensitive data at rest, and validate all input against a schema. Log security-relevant events (auth failures, permission denials) without logging secrets, tokens, or full payment data. Apply least privilege to database users and service credentials so a compromised component has limited reach.
Observability is the other half of operability. You need structured logs with a request ID that follows a request across components, metrics for latency, error rate, throughput, and saturation (the four golden signals), and traces for multi-service request paths. Instrument from day one because retrofitting tracing into a live system is painful. Define a couple of alert conditions tied to user impact—error rate above a threshold, p95 latency breach—rather than alerting on every internal blip.
Work through a concrete design, end to end
Take a simple but realistic case: a task-management API used by web and mobile clients, with roughly 10,000 daily active users and a peak of 300 requests per second.
Requirements. Users create projects and tasks, assign tasks, and comment. Clients poll for updates. Data must survive; a lost task is a product failure. Reads outnumber writes about 9 to 1.
Quality targets. p95 read latency under 150 ms, p99 under 400 ms; availability 99.9%; durable writes with zero acknowledged loss.
API sketch. REST resources: /projects, /projects/{id}/tasks, /tasks/{id}/comments. Writes accept an idempotency key. Lists use cursor pagination. A /sync?since= endpoint returns changed records after a timestamp for polling clients.
Data model. Relational tables: projects, tasks, comments, plus a change_log table that records inserts and updates with a monotonic sequence. Access patterns are covered by indexes on tasks(project_id, created_at) and change_log(sequence).
Architecture. A modular monolith behind a load balancer, two stateless application instances, one primary database with a read replica, and a cache for hot project lists. Comments trigger a background job (written via the outbox table) to send notifications. This system is boring on purpose—it meets the targets with components a small team can operate.
Failure walk-through. If the replica lags, sync clients might miss recent changes; the fix is to serve sync queries from a source that includes the primary's recent writes or to bound the lag and alert on it. If the cache dies, latency rises but correctness holds because reads fall back to the database. If a write times out, the idempotency key makes the retry safe.
Load check. At 300 requests/second and 9:1 reads, that's about 270 read requests/second and 30 writes/second—comfortably within a single well-indexed relational database. The design has headroom before any sharding conversation, which is exactly the point.
Estimate scale and cost before you commit
Rough sizing catches design errors early. Two calculations do most of the work:
Storage. Estimate row size, average rows per user, and growth. If 10,000 active users generate 50 tasks each per year at roughly 500 bytes per task, that's about 250 MB of task data per year before indexes; indexes often add 30–100% on top, so budget roughly 500 MB. That's trivial. A media-heavy product would need a different conversation about object storage and bandwidth—which the estimate reveals before you've built on a bad assumption.
Throughput headroom. Compare target peak against a measured or published capacity figure for your chosen datastore, and keep a margin—commonly 2x peak to absorb spikes and growth. If the estimate lands within 30% of a single node's practical limit, plan the next step (read replicas, partitioning) before launch rather than during an incident.
Cost follows from these: instance count, replica count, storage growth, and egress. Model monthly cost at launch volume and at the 12-month target. A design that's affordable at 10,000 users but ten times over budget at 100,000 is a design you should reconsider now.
Test the design against failure and load before writing much code
Validate the design with artifacts cheap to produce: a sequence diagram for each critical flow, a list of failure modes with a response for each, and a load-test plan that maps to your quality targets. Walk the critical path—sign-up, the most-used write, the most-used read—and ask at each hop what happens if it's slow, unavailable, or returns bad data.
Write a short failure-mode table: dependency, symptom, mitigation, detection. For a database primary failure: writes fail, promotion takes some minutes, clients retry with backoff, an alert fires on failed writes. For a broker outage: async notifications stall, core writes continue, backlog drains after recovery, alert on consumer lag. If a row has no mitigation, that's an accepted risk—record it explicitly so it's a decision rather than an oversight.
Run a small load test against a prototype of the riskiest path before committing. The goal isn't a benchmark; it's to find the first bottleneck while it's still cheap to change the schema or the index. Keep a success check: does the measured p95 and error rate meet the targets under a load profile that resembles real traffic (including spikes), not a flat request stream?
Common design mistakes and how to avoid them
Designing for hypothetical scale. Building sharding, microservices, and multi-region replication for a product with a few thousand users adds failure modes with no benefit. Match complexity to measured needs and documented growth. Skipping the data model review. Most performance problems are data-model problems wearing a disguise. Review access patterns against indexes before launch. Implicit consistency assumptions. If a feature reads from a replica or a cache, say so in the design and make the staleness window explicit. "It should be fresh" is not a consistency model. No idempotency on writes. Mobile clients retry. Networks duplicate. Without idempotency keys, retries create duplicates and refunds become arguments. Treating observability as optional. Designing logs, metrics, and traces at the start costs little; adding them to a live, misbehaving system costs much more. One giant shared database user. Least privilege and separate credentials per component limit the blast radius of a bug or breach.
When to bring in specialists
Most of the guidance here is ordinary engineering judgment, but a few situations warrant a security or data-protection professional: handling regulated personal data, processing payments, designing authentication for a public-facing system, or operating under a compliance regime with audit obligations. Those areas carry legal and financial exposure where a general design guide isn't enough. Bring in qualified help early—retrofitting compliance controls into a shipped system is far more expensive than designing for them.
The core method holds regardless: requirements and targets first, API and data model together, the simplest architecture that meets the targets, reliability and security designed in, and a load-and-failure review before you build. The design will change as you learn, and that's fine—a design you can revise cheaply beats a perfect one you can't operate.