Skip to main content

Understanding the Basics

What is Preview vs Deployment?

Simple Rule: Preview and deployment are completely separate. When you make changes in preview, you must redeploy to see them live.

Machine Types in Preview (add more context - what and why does the user need to know)

On paid tiers, the switch between machine types happens automatically. On basic tiers, the agent will stop and user must wake up the agent with a larger machine (simple button press)

Before You Deploy

  • Agent is awake (deployment won’t work if agent is asleep)
  • App works in preview (fix all errors before deploying)
  • Not using too much compute (app will shut down if it uses too much) - have to explain what is compute
  • Optimize your queries - instruct the agent to write optimized code
  • Plan ahead if your database will be large - reach out in advance to ensure your app is deployed smoothly.

Phase 1: Build Phase

What Happens Here?

Your code gets compiled and prepared for production. Think of it like packing your app into a box ready to ship.
Time: ~5 minutes

The Big Problem: Heavy Libraries

Why This Happens: Deployment has less CPU and RAM than preview. What works in testing might not work when live.
[**Emergent allows users more freedom to create an app and then scale as you grow] **

The Solution: Use APIs Instead

Simple Rule: If a library is large, use an API service instead of installing it - say why.

Some Examples of External Services You Can Integrate With

What is the difference between a db and a storage service - why the investment is worth it to build serious apps.

Some Common Build Errors

How to Fix Build Problems (with the agent)

1

Share logs with agent

Use the one-click log sharing button _[add GIF] _or copy logs and share in chat
2

Ask agent to optimize

Tell the agent to optimize your code
3

Agent identifies the relevant action

The agent will perform the fix and solve the error
4

Test again

Verify everything works in preview
5

Perform a one click Health Check

It is strongly recommended to ask the agent to perform a health check before attempting to deploy again. This ensures the app has a much better chance of a clean deployment.
6

Deploy Your App

Once solved, attempt to deploy your app again.

Phase 2: Database Migration

What Happens Here?

Your data moves from preview to production. Like moving your furniture to a new house.
Time: 1-2 minutes

What is a Database?

Emergent uses MongoDB by default, which is flexible and easy to work with.

How Our Databases Work

Important: The agent cannot see your deployed database unless you share logs. Preview and deployment are separate environments.

When Databases Get Too Heavy

Making Queries Optimized

How to Optimize: Tell the agent “optimize my database queries” and it will rewrite them better.

Common Database Errors (shows up in logs, share with agent to fix)

Connecting Your Own Database

1

Get credentials

Get URL and password from your database provider
2

Share with agent

Provide credentials to the Emergent agent
3

Agent configures

Agent sets up the connection
4

Test connection

Verify it works in preview
5

Deploy

Deploy with your custom database

Phase 3: Exporting Secrets

What Are Secrets?

Secrets are passwords, API keys, and settings your app needs. They go in the .env file.
Time: 1-2 minutes

Two Types of Secrets

The Golden Rules

Never put secrets in code

Anyone can see them (security risk)

Always use .env files

Easy to change, stays private

Be very careful editing

One wrong character breaks everything

Must redeploy after changing

Changes only work after you redeploy

What Breaks Your App

Be careful! Double-check everything before deploying.

Common Secret Errors

Best Practices

Make sure they work by testing them in preview first
Save a copy in case you need to restore settings
Use descriptive names so you know what each does
External services need to know your new domain

Phase 4: Deploy and Health Check

Deploy: Setting Up Infrastructure

Your app is launched on servers and made available to the world. What Happens:
  • Servers are set up (Kubernetes)
  • Your app is installed on servers
  • Network connections are configured
  • Resources (CPU/RAM) are assigned
Time: 3-5 minutes

Common Deploy Errors

Health Check: Is Everything Working?

After deployment, the system checks if your app is actually working. What Gets Checked:
  • App responds to requests
  • APIs are working
  • Frontend loads correctly
  • Database is connected
  • All services are running
Time: 1-2 minutes

If Health Check Fails

Important: If health check fails, your app won’t go live. This protects you from publishing a broken app.

Total Deployment Time

Understanding Deployment Costs

How Much Does It Cost?

What Do You Get for 50 Credits?

24/7 Uptime

Your app runs always online

Database Hosting

Managed MongoDB included

Build Pipeline

All deployment steps included

Custom Domains

Auto-linking for your domains
Good News: After paying once, you can update your app unlimited times for free.

What Happens When You Redeploy?

Important: Redeploying updates your code but NOT your database.If you changed data in preview after your first deployment, that data won’t appear in production. You need to manually move it.

Replacing Existing Deployments

Why Replace Instead of Deploy New?

Scenario: You forked your app, made it better, and want the new version to replace the old one WITHOUT paying another 50 credits.

Your Options

Option 1: Fresh Start (Copies Preview Data)

1

Replace deployment

Click “Replace Existing Deployment”
2

Choose fresh database

Select “Fresh Database” option
3

Deploy

New app replaces old one
Result: Old app gone, new app live, no extra charge.

Option 2: Merge Old and New Data

1

Request export

Email support@emergent.sh to export data (up to 24 hours)
2

Download data

Get your data when ready (few minutes)
3

Share with agent

Give data to agent, ask to merge
4

Check for conflicts

Tell agent to verify no data conflicts
5

Deploy merged data

Deploy with combined database
Result: All data preserved, no extra charge.

Option 3: Zero Risk Method (High Traffic Apps)

1

Export old data

Request from support (time only)
2

Deploy new app separately

Deploy as standalone (50 credits)
3

Add old data

Load exported data to new app
4

Verify everything

Check all data and features work
5

Turn off old app

Shut down old app (free)
Result: Zero downtime, zero data loss, but costs 50 credits.

Working with URLs and Domains

The Three Types of URLs

Adding Your Own Domain

1

Buy a domain

Purchase from GoDaddy, Namecheap, etc (right away)
2

Change DNS settings

Update at your domain provider (right away)
3

Auto-link in Emergent

Use Emergent dashboard (5-10 minutes)
4

Wait for propagation

DNS spreads worldwide automatically (10 min to 2 hours)
After You Link Domain: Update all external services (APIs, payment processors, OAuth) to use your new domain instead of the old emergent.host URL.

Troubleshooting Guide

Quick Problem Solver

When to Share Logs

How: Click the one-click log share button, send to agent, agent tells you how to fix.

When to Email Support

Email support@emergent.sh when:

Pre-Deployment Checklist

  • Works perfectly in preview (catch problems early)
  • Database queries are fast (prevent timeouts)
  • Using APIs instead of heavy libraries (avoid crashes)
  • All packages listed in config files (prevent build errors)
  • API keys work (make sure integrations function)
  • Secrets in .env file, not code (security)
  • Agent is awake (can’t deploy if agent is asleep)

Quick Reference

Key Terms Simple Guide