VercelExperimental
Deploy to Vercel with one command; the database and other services come from your providers.
In a project with deploy vercel (CLI 0.28.0 or newer), pnpm clubedge deploy uses Vercel's CLI and your Vercel login:
pnpm clubedge add deploy vercel # if the project deploys elsewhere today
pnpm clubedge deployVercel only runs the app, so the database, Redis, storage, and email come from your providers. Put their production values in .env.production first: deploy stops without DATABASE_URL. Use your provider's pooled URL (Neon's pooled endpoint, Supabase's transaction pooler), since each serverless function opens its own connection.
What it does
- Signs in with
vercel loginwhenvercel whoamifinds no login, which opens the browser. Once you are signed in, later runs skip this. - Creates or reuses the project, named after the package, with
apps/webas its Root Directory: Vercel uploads the whole workspace and builds the app. On a project you created earlier, it sets the Root Directory when it differs, then links the folder (.vercel/project.json). - Writes
.vercelignorewhen the project has none, from what Git ignores, so.envfiles and build output never leave your machine. Commit it. - Sets the production variables in one request: the env file's values, the public URL as
APP_URLandNEXT_PUBLIC_APP_URL,CLIENT_IP_HEADER=x-real-ip, where the client's address is (CLI 0.42.0 or newer), and with Better Auth a generatedBETTER_AUTH_SECRETthat later runs keep. Secrets are stored encrypted;STORAGE_DIRECTORYis left out, since Vercel keeps no disk. - Runs
vercel deploy --prodand streams the build log. The build runscheck:env, then the migrations againstDATABASE_URL, then the app's build. - Fixes the public URL. When Vercel names the app something other than
https://<project>.vercel.app(the name was taken),deploysets that URL and deploys again, since Next.js compiles it into the build.
Vercel's CLI
deploy needs Vercel CLI 50.5.1 or newer, for vercel api. It uses an installed vercel when it is new enough, else the latest through npx. Installing it once makes deploy faster:
npm install -g vercelCosts
Vercel bills usage on your plan. Your database and other services bill on their own plans.
When a deploy fails
The build log above the error says why. Most often check:env names a missing variable: add it to .env.production and run deploy again, which reuses the project. vercel inspect --logs <url> shows a deployment's log again, and vercel logs <url> the running app's.
To set up Vercel without this command, see Vercel in the deploy guide.
How is this guide?