Deploy (Vercel)
Setup puts your app on Vercel with every environment variable set, runs it next to your database, registers the payment webhook and checks the site loads.
What you need
- A free Vercel account.
- Answer Yes to the first question, Deploy to Vercel at the end? If you already ran setup without deploying, run it again and answer Yes; finished steps are kept.
You don't need to install the Vercel CLI. Setup runs it through npx.
Steps
Log in
If you're not logged in, setup opens Vercel's login in your browser. Approve it there, then return to the terminal.
Name the project
Setup suggests your folder name (lowercase, with hyphens). The name becomes your free address: https://<name>.vercel.app. If the name is taken on Vercel, you get a different address, and setup uses the real one.
Custom domain (optional)
Custom domain already connected to this project (leave empty to use the vercel.app address)Leave it empty on your first deploy. Connect a domain later and run setup again; see Custom domain.
Only enter a domain here if it's already added to this Vercel project and its DNS is set up.
Environment variables
Setup copies these from .env.local to Vercel's Production environment:
DATABASE_URL, BETTER_AUTH_SECRET, DODO_PAYMENTS_API_KEY, DODO_PAYMENTS_ENVIRONMENT, each plan's DODO_PRODUCT_…, RESEND_API_KEY, EMAIL_FROM, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GITHUB_REPO, GITHUB_REPO_TOKEN.
NEXT_PUBLIC_APP_URL is set to your production address, not localhost. Empty values are skipped.
Function region
Server functions will run in sin1, next to your database (saved in vercel.json).Vercel runs server code in Washington, D.C. (iad1) by default. If your database is in Singapore, every query would cross the world and pages would be slow. Setup reads the region from DATABASE_URL and writes the nearest Vercel region to vercel.json. Commit vercel.json, so later deploys keep it.
| Neon region | Vercel region |
|---|---|
us-east-1 | iad1 |
us-east-2 | cle1 |
us-west-2 | pdx1 |
eu-central-1 | fra1 |
eu-west-2 | lhr1 |
ap-southeast-1 | sin1 |
ap-southeast-2 | syd1 |
Deploy, then register the webhook
Setup deploys (a couple of minutes), reads your production address, then registers https://<your-address>/api/webhooks/dodo as a webhook in Dodo and saves its signing secret to Vercel as DODO_PAYMENTS_WEBHOOK_SECRET.
It then redeploys so the app uses the final address and webhook secret.
Check the site
Setup opens your address for up to 30 seconds. When it responds, the final note says Live at https://….
After deploying
-
Add production URLs to Google and GitHub sign-in. Setup prints them at the end. See Google and GitHub sign-in.
-
Commit
vercel.json. -
Sign up on the live site, then make yourself an admin. Production uses the same database as local, so this works from your computer:
npm run make-admin -- you@example.com -
Test a purchase with a test card. After paying, the dashboard unlocks your plan within a few seconds.
How deploys work after this
Setup deploys straight from your computer (vercel deploy --prod). For automatic deploys on every push, connect your GitHub repository in the Vercel dashboard: Project → Settings → Git → Connect Git Repository. The environment variables setup created stay in place.
Changed an environment variable?
Vercel only reads environment variables when it builds. After changing one in the dashboard, redeploy: Deployments → ⋯ on the latest → Redeploy.
Problems
See Deploy errors.