EthioDeploy
DocsPricingDomainsBlogToolsChangelog
Deploy guides/Payload CMS

Deploy a Payload app

Payload 3 runs inside Next.js, so it deploys as a Next.js app. Remove the template's Dockerfile, set PAYLOAD_SECRET, add a Postgres addon (the template already reads DATABASE_URL), and commit your migrations so production creates its tables.

Last updated November 24, 2026

What we run by default
Detected by
package.json (or the template's Dockerfile, see below)
Install
npm ci / pnpm / yarn (from your lockfile)
Build
npm run build (next build)
Start
next start

These run automatically, so leave the command fields blank. Only override them in Settings → Build if you need something different.

Fix this first: Commit migrations, or production has no tables

In development, Payload creates and changes Postgres tables for you. In production it doesn't, so the first deploy starts, the admin panel loads, and creating the first user fails with relation "users" does not exist. Generate a migration with npm run payload migrate:create, commit src/migrations, and pass it to the adapter as prodMigrations (below).

Prepare your app

  1. Delete the Dockerfile that create-payload-app adds, or set Builder to “Auto-detect stack (ignore Dockerfile)” in Settings → Build. With Builder on Auto we build a repo's Dockerfile, and this one copies .next/standalone, which only exists if you add output: 'standalone' to next.config.ts. Without the Dockerfile we build it as a Next.js app and run next start.
  2. Add a Postgres addon. It sets DATABASE_URL, which the template's payload.config.ts already passes to the Postgres adapter.
  3. Add PAYLOAD_SECRET in the project's settings, a long random string such as the output of openssl rand -hex 32. Your local .env is gitignored, so it doesn't reach the deploy. Without the secret, every page returns 500 with missing secret key, and the deploy fails its health check. Keep it once set: Payload signs login tokens with it, so a new value signs everyone out.
  4. Set up migrations, as in the next section.

Node version: Payload's package.json asks for Node ^22.23.5 || ^24.22.3 || >=26.13.1. Our build reads that, sees our Node 22.19 is too old, and builds on Node 24 instead, which is 24.10, also below that range. npm and pnpm only print a warning for this, and in our test the same app built and ran on Node 22.19.

Migrations with prodMigrations

Against your local database, generate a migration from your current collections:

npm run payload migrate:create initial

That writes src/migrations/ with an index.ts. Pass it to the adapter in payload.config.ts:

import { migrations } from './migrations'

// ...
db: postgresAdapter({
  pool: {
    connectionString: process.env.DATABASE_URL || '',
  },
  prodMigrations: migrations,
}),

In production, Payload now runs any migration that hasn't run yet before it finishes starting up. That happens on the first request, which is our health check, so the tables exist before the deploy goes live. Each time you change a collection, run migrate:create again and commit the new file.

Payload's docs also show running payload migrate before next build. That doesn't work here: the database is only reachable from the running app, not during the build. prodMigrations runs at startup instead.

Building without a database

The blank template builds with no database connection, because its pages render on request. If you prerender pages that query Payload (for example with generateStaticParams), next build tries to reach the database and fails. Payload's docs give a build mode for this. Set the Build command in Settings → Build to:

npx next build --experimental-build-mode compile

That compiles the app without generating static pages, so those pages render when they're requested.

Media uploads

By default the Media collection saves files to the container's disk. Each deploy starts a fresh container, so uploads disappear and the admin panel shows broken images. Store them in a bucket with Payload's S3 adapter:

npm install @payloadcms/storage-s3
import { s3Storage } from '@payloadcms/storage-s3'

// ...
plugins: [
  s3Storage({
    collections: { media: true },
    bucket: process.env.S3_BUCKET || '',
    config: {
      endpoint: process.env.S3_ENDPOINT,
      region: process.env.S3_REGION,
      credentials: {
        accessKeyId: process.env.S3_ACCESS_KEY_ID || '',
        secretAccessKey: process.env.S3_SECRET_ACCESS_KEY || '',
      },
    },
  }),
],

Those five S3_ variables are what our object storage addon sets on Pro and Business. With AWS S3 or another provider, set them yourself. The plugin adds a component to the admin panel, so run npm run generate:importmap (or start npm run dev once) and commit the updated importMap.js before you push.

Using MongoDB instead

We don't offer a MongoDB addon. If your project uses @payloadcms/db-mongodb, put a hosted MongoDB connection string (MongoDB Atlas, for example) in DATABASE_URL yourself; the template passes it to mongooseAdapter({ url }). Allow connections from your app in the provider's network settings.

Health check

The blank template's / returns 200, and the admin panel is at /admin, so the default health check works. The home page asks Payload who's logged in, so it returns 500 when the database is unreachable; a deploy with a wrong DATABASE_URL fails instead of going live. Open /admin right after the first deploy and create your user: until one exists, anyone who opens it can register as the first admin.

Can Payload run on the Free plan?

It starts, with little room left. In our test, Payload 3.94 with Postgres used about 150 MB of memory after logging in and opening the admin panel, with Node's heap capped the way the Free plan caps it. The Free container has 256 MB, and image uploads (resized with sharp) need more. It's fine for trying Payload out. For a CMS a site depends on, use Pro: 1 GB of memory, always on, a 5 GB database and object storage, for $10 or 1,399 ETB a month.

Free apps also sleep after 30 minutes without traffic, so the first admin visit after a quiet spell waits for the app to start.

Deploy

  1. Sign in with GitHub and install the EthioDeploy app on the repo.
  2. Click “New Project” and pick the repo.
  3. Watch the build in the dashboard. When the health check passes, your app is live at <project-slug>.ethiodeploy.app. Every push to the default branch redeploys, and the old version keeps serving until the new one is healthy.

Troubleshooting

relation "users" does not exist, or creating the first user fails+

Cause: Production doesn't create tables on its own, and no migrations were run.

Fix: Run npm run payload migrate:create, commit src/migrations and set prodMigrations: migrations in the adapter.

Error: missing secret key. A secret key is needed to secure Payload.+

Cause: PAYLOAD_SECRET is only in your local .env.

Fix: Add PAYLOAD_SECRET as an env var and redeploy.

The build fails copying /app/.next/standalone+

Cause: The template's Dockerfile was built, and next.config.ts has no output: 'standalone'.

Fix: Delete the Dockerfile (or set Builder to Auto-detect stack), or add output: 'standalone' to keep it.

next build fails trying to connect to the database+

Cause: A page prerenders data from Payload at build time, and the database isn't reachable during the build.

Fix: Set the Build command to npx next build --experimental-build-mode compile.

Uploaded images are broken after a deploy+

Cause: Uploads were saved to the old container's disk.

Fix: Use @payloadcms/storage-s3 with a bucket and upload them again.

The admin panel says a component is missing from the import map+

Cause: A plugin that adds admin components was installed, but importMap.js wasn't regenerated.

Fix: Run npm run generate:importmap and commit the result.

Still stuck? Check the deployment's build log in the dashboard, or see Troubleshooting.

Questions

You can try it on the Free plan, which includes a 512 MB Postgres database. Payload used about 150 MB of the Free container's 256 MB in our test, so for a CMS a site depends on, Pro ($10/month) gives 1 GB of memory and keeps it always on.

No. Payload 3 runs inside your Next.js app: the admin panel is at /admin and the API at /api in the same deployment.

Generate them locally with npm run payload migrate:create, commit src/migrations, and pass the exported migrations to the database adapter as prodMigrations. Payload runs any pending migration when it starts in production. Running payload migrate during the build doesn't work here, because the database isn't reachable from the build.

Yes, with a hosted MongoDB such as Atlas. Put its connection string in DATABASE_URL. We offer Postgres, MySQL and Redis addons, not MongoDB.

Ready to deploy?

Sign in with GitHub and pick your repo. No Dockerfile, no YAML.

More guides

LLovableBoltClaude Code & Cursor

All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.

On this page
Prepare your appMigrations with prodMigrationsBuilding without a databaseMedia uploadsUsing MongoDB insteadHealth checkCan Payload run on the Free plan?DeployTroubleshootingQuestions
Deploying with an agent?Point it at llms.txt. Every guide is in one file there.Open llms-full.txt →
EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiPayload CMSDjangoFastAPIFlaskStreamlitExpressNestJSLaravelRailsGoSpring BootASP.NET CoreTelegram botDiscord botWhatsApp botLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy