Deploy to Vercel
Production deployment on Vercel.
Overview
Vercel is the recommended production host for this Next.js app. It supports preview deployments, automatic builds, and environment management.
Deploy steps (Git-based)
- Create a new project in Vercel and import your repository.
- Configure build settings:
- Framework preset: Next.js
- Install command:
pnpm install - Build command:
pnpm build - Output directory:
.next
- Add environment variables in the Vercel dashboard:
DATABASE_URL=...
DB_PROVIDER=neon
DB_POOL_SIZE=1
BETTER_AUTH_SECRET=...
BETTER_AUTH_URL=https://your-domain.com
NEXT_PUBLIC_APP_URL=https://your-domain.com
NEXT_PUBLIC_APP_NAME=your_app_name
NEXT_PUBLIC_APP_DESCRIPTION=your_app_description
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...
ADMIN_EMAILS=admin@example.com,founder@example.com
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
PAYPAL_WEBHOOK_ID=...
PAYPAL_MODE=live
STRIPE_SECRET_KEY=...
STRIPE_WEBHOOK_SECRET=...
CREEM_API_KEY=...
CREEM_WEBHOOK_SECRET=...
CREEM_MODE=live
CREEM_PRODUCT_LIFETIME_ID=...
RESEND_API_KEY=...
EMAIL_FROM=noreply@yourdomain.com
RESEND_WEBHOOK_SECRET=...
R2_ACCOUNT_ID=...
R2_ACCESS_KEY_ID=...
R2_SECRET_ACCESS_KEY=...
R2_BUCKET=...
R2_PUBLIC_URL=...
NEXT_PUBLIC_GA_MEASUREMENT_ID=...- Deploy. Vercel runs
pnpm buildand serves withnext start.
GitHub auto-deploy
- Push the repository to GitHub.
- Connect the repo in Vercel and select the production branch (usually
main). - Every push to
maintriggers a production deploy. Pull requests generate preview deployments.
Deploy steps (CLI)
- Install the Vercel CLI:
pnpm add -g vercel- Log in and link the project:
vercel login
vercel link- Add environment variables (once per project):
vercel env add DATABASE_URL
vercel env add DB_PROVIDER
vercel env add BETTER_AUTH_SECRET
vercel env add NEXT_PUBLIC_APP_URL- Deploy to production:
vercel --prodVercel will run pnpm build and serve with next start.
Webhooks
Update webhook endpoints after deployment:
- PayPal:
https://your-domain.com/api/webhooks/paypal - Stripe:
https://your-domain.com/api/webhooks/stripe - Creem:
https://your-domain.com/api/webhooks/creem - Resend:
https://your-domain.com/api/webhooks/resend