Deploying to Vercel
Step-by-step guide to deploying Cartwright on Vercel.
Cartwright forks usually deploy to Vercel with Turso for production storage.
New here? Start one step earlier
This page assumes your code is already on GitHub. If you haven't done that yet, the From code to live guide walks you (no terminal required) through GitHub → Vercel → live, and then sends you back here for the details.
- Link the project.
vercel link
vercel env pull .env.localFor a fresh single-package fork, leave the Vercel root directory at the repository root. In a monorepo deployment, set Root Directory to the app package that contains the Cartwright Next.js app. Vercel should auto-detect Next.js.
- Create Turso credentials.
turso db create my-shop-db
turso db tokens create my-shop-dbSet these in Vercel Production:
TURSO_DATABASE_URL="libsql://my-shop-db.turso.io"
TURSO_AUTH_TOKEN="..."
DATABASE_URL="file:./dev.db"
AUTH_SECRET="..."
NEXT_PUBLIC_APP_URL="https://my-shop.vercel.app"Some Turso setups provide an HTTPS URL with the auth token appended. If your deploy uses DATABASE_URL directly for Turso tooling, it must be the HTTPS URL with the auth token included. Runtime Cartwright code prefers TURSO_DATABASE_URL plus TURSO_AUTH_TOKEN.
- Add optional production integrations.
Use Vercel env vars or /admin/integrations for Stripe, Resend, Anthropic, Gemini, Sentry, and Vercel Blob. Required baseline env vars are database credentials, AUTH_SECRET, and NEXT_PUBLIC_APP_URL. For EU shops, prefer the Vercel region closest to users and database; fra1 is the practical default for EU deployments.
- Run migrations against the production database.
npx prisma migrate deployTURSO_DATABASE_URL="libsql://my-shop-db.turso.io" \
TURSO_AUTH_TOKEN="..." \
npx prisma migrate deploy- Deploy.
vercel --prodIf your first production deploy fails with a libSQL handshake error, the most common cause is invisible whitespace in TURSO_AUTH_TOKEN. Vercel's UI has historically accepted zero-width characters via clipboard paste. lib/db.ts strips non-printable ASCII defensively, but it is faster to paste the token through a plain-text editor before adding it to Vercel.
- Verify the deploy.
After Vercel reports success, hit https://my-shop.vercel.app/api/mcp with no Authorization header. You should get a JSON intro listing the shop's tool surface. If you get a 500, check the deploy logs for cleanEnv warnings (token whitespace) or Adapter errors (Prisma libSQL client misconfiguration).