Understanding the Basics
What is Preview vs Deployment?
Machine Types in Preview (add more context - what and why does the user need to know)
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.The Big Problem: Heavy Libraries
The Solution: Use APIs Instead
Some Examples of External Services You Can Integrate With
Some Common Build Errors
How to Fix Build Problems (with the agent)
Share logs with agent
Ask agent to optimize
Agent identifies the relevant action
Test again
Perform a one click Health Check
Deploy Your App
Phase 2: Database Migration
What Happens Here?
Your data moves from preview to production. Like moving your furniture to a new house.What is a Database?
How Our Databases Work
When Databases Get Too Heavy
Making Queries Optimized
Common Database Errors (shows up in logs, share with agent to fix)
Connecting Your Own Database
Get credentials
Share with agent
Agent configures
Test connection
Deploy
Phase 3: Exporting Secrets
What Are Secrets?
Secrets are passwords, API keys, and settings your app needs. They go in the .env file.Two Types of Secrets
The Golden Rules
Never put secrets in code
Always use .env files
Be very careful editing
Must redeploy after changing
What Breaks Your App
Common Secret Errors
Best Practices
Test API keys before deploying
Test API keys before deploying
Keep a backup of .env file
Keep a backup of .env file
Name variables clearly
Name variables clearly
Update URLs after changing domains
Update URLs after changing domains
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
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
If Health Check Fails
Total Deployment Time
Understanding Deployment Costs
How Much Does It Cost?
What Do You Get for 50 Credits?
24/7 Uptime
Database Hosting
Build Pipeline
Custom Domains
What Happens When You Redeploy?
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)
Replace deployment
Choose fresh database
Deploy
Option 2: Merge Old and New Data
Request export
Download data
Share with agent
Check for conflicts
Deploy merged data
Option 3: Zero Risk Method (High Traffic Apps)
Export old data
Deploy new app separately
Add old data
Verify everything
Turn off old app
Working with URLs and Domains
The Three Types of URLs
Adding Your Own Domain
Buy a domain
Change DNS settings
Auto-link in Emergent
Wait for propagation
Troubleshooting Guide
Quick Problem Solver
When to Share Logs
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)