Ecommerce Website Developer

JournalAbout 2 min read

Staging environments that are actually useful

A staging site that differs from production in important ways will not catch the problems you built it to catch.

Written by

Nazir AbbasApproved contributor

Contributed by

Javed IqbalApproved contributor

Published

Abstract measured panel in the brand colours

Key takeaways

  • Realistic data volume, because performance problems only appear at scale
  • The same platform and runtime versions as production
  • The same caching behaviour, including the CDN
  • Use synthetic data, not a copy of the production customer database
  • Protect with authentication, not just robots; robots is not access control
  • Keep it rebuildable from scratch, which also proves the deployment works

Most staging environments are a copy of the code with a near-empty database and none of the integrations. They catch syntax errors and nothing else.

A staging environment is useful in proportion to how closely it matches production in the ways that matter.

Match the things that actually cause problems

  • Data volume. A category page with 12 products behaves nothing like one with 4,000. Performance problems only appear at realistic scale.
  • Platform versions. The same runtime, database and extension versions. A version difference is exactly the kind of thing staging should catch.
  • Caching behaviour. If production has a CDN and staging does not, you are not testing the system that will run.
  • Integrations. Sandbox endpoints for payment, stock and fulfilment, so the integration paths are exercised.

Use realistic data, not real data

Copying the production database to staging is the easy answer and usually the wrong one. It puts real customer records, real order history and real email addresses into a less protected environment, and it means a test email can reach a real customer.

Generate realistic volumes with synthetic records instead, or redact properly if you must copy. Redacting properly means replacing the data, not hiding it in the interface.

Keep it out of the index

A staging site that gets indexed will compete with production and leak unfinished work.

  1. Require authentication at the edge, for every request
  2. Send a noindex header on everything
  3. Disallow in robots as defence in depth only

Make it disposable

Staging should be rebuildable from scratch with one command. The moment it becomes a long-lived environment that has been hand-patched for two years, it stops resembling production and starts generating its own bugs.

Rebuilding regularly also proves that your deployment process works, which is the same process you will depend on under pressure.

Test the thing you are about to do

Before a release, run the specific journeys the release touches, at realistic data volume, with the integrations connected. A release tested only by loading the homepage has not been tested.

Frequently asked

Questions readers ask

What makes a staging environment actually useful?

Matching production in the ways that cause problems: realistic data volume, identical platform versions, the same caching layer and connected sandbox integrations. A copy of the code with an empty database catches syntax errors and nothing else.

Should I copy my live database to staging?

Usually not. It puts real customer records and order history into a less protected environment and means a test email can reach a real customer. Generate realistic volumes synthetically, or redact properly by replacing the data rather than hiding it.

How do I stop my staging site appearing in Google?

Require authentication at the edge for every request, and send a noindex header. A robots disallow is defence in depth only: a disallowed URL can still be known from external links, and a noindex tag cannot be read on a disallowed URL.

About the authors

Nazir Abbas

Written by

Nazir AbbasApproved contributor

Web Developer & Co-Founder

Builds and maintains ecommerce sites in React, Next.js and WordPress, and handles the technical side of search.

Javed Iqbal

Contributed by

Javed IqbalApproved contributor

SEO Specialist & Co-Founder

Leads search, with more than five years in ecommerce and technical SEO for businesses in the UK, the US and the UAE.

Editorial process: every article is written by one of the two co-founders and reviewed by the other before publication. Technical claims are checked against how the systems actually behave, and anything we cannot evidence is left out rather than asserted.

Related reading