Deploy on Vercel and Neon
The starter is a plain Next.js 15 app with a Postgres database, so it runs anywhere Next.js runs. This guide covers the zero-ops path: Vercel for the app and Neon for Postgres. Both have free tiers that are enough to launch.
1. Database — Neon
- Create a project at https://neon.tech (pick the region closest to your Vercel region).
- Copy the pooled connection string (ends with
-pooler.…neon.tech). The Drizzle client already setsprepare: false, which pooled connections require. - Run the migrations and seed the plans from your machine:
Re-runDATABASE_URL="postgres://…-pooler…/neondb?sslmode=require" npm run db:migrate DATABASE_URL="…" npm run db:seeddb:migratewhenever you add a migration (npm run db:generateafter a schema change).
2. App — Vercel
Push the repo to GitHub and import it at https://vercel.com/new. Framework preset: Next.js, no changes needed.
Add the environment variables (Settings → Environment Variables), for Production and Preview:
Variable Notes ANTHROPIC_API_KEYfrom https://platform.claude.com AGENT_MODELoptional, default claude-sonnet-5-5DATABASE_URLNeon pooled string AUTH_SECRETnpx auth secretAUTH_GITHUB_ID/AUTH_GITHUB_SECRETGitHub OAuth app; callback https://<domain>/api/auth/callback/githubAUTH_TRUST_HOSTtrue(Auth.js behind Vercel's proxy)AUTH_RESEND_KEY/AUTH_EMAIL_FROMoptional magic-link sign-in LEMONSQUEEZY_WEBHOOK_SECRETfrom the webhook you create in step 3 LEMONSQUEEZY_VARIANT_PROoptional, links the Pro plan to a variant LEMONSQUEEZY_VARIANT_TEAMoptional, links the Team plan to a variant NEXT_PUBLIC_LS_CHECKOUT_PRO/_TEAMhosted checkout URLs for /pricing MCP_SERVERSoptional, JSON (HTTP servers only on Vercel — see below) Deploy. Add your domain under Settings → Domains and update the GitHub OAuth callback URL.
Function duration
app/api/agent/route.ts sets maxDuration = 300. The Hobby plan allows up to 300s with
Fluid Compute enabled (default on new projects); on older projects lower it to 60 or enable Fluid Compute.
MCP on serverless
Stdio MCP servers spawn a child process, which does not work on Vercel functions. Use
HTTP ({"url": …}) servers in production, or run the app on a long-lived host
(Railway, Fly.io, a VPS with npm run build && npm start) if you need stdio servers.
3. Lemon Squeezy webhook
Settings → Webhooks → +:
- URL:
https://<domain>/api/webhooks/lemonsqueezy - Signing secret: paste the same value into
LEMONSQUEEZY_WEBHOOK_SECRET - Events:
order_created,order_refunded,subscription_*
Send a test event from the Lemon Squeezy dashboard; it appears in the webhook_events table.
4. Post-deploy checklist
- Sign in with GitHub on the production URL
- Send a message on
/chatand confirm a row appears inusage_events(and on/usage) - Buy the Pro plan in Lemon Squeezy test mode and confirm
users.planflips topro - Set a spend limit on your Anthropic console workspace
Other hosts
- Railway / Fly.io / Render:
npm run build, start withnpm start, same env vars. Stdio MCP servers work here. - Cloudflare Workers: needs
@opennextjs/cloudflare;postgresmust be replaced with the Neon serverless driver (drizzle-orm/neon-http). Not covered by this starter yet. - Docker: set
output: "standalone"innext.config.tsand copy.next/standaloneinto anode:22-alpineimage.