Most engineering advice arrives as a flat checklist: add caching, add a load balancer, index the database, split your bundles. Every item is good advice for some product. The list never says which product, or when.
Teams then fail in one of two directions. Some build for a scale they do not have: a distributed cache and a multi-region setup for an app with forty users. They pay for it in cost, in security surface and in hours spent running machinery instead of learning what users want. Others skip everything in the name of speed and ship queries that fall over at the first real load, with no backups and no way to see what broke.
Both are the same mistake. Neither team asked what stage the product is in.
The rule
Cheap correctness practices are defaults. Expensive optimizations are introduced when evidence shows they are needed.
Avoiding a bad query pattern costs nothing on day one, so you do it on day one. A caching tier costs real money and real attention every month it exists, so it waits until a measurement asks for it. Maturity is set by technical demands, risk and operating requirements. It is not set by a user count.
Measure first. Identify the bottleneck. Choose the least complex effective intervention. Validate the result. Record the decision.
The five stages
The stages describe growing engineering capability and growing operating complexity. They are a default progression and a planning aid. A product can need one Stage 3 capability early because of a specific workload, and another can sit at Stage 1 for years because nothing asks for more.
| Stage | Name | Objective | What you have by the end | What moves you on |
|---|---|---|---|---|
| 0 | Prototype | Build correctly | Correctness, basic security, lean dependencies, efficient default builds, no obvious query or rendering anti-patterns | A real production release or meaningful outside use is planned |
| 1 | Production | Establish operating baselines | Monitoring, error tracking, backups, safe migrations, performance audits, the right indexes, connection management | Measurements show repeated bottlenecks, rising cost or a need for stronger controls |
| 2 | Early traction | Optimize repeated work | Selective caching of responses, computations and queries; performance budgets; capacity planning | One instance, database or delivery path is nearing its limit |
| 3 | Growth | Scale infrastructure | Several application instances, load balancing, health checks, horizontal scaling, resilient deploys | Multi-region, very high availability or distributed data needs appear |
| 4 | Large scale | Operate distributed systems deliberately | Distributed caching, read replicas, partitioning where justified, multi-region, failover, tested disaster recovery | Ongoing review: complexity stays only while it pays for itself |
Note the last cell. The model has no finish line. At every stage, including the last, a system you no longer need is a cost you can remove.
What is free from day one
Stage 0 is not permission to be sloppy. It is the list of things that cost almost nothing when done from the start and are painful to retrofit:
- No N+1 database queries. Use joins, eager loading or batching.
- No needless re-renders or oversized client state updates. Profile before reaching for memoization.
- No unused dependencies. Each one is download size, attack surface and upkeep.
- Production builds that minify and split code along route or feature boundaries.
- Images compressed and correctly sized; non-critical media and scripts loaded late.
- Every unbounded list paginated, and API payloads kept small.
- High-frequency inputs debounced where it helps, without making the interface feel slow.
What Stage 0 leaves out matters as much. No distributed system for a workload that does not exist yet.
Four disciplines that never wait
The stages are about performance and scale. They are not a reason to postpone security, reliability or quality. These four run through every stage. Their foundations start early, and their depth and automation grow as the product matters more.
| Discipline | Starts with | Grows into |
|---|---|---|
| Security | Real authentication and authorization, input validation, secrets kept out of source code, least privilege for people and automation | Dependency scanning with timely patching, rate limiting and abuse controls, data retention and privacy controls |
| Reliability | Backups, health checks, safe migrations | Restore tests, clean shutdown, rollback, incident response, availability targets, recovery time and recovery point objectives |
| Observability | Error tracking and structured logs | Latency per endpoint and journey, database and connection monitoring, dashboards that tie user experience to system health and cost |
| Testing and delivery | Unit tests for the important business logic, checks before merging | Integration and end-to-end tests for critical journeys, preview environments where they cut release risk, deployment verification |
Move on evidence, not user counts
"We have 10,000 users, so we need Redis" is not an argument. A team should be able to say what problem a new component solves and why a simpler option is not enough. Start from the symptom:
| What you observe | First response | Only then |
|---|---|---|
| Slow database queries | Read the query plan, fix N+1, fetch less | Targeted indexes, then caching if repetition is still costly |
| Repeated expensive computations | Profile and remove needless work | Cache results with explicit invalidation |
| Repeated API requests | Look at client behaviour and endpoint semantics | Response caching or request deduplication where safe |
| Slow static assets | Check size, compression and cache headers | Use or tune a CDN |
| Large first page download | Analyse the bundle and the critical path | Code splitting, lazy loading, dependency removal |
| Too many database connections | Inspect connection lifecycle and concurrency | Connection pooling |
| High CPU or memory on one instance | Profile hot paths, look for leaks | Optimize, then add instances |
| One instance cannot keep up | Confirm the bottleneck and the real requirement | Several instances, load balancing, autoscaling with limits |
| Availability needs rise | Define the failure scenarios and recovery targets | Redundancy, failover, multi-region |
The middle column is the point. A load balancer in front of one overloaded server fixes nothing, and a cache in front of a bad query hides the problem while adding a new one.
One loop for every optimization
- Measure. Record a baseline from production telemetry, synthetic tests or a representative load test.
- Locate. Decide whether the bottleneck is the frontend, backend, database, network, a third party or the infrastructure.
- Prioritize. Weigh user impact, business risk, engineering effort, infrastructure cost and the ongoing burden of running it.
- Select. Choose the least complex change likely to solve the measured problem.
- Implement safely. Add tests, rollout controls and a way back.
- Validate. Compare before and after under comparable conditions.
- Document. Record the decision, the owner, the trade-offs, the measured result and what would make you revisit it.
An optimization is not done when the code merges. It is done when the measurement has moved and the decision is written down.
A scorecard per product
Each product keeps one short scorecard. It measures outcomes. A product does not score higher because it runs more infrastructure.
| Field | What to record |
|---|---|
| Product | Name, owner, business criticality, production environment |
| Current stage | 0 to 4, with a short reason |
| Required standards | What applies at this stage and why |
| Implemented controls | Evidence that each one is operating |
| Open gaps | Missing practices, risk, severity, owner |
| Baseline metrics | Latency (p50, p95, p99), error rate, database, infrastructure, cost per unit of work |
| Bottleneck | The constraint measured today, not a guessed future one |
| Next optimization | The proposed change, expected benefit, estimated effort |
| Trigger to revisit | A metric threshold, a new requirement or an operational event |
| Decision record | Date, approver, reasoning, result, next review |
A decision record can be five sentences. Problem: p95 latency on a busy endpoint rose after a feature launch. Evidence: tracing shows repeated identical database reads. First action: remove the duplicate reads. Follow-up: a targeted index if the query plan supports it. Only if needed: a cache with a defined lifetime and invalidation rule.
Using it across many products
A company-wide standard should be consistent without forcing every product onto the same infrastructure. Keep one central, versioned standard with clear owners. Let each project add to it where that does not weaken a mandatory control. Require an explicit, time-limited exception for any deviation. Review scorecards on a schedule and after any real change in traffic, risk or business importance. Retire controls and infrastructure that no longer earn their keep.
Automation helps collect evidence and enforce the rules. It does not replace engineering judgment.
The goal is not maximum infrastructure. The goal is the right level of engineering maturity for what the product needs today, with a deliberate path to the next level.