2️⃣ Staging vs Production

What are Staging and Production Environments?

  • Staging: A pre-production environment that mimics the production setup. It’s used to test new features and fixes in an environment as close as possible to live before releasing them to real users.

  • Production: The live environment where your app is accessible by end users.


Why Use Both?

  • Safely test new updates without affecting real users.

  • Catch bugs or performance issues early.

  • Validate integration with third-party services (payment gateways, Cloudinary, etc.).

  • Run final QA and acceptance tests before launch.


Key Differences

Aspect
Staging
Production

Environment URL

staging.techtonic.com

techtonic.com

Database

Separate staging database

Live user database

API Keys

Test/sandbox keys

Live API keys

Performance

Similar to production but may have fewer resources

Fully optimized and scaled

Access

Restricted to developers and testers

Open to all users


Deployment Process

  1. Deploy code to staging branch or environment

  2. Run automated and manual tests

  3. Get stakeholder sign-off

  4. Merge to main/master branch for production deploy

  5. Deploy to production environment

  6. Monitor logs, metrics, and user feedback


Environment Variables Setup

Both environments require different .env files or configuration settings, for example:


Best Practices

  • Never share production secrets in staging or development.

  • Automate deployments to minimize manual errors.

  • Regularly sync staging database schema with production (but scrub sensitive data).

  • Use monitoring tools on both environments to compare performance.

Last updated