Theme
Deploy to Encore Cloud
Encore ships with a built-in deployment pipeline — git push encore is the entire deploy step. It builds your services, provisions Postgres, sets up the gateway and exposes a URL.
1. Authenticate
bash
encore auth loginA browser tab opens; sign in with your Encore account. The CLI now has a token for your user.
2. Link the app (first time only)
The backend repo already contains an encore.app file with an app id:
json
{
"id": "n2e-aq92",
"lang": "typescript",
...
}If this id is taken by someone else or you want your own app, replace the id:
bash
cd backend
encore app init # interactive — pick a name; writes a new encore.appThe CLI also adds an encore git remote that points at the Encore build cluster.
3. Set production secrets
Local secrets in .secrets.local.cue do not travel to production. Set each one explicitly:
bash
encore secret set --type prod ResendAPIKey
encore secret set --type prod AdminEmail
encore secret set --type prod AdminPassword
encore secret set --type prod WebURLYou will be prompted for each value. Repeat with --type dev for staging environments.
4. Deploy
bash
git add -A
git commit -m "Deploy to Encore Cloud"
git push encore mainThe first push triggers:
- Encore's CI builds every service.
- Postgres databases are provisioned per service.
- Migrations are applied automatically.
- The gateway and services are deployed behind an Encore URL.
Watch the build live at https://app.encore.dev — click the app, then the running build to follow logs.
5. Get the production URL
Once the deploy succeeds:
bash
encore api list --env=productionYou will see something like:
production environment
Gateway: https://staging-n2e-aq92.encr.appThis URL is what the frontend will target via NEXT_PUBLIC_ENVIRONMENT=production.
6. Custom domain (optional)
From the Encore dashboard:
- Open Environments → production → Settings.
- Click Add custom domain and enter your hostname.
- Update DNS to point at the CNAME shown.
- Encore provisions a TLS certificate within a few minutes.
7. Bring your own cloud (optional)
Free Encore Cloud is great for staging and demos. For production scale or compliance you usually want your own AWS / GCP account:
- From the dashboard, open Environments → Create environment.
- Choose AWS or GCP and follow the wizard — Encore creates a short-lived role in your cloud and provisions VPC, RDS and the runtime.
- Push to that environment with
git push encore main:<env-name>.
See https://encore.dev/docs/ts/deploy/own-cloud for the full procedure.
8. Apply post-deploy seeds (optional)
The seed endpoints are expose: false, so they cannot be called over HTTP. To seed an admin user on a fresh production environment:
bash
encore call --env=production seed.seedAdmin --rawDo not run seedFleetSouthKorea against production — it inserts demo data.
9. Rollback
Every deploy is immutable. To roll back:
- Find the previous successful build in https://app.encore.dev.
- Click Promote on that build.
- Encore swaps traffic atomically.
Troubleshooting
| Symptom | Fix |
|---|---|
permission denied (publickey) on git push encore | Run encore auth login again, then encore auth signup-ssh to add your key. |
Build fails with missing secret X | Set the secret via encore secret set for that environment. |
| Migrations fail | Inspect the build logs — usually a column rename that needs a manual migration. |
| Frontend cannot reach the new URL | Check CORS in encore.app. The repo already allows any origin; tighten in production if needed. |
Continue to Vercel (frontend).