Skip to main content

Overview

Emergent has three types of deployments, each handling your code and data differently. Understanding these is crucial to avoid data loss.

First Deploy

Brand new appFresh database

Redeploy

Update existing appData preserved

Replace Deployment

Swap appsOptional data transfer

1. First Deploy (New App)

When It Happens

You click “Deploy” for the very first time on a project that has never been deployed.

What Gets Created

1

New App Identity

A unique app record is created
2

Empty Database

A brand new, empty MongoDB database is provisioned
3

Production Secrets

Values from your development .env file are saved as production secrets
4

Live URL

A unique URL is generated (like https://your-app.emergentworks.app)
5

Container Image

Your code is built and stored in Google Container Registry

Data State

Everything is NEW:
  • Fresh database (empty apart from preview data)
  • New secrets from .env
  • New URL
Perfect for: Launching a brand new app for the first time.

2. Redeploy (Update Existing)

When It Happens

You click “Deploy” on an app that’s already live.

What Gets Updated

Code Changes:
  • Latest code from development pod -not data (images, files, data do not show up)
  • Updated application
What Stays the SAME:
  • Database (with ALL data preserved!)
  • Existing secrets (not overwritten!)
  • Same URL
  • Same app identity

How Data is Handled

MongoDB Data

100% PRESERVED
  • Same database connection
  • All existing data intact
  • No data loss
  • Users unchanged
  • Records preserved

Secrets

PRESERVED + MERGED
  • Existing secrets preserved
  • Not overwritten
  • Only new keys added
  • Old values kept

Important Secret Behavior

Existing secrets are NEVER overwritten! Example: [to be revisited]
To update existing secrets: You must change them in the platform’s secret management, NOT just in .env
Important: Changing .env values won’t update existing production secrets. Only new keys are added.

3. Replace Existing Deployment

When It Happens

You fork a project and choose to replace an existing deployed app when deploying the fork. **Use Cases: **Replacing app 1 with app 2 or app 1 with app 1.2 _Why does a user need to replace deployment? _
- auto forking
- manual forked therefore new job ID and separate application on backend.
- or a completely new app that you want deployed instead of a discarded app.

What It Does

This deploys a completely NEW app and removes the previously deployed app. Flow:
  1. Build new app from forked code or a completely new app
  2. (Optional) Transfer data from old app (Refer to the two options for data handling)
  3. Switch traffic to new app and the old app is deleted.
  4. New app is live for users.
  5. The new app uses the deployment fees from the next cycle onwards.

Two Options for Data Handling

Without Data Persistence

Fresh Start
  • New empty database
  • Old data NOT transferred
  • Preview data from the new app is copied to the new deployment
  • New app’s secret values are added to the existing app’s .env file - old keys are not auto-updated.
Use when: Starting completely fresh

With Data Persistence

Keep Your Data
  • Database connection copied
  • All data preserved
  • Same database used
  • New app’s secret values are added to the existing app’s .env file - old keys are not auto-updated.
Use when: Keeping existing data

What Gets Created (New App)

Always NEW:
  • New app identity
  • New deployment
Depends on Choice:
  • Database: New (no persist) or Same (with persist)
  • Secrets: Copied from old app + appended with new .env
What Gets DELETED (Old App):
  • Old app identity
  • Old deployment
  • Old service and resources
  • Old app record

When to Replace

Replace deployment when:
  • Forked to fix issues, want to swap
  • Want to upgrade with major changes
Don’t replace if:
  • Just updating code in the same job→ Use Redeploy instead!
  • Want to keep both versions → Deploy as separate app
Be careful - If you replace without keeping old database, your old database becomes orphaned and you lose access to that data!

Data Survival Guide

Here’s what survives in each scenario:

Preview vs Production

Development Pod (Preview)

What it is:
  • Your testing environment
  • Where you build and preview
  • Temporary workspace
Database:
  • Separate test database
  • NOT connected to production
  • Data here is NOT production data
  • Can be deleted anytime
Purpose:
  • Writing code
  • Testing features
  • Seeing changes
Access:
  • Only you (developer)

Production Deployment (Live)

What it is:
  • Your live, public app
  • What customers use
  • Real production environment
Database:
  • Production MongoDB - Managed via Cloud
  • Real user data
  • Persistent across redeploys
  • Connected to always live URL
Purpose:
  • Serving real users
  • Storing real data
  • Running your business
Access:
  • Your customers
Key Point: Preview and Production use completely different databases. They never share data!

How Secrets Work

First Deploy

Redeploy

Replace Deployment

To Update Existing Secret:

Common Scenarios

Scenario 1: Fixing a Bug

Scenario 2: Adding Major Features after Forking

Scenario 3: Starting Completely Fresh

Warning: Without keeping old database, old data is NOT deleted but becomes orphaned (can’t access it from new app).

Scenario 4: First Time Going Live

Decision Tree

Should I Deploy, Redeploy, or Replace?

Best Practices

Do This

For Regular Updates:
For Major Changes:
For Secrets:

Avoid This

Don’t:
  • Forget to check “preserve data” if you need it
  • Expect .env changes to update existing secrets
  • Delete production app without backing up data

Data Safety Checklist

Before deploying:
  • Know which deployment method you’re using
  • Understand if data will be preserved
  • If replacing, decided on whether to keep data or not
  • Backed up important data (if starting fresh)
  • Tested thoroughly in preview
  • Checked secrets are correct
  • Ready for production traffic

Common Questions

No! Redeploy NEVER deletes your data.Your database and all data are 100% preserved on redeploy.Only code changes are deployed.
You can’t update existing secrets via .env on redeploy.To update an existing secret:
  1. Access deployment settings
  2. Find secret management section
  3. Update the secret value directly
Or contact support for help.
Depends on your choice:With “Preserve data” checked:
  • Data is transferred to new app
  • All data accessible
Without “Preserve data” checked:
  • Old database becomes orphaned
  • New app gets empty database
  • Old data still exists but inaccessible
Yes! Just deploy without choosing “Replace existing.”This creates a completely separate app with:
  • New URL
  • New database
  • Independent from original
No! They use completely different databases.Preview: Test database (local to development pod) Production: Real database (MongoDB Atlas)Changes in preview don’t affect production data.
Currently, backups are handled by the platform’s MongoDB hosting.For manual backup:
  • Export data via your app’s admin interface
  • Use database export tools
  • Contact support for database snapshot

Quick Reference

First Deploy

  • When: First time deploying
  • Creates: Everything new
  • Data: Empty database
  • Use for: Initial launch

Redeploy

  • When: Updating live app
  • Updates: Code only
  • Data: ✅ Preserved
  • Use for: Regular updates

Replace (with persist)

  • When: Swapping apps, keep data
  • Creates: New app
  • Data: ✅ Transferred
  • Use for: Major refactor with data

Replace (without persist)

  • When: Fresh start
  • Creates: New app
  • Data: ❌ Not transferred
  • Use for: Complete reset

Remember

Redeploy is safe - Data always preserved Preview ≠ Production - Different databases Secrets persist - Existing ones not overwritten Choose carefully - Replacement with/without data Test in preview first - Before production deploy Can’t update secrets via .env - Use platform settings
Most important: Redeploy for updates (data safe), Replace only when necessary (check data option!).

Need Help?

Unsure Which to Use?

Lost Data After Deployment?

Secret Not Updating?

Best practice: For 99% of updates, just use Redeploy. It’s safe, preserves all data, and updates your code. Only use Replace when you have a specific reason!