New:New releases:CLIcreate-clubedge-app v0.49.1·Clubedge Starter v0.32.0

Clubedge Starter Docs

Preview deployments

Deploy the current Git branch next to production on Vercel or Railway, with its own branch of the Neon database.

pnpm clubedge deploy --preview deploys the current Git branch next to production, to try a change before it ships. It works on Vercel and Railway, after a first pnpm clubedge deploy, and needs CLI 0.30.0 or newer (0.30.1 on Railway). It deploys a web app: on a frontend and its API, or a project without a website, it refuses, and prints how to copy production's Railway environment instead.

git switch -c new-checkout
pnpm clubedge deploy --preview

Production is not changed.

A database branch per preview

With NEON_API_KEY and NEON_PROJECT_ID, in the shell or in .env.production, the preview gets its own Neon branch: a copy of the production database made in seconds, which shares its storage until it changes. Migrations that add, change, or drop tables run against that copy, never against production.

.env.production
NEON_API_KEY=napi_...                 # Neon console: Account settings, API keys
NEON_PROJECT_ID=late-dream-12345678   # the project's Settings, General

deploy --preview:

  1. creates the branch preview/<git branch>, or reuses it on later runs so the preview keeps its data;
  2. applies this branch's migrations to it, from your machine;
  3. points the preview's DATABASE_URL (pooled) and DATABASE_URL_DIRECT at the branch.

The role and database come from production's Neon URL, or Neon's defaults (neondb_owner, neondb). A free database the CLI created must be claimed first, since only a Neon account has an API key.

Per platform

The preview is a Vercel preview deployment, with the project's Preview variables. The branch's URLs are set as Preview variables of your Git branch, through Vercel's API, so they stay off the command line and a redeploy from the dashboard keeps them. That needs the Vercel project connected to its Git repository: in Vercel, open the project's Settings, then Git. Without it, deploy --preview stops before deploying and says so.

Without the Neon settings, the preview uses the Preview DATABASE_URL. The deployment gets CLIENT_IP_HEADER=x-real-ip, as production does (CLI 0.42.0 or newer), since previews don't get production's variables.

Clean up

Previews stay until you remove them. Delete the branch preview/<git branch> in the Neon console and, on Railway, the environment:

railway environment delete preview-<git branch> --yes

For a preview of every pull request, made and removed by GitHub Actions, see Preview environments.

How is this guide?