Run Pages CMS on your own infrastructure.

Step 1: Create a PostgreSQL database

You will need a DATABASE_URL.

Using Supabase?

If you run migrations during deployment, prefer the Supabase Session Pooler for DATABASE_URL. Direct connections can cause connectivity issues on some hosting providers.

Step 2: Create .env

Add at least:

DATABASE_URL=postgresql://...
BETTER_AUTH_SECRET=your-random-secret
CRYPTO_KEY=your-random-secret
BASE_URL=https://cms.example.com

You can generate secrets with:

openssl rand -base64 32

Step 3: Create the GitHub App

Use the helper:

npm run setup:github-app -- --base-url https://cms.example.com --env .env

This writes the GitHub App environment variables into .env.production.

If you need other helper options, see GitHub App helper.

Step 4: Install dependencies

npm install

Step 5: Run migrations

npm run db:migrate

Step 6: Build and run

npm run build
npm run start

Step 7: Put HTTPS in front of the app

Use a stable public HTTPS URL in front of the app.

Typical setup:

  • Nginx or Caddy as reverse proxy
  • TLS at the proxy or platform edge
  • the app behind it on an internal port