Deploying a full-stack app safely requires more than pushing code to a hosting provider. You need a repeatable way to separate development, staging, preview, and production configuration; protect credentials; connect the correct database; run migrations in the right order; and verify that a release can be promoted or rolled back. This guide provides a practical deployment workflow, an environment-variable inventory, recurring checkpoints, and a rollback template you can reuse whenever you build and deploy apps.
Overview
A reliable deployment process treats each environment as a controlled system rather than a different collection of settings. Development is optimized for experimentation, preview environments are used to test a branch or pull request, staging should resemble production closely enough for release validation, and production serves real users and data.
The exact labels differ across app development platforms, cloud hosting providers, and backend services, but the underlying responsibilities are similar. Your application needs a build configuration, runtime configuration, access to the appropriate services, and a release procedure that records what changed.
Start by defining the promotion path:
- Development: Local code, disposable data where possible, and developer-specific credentials.
- Preview: An isolated deployment for a branch, pull request, or proposed change.
- Staging: A shared validation environment with controlled data and production-like settings.
- Production: The protected environment serving users and requiring the strongest access controls.
Do not assume that copying production variables into staging is safe. Each environment should use the least access it needs, separate database credentials where practical, and an explicit list of permitted integrations. For broader launch checks, pair this workflow with the production readiness checklist for cloud apps.
What to track
1. Build and runtime requirements
Record the runtime version, package manager, lockfile strategy, build command, output directory, start command, and required system dependencies. A deployment can fail even when the application works locally if the cloud build uses a different runtime or omits a native dependency.
Keep these values in version control when they are configuration rather than secrets. Pin versions where your team needs reproducible builds, and document deliberate upgrades. The deployment handoff should answer: which commit is being built, which command builds it, and which process starts it?
2. Environment-variable inventory
Create an inventory with four columns: variable name, purpose, environment, and sensitivity. Add whether the value is required at build time, runtime, or both. A useful starting point looks like this:
| Category | Example purpose | Public or sensitive | Check |
|---|---|---|---|
| Application | Environment name or feature flag | Usually public or low risk | Confirm expected value per environment |
| Client configuration | API base URL or public project identifier | May be exposed to browsers | Never treat visibility as proof of safety |
| Authentication | Session, signing, or encryption secret | Sensitive | Store in a managed secret store |
| Database | Connection URL or password | Sensitive | Use the correct environment's database |
| External services | Payment, email, storage, or API credential | Often sensitive | Use test credentials outside production |
| Operational settings | Log level, timeout, or job schedule | Usually non-secret | Check safe production defaults |
Public configuration is information the client application is designed to receive, such as a browser-facing service URL or public identifier. A secret grants authority or protects data, such as a database password, private API token, signing key, or encryption key. Do not place sensitive values in source code, committed environment files, client bundles, screenshots, issue comments, or build logs.
3. Secret handling
Use the hosting provider's encrypted secret-management feature or an external secret manager. Restrict who can read or change production secrets, audit access where the platform supports it, and give each service only the credentials it needs. Keep a record of secret ownership and rotation steps without recording the secret itself.
Use separate credentials for local development, preview deployments, staging, and production. If a credential is exposed, revoke or rotate it promptly, then redeploy any process that cached the old value. Remember that changing a secret in a provider dashboard may not affect already running instances until they are rebuilt or restarted.
4. Database and migration state
Track the database host, database name, migration tool, migration version, backup status, and whether the application can run against the new schema before all application instances are updated. Prefer backward-compatible migrations when a rolling deployment is possible: add a nullable column before requiring it, deploy code that can read both formats, backfill data, and remove old structures only after they are no longer used.
Never test an irreversible migration against production first. Confirm the target database by checking a non-sensitive identifier, such as an environment label, before running commands. A preview or staging database should contain only data that the team is authorized to use.
5. Preview-environment behavior
Define what each preview includes. It may have its own application deployment but share a non-production database, use isolated seed data, or connect to mocked services. Document whether preview URLs are publicly accessible, how long they remain active, and whether scheduled jobs, email delivery, payments, or webhooks are disabled.
Cadence and checkpoints
A deployment workflow is most useful when it is checked before changes become urgent. Use the following cadence as a baseline and adjust it to your release frequency.
For every deployment
- Confirm the commit, branch, build command, runtime, and dependency lockfile.
- Compare required variables with the environment inventory.
- Verify that no secret is being sent to client-side code or printed in logs.
- Confirm the database target and migration status.
- Run automated tests, a health check, and a small set of critical user journeys.
- Record the release identifier, migration identifier, and rollback target.
Monthly or quarterly
- Remove unused variables, preview environments, deploy keys, and service accounts.
- Review production access and reduce permissions that are no longer necessary.
- Test a restore process for backups in a non-production environment.
- Check secret age and confirm that rotation procedures are documented.
- Compare staging configuration with production and explain every intentional difference.
- Review build duration, failed deployments, and recurring rollback causes.
Before a major release or infrastructure change
- Create a release branch or clearly identified deployment candidate.
- Run migrations against a disposable copy or staging database.
- Test background jobs, webhooks, authentication, file uploads, and scheduled tasks.
- Confirm domain, DNS, TLS, and callback settings for the target environment. Use the custom domain and DNS troubleshooting reference when routing changes are involved.
- Assign a person to monitor the release and another person to approve rollback if needed.
Keep the handoff concise. It should include the release commit, expected user-visible changes, variables added or removed, migrations to run, validation steps, owner, monitoring window, and rollback decision-maker.
How to interpret changes
Not every configuration difference is a defect. The useful question is whether the difference is intentional, documented, and safe for that environment. A production log level may be quieter than a development log level; a preview deployment may disable email; and staging may use a separate payment test account. These are acceptable when they are recorded and tested.
Treat unexplained differences as deployment risks. A missing variable usually appears as a build failure, startup error, failed request, or incorrect fallback. A wrong value can be more difficult to detect: an app may send test notifications from production, write to the wrong database, or accept callbacks from an unexpected domain. Validate both presence and meaning, not just whether a variable exists.
When a release fails, classify the issue before changing settings:
- Build failure: Check runtime, dependency, command, and build-time variables.
- Startup failure: Check required runtime variables, permissions, ports, and service connectivity.
- Data failure: Check migration order, schema compatibility, and database target.
- Integration failure: Check endpoint, credential, callback URL, rate limits, and environment mode.
- Performance or capacity issue: Check resource limits, query behavior, queues, and newly introduced work.
Use observability to confirm the diagnosis rather than relying on a single browser error. Logs, metrics, traces, and alerts should identify the affected release and environment without exposing secrets. The cloud app observability checklist can help organize that review.
Rollback template
Keep a rollback record with these fields:
- Current release: version or commit identifier.
- Previous known-good release: version or commit identifier.
- Trigger: the observed error, threshold, or failed validation.
- Application action: redeploy the previous release or disable the affected feature.
- Database action: state whether the migration is backward-compatible, paused, or requires a tested restore.
- Configuration action: restore only documented values; do not paste secrets into the record.
- Verification: health check, authentication, critical transaction, background jobs, and error monitoring.
- Owner and time: person responsible and timestamps for decision, rollback, and verification.
A rollback is not complete when the old code is running. It is complete when the service is behaving acceptably, data integrity is understood, and the team has recorded what must be fixed before another promotion.
When to revisit
Review this deployment workflow monthly or quarterly, and immediately after a framework upgrade, hosting migration, database change, authentication change, new third-party integration, or incident. Provider terminology and secret-management controls can change, so verify the current names and behavior of build settings, runtime variables, preview deployments, logs, backups, and access controls before editing your runbook.
At each review, compare the environment inventory with the actual deployment configuration. Delete stale entries, mark new values as public or sensitive, test a preview deployment, and confirm that the rollback target is still available. Re-run the migration procedure against a safe database and update the handoff checklist if the release sequence has changed.
For your next release, make a copy of the following action list:
- Freeze the release commit and record the rollback target.
- Review variables, secrets, database target, and runtime requirements.
- Deploy a preview and test the highest-risk paths.
- Promote to staging, run migrations safely, and complete acceptance checks.
- Deploy to production during an agreed monitoring window.
- Verify health, authentication, data writes, integrations, jobs, and alerts.
- Record the result and schedule the next monthly or quarterly review.
This recurring discipline makes environment variables, secrets, preview environments, and database changes visible before they become production surprises. It also gives developers and administrators a shared process for building, deploying, and maintaining a full-stack app across its complete lifecycle.