Skip to content

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 login

A browser tab opens; sign in with your Encore account. The CLI now has a token for your user.

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.app

The 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 WebURL

You 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 main

The first push triggers:

  1. Encore's CI builds every service.
  2. Postgres databases are provisioned per service.
  3. Migrations are applied automatically.
  4. 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=production

You will see something like:

production environment
  Gateway: https://staging-n2e-aq92.encr.app

This URL is what the frontend will target via NEXT_PUBLIC_ENVIRONMENT=production.

6. Custom domain (optional)

From the Encore dashboard:

  1. Open Environments → production → Settings.
  2. Click Add custom domain and enter your hostname.
  3. Update DNS to point at the CNAME shown.
  4. 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:

  1. From the dashboard, open Environments → Create environment.
  2. Choose AWS or GCP and follow the wizard — Encore creates a short-lived role in your cloud and provisions VPC, RDS and the runtime.
  3. 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 --raw

Do not run seedFleetSouthKorea against production — it inserts demo data.

9. Rollback

Every deploy is immutable. To roll back:

  1. Find the previous successful build in https://app.encore.dev.
  2. Click Promote on that build.
  3. Encore swaps traffic atomically.

Troubleshooting

SymptomFix
permission denied (publickey) on git push encoreRun encore auth login again, then encore auth signup-ssh to add your key.
Build fails with missing secret XSet the secret via encore secret set for that environment.
Migrations failInspect the build logs — usually a column rename that needs a manual migration.
Frontend cannot reach the new URLCheck CORS in encore.app. The repo already allows any origin; tighten in production if needed.

Continue to Vercel (frontend).

N2E Fleet Management User Guide.