Staging vs production

Staging and production run the same code on the same kind of infrastructure, and differ in who uses them and what they hold. Production is the live environment: real users, real data, real traffic and live integrations. Staging is a restricted copy for the team, with synthetic or anonymised data, little traffic and sandboxed integrations, used to rehearse a release.

The longer version

The staging environment has a page of its own, which defines it as the rehearsal that mirrors production. Set side by side, the two keep four differences however carefully the mirror is built. The first is data. Production holds what customers have created over years: records imported from an older system, names with unexpected characters, accounts in states no current screen can produce. Staging holds data somebody generated or anonymised, which is tidier, smaller and younger. The second is traffic. Production carries many people doing different things at once, at the hours they choose. Staging carries a few testers and a pipeline, so contention, queueing and cache behaviour under load are absent unless a load test supplies them.

The third difference is integrations. Production talks to the live payment provider, the real mail service and partners' real systems. Staging is pointed at sandboxes and test accounts, which can accept what the live service refuses and skip checks the live service applies. The fourth is access. Production is reached by the public through the real domain, a content delivery network and whatever browsers, extensions and networks people have. Staging sits behind a login or an allow-list and is visited from the team's own machines. Configuration follows from all four: production has its own secrets, domains, feature flag values and scaling settings, and each one is a place where the two environments can disagree.

Those differences decide which bugs wait for production. Data-shaped bugs need the record nobody thought to create. Concurrency bugs need two real users acting in the same moment. Performance problems need production's volume of rows and requests. Integration failures need the live provider's rules. Configuration faults, such as a missing environment variable or a flag left in the wrong state, exist only where that configuration is. Faults tied to a browser extension, an old device or a slow mobile network need the public. A pass on staging therefore supports a narrower claim than it appears to: the release works on this infrastructure with this data. Checks that run in production, meaning a smoke test after deployment, monitoring and a staged exposure to users, cover the remainder.

Staging is the last stop in a chain of environments. A common order is development, where code is written, then a test environment where the automated suites run and which is often rebuilt for each pipeline run, then staging, then production. Staging is where user acceptance testing, exploratory testing and performance checks usually happen, so UAT is an activity carried out on staging and not a separate synonym for it, although some organisations give acceptance an environment of its own. Teams often define acceptance criteria a change must meet on staging before it is promoted. Because one staging is commonly shared by several teams, one team's unstable build can break another team's tests, which is a reason to give each pull request its own preview environment and keep staging for the release. For a website, the staging site should be kept out of search results with a noindex tag or a password, or search engines can find a duplicate of the live site.

Common questions

How does a staging environment differ from production?

Production is the live system that real users reach, holding their data and connected to live services. Staging is a production-like copy that only the team can reach, holding synthetic or anonymised data and connected to sandboxes. The code and the infrastructure are meant to match, while the users, data, traffic and integrations do not.

Which bugs only appear in production?

Bugs that depend on something staging lacks appear only in production: unusual records in real data, simultaneous actions by real users, load at full volume, the live behaviour of third-party services, production-only configuration, and the browsers, devices and networks of the public. A tidy dataset and a handful of testers reproduce none of them.

Why does a release pass on staging and fail in production?

A staging pass shows that the release works under staging's conditions. Failure after it points to a condition that differed: a database far larger than the copy, a secret or environment variable set differently, a live provider enforcing a rule its sandbox ignores, or a record whose shape no test data had. Finding which condition differed is the first step of the investigation.

Should staging be the same size as production?

Matching production's shape matters more than matching its size. The same database engine and version, the same services and the same deployment pipeline make a staging pass meaningful at a fraction of the capacity. Full size is needed only for questions about capacity, and those can be answered by a load test on an environment scaled up for the purpose.

Can testing be done in production?

Some testing can only be done in production, and it is done with limits. A smoke test after each deployment, monitoring of real sessions, and features exposed first to staff or a small group behind a flag all check what staging cannot. Destructive tests and anything that could alter customer data stay in the earlier environments.

Is staging the same as UAT?

Staging is an environment and UAT is a kind of testing. User acceptance testing, where the business confirms the release does what it needs, is usually carried out on staging because staging is the closest copy of production. Some organisations run a separate acceptance environment, so the two words can name different places there.

What is the difference between dev, test, staging and production?

Development is where engineers write and run code on their own machines or a shared dev server. Test is where automated suites run against each build. Staging is a production-like copy for release rehearsal, acceptance and exploratory testing. Production is the live system users reach. Each step is closer to real conditions than the one before it.

Should a staging site be visible to search engines?

A staging site should be hidden from search engines, with a noindex tag, a password or an allow-list of addresses. Left open, it can be crawled as a duplicate of the live site. A password has the extra benefit of keeping unreleased work away from the public, which a noindex tag does not do.

Bug reports that arrive ready to triage.

Collect replay, console, network and browser context with the Free plan.

<script src="…/widget.js" data-key="pb_pub_…">