Everything in this category so far has described getting one copy of a site live. Once that site matters to real users, editing that live copy directly stops being a safe way to work — this lesson covers why, and what replaces it.
Production is simply the term for whatever copy of a site real visitors are currently using. Anything that breaks production is visible immediately, to everyone, with no warning — a typo in a price, a broken checkout button, a page that fails to load.
A staging environment is a separate, near-identical copy of the site — same code, same hosting setup, usually a separate database with realistic-but-fake data — reachable only at a private or unlisted address, where changes are tested before they ever reach production. A mistake on staging is invisible to real visitors, by design.
| Setup | How it works |
|---|---|
| A second hosting environment | A literal second copy of the site, deployed the same way as production, at a subdomain like staging.yourdomain.com |
| Git branch environments | A "staging" or "develop" branch, separate from the "main" branch that production deploys from — merging staging into main is what promotes it to live |
| Preview deployments | Automatic, throwaway environments for every proposed change, covered next — the modern default on most Git-based hosting |
The Git-based deployment lesson mentioned every pull request getting its own temporary URL automatically. That is staging taken to its logical end — not one fixed staging copy shared and possibly fought over by an entire team, but a fresh disposable environment for every single proposed change, deleted once it merges or closes. Most modern cloud and managed platforms covered earlier in this category include this by default at no extra cost.
A full staging setup is not always justified for a small personal project with no other collaborators and low stakes if something breaks briefly. But even then, testing changes locally before deploying — running the site on your own computer first, the most basic form of an environment separate from production — is a version of the same discipline, worth adopting well before a project grows to the point where a proper staging environment becomes necessary.