Deploy on Vercel
Deploy Pages CMS on Vercel with PostgreSQL and a GitHub App.
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: Choose your public URL
Use one of these:
- your custom domain, for example
https://cms.example.com - your Vercel production domain, for example
https://my-pages-cms.vercel.app
Use the same URL everywhere:
BASE_URL- GitHub App callback URL
- GitHub App webhook URL
- GitHub App setup URL
If you use the default Vercel domain, make sure it matches the project name you create in the next steps.
Step 3: Create the GitHub App
Use the helper:
npm run setup:github-app -- --base-url https://cms.example.com --env .env
If you need other helper options, see GitHub App helper.
This writes the GitHub App environment variables to .env.
Step 4: Create the Vercel project
Use the deploy button:
If you prefer, you can also create the project manually in Vercel.
Use the GitHub App environment variables from the previous step, plus:
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
For the full list, see Environment variables.
Step 5: Deploy your app
Deploy the app in Vercel.
If you change the production URL later, update BASE_URL and the GitHub App URLs to match it.
Step 6: Run migrations
Run the migration against your production database:
npm run db:migrate