Production - Vercel
Deploy OpenQuok's Application on Vercel — backend, web, and CLI auth server.
Connect your agent today
Draft from chat, review in your calendar, and publish only what you approve.
Deploy the backend (Express), web (SvelteKit), and optionally the CLI auth server (device flow for openquok auth:login) to Vercel.
Production checklist
For env vars, CORS, optional Redis, and how integration refresh flows run in-process, start at Production deployment.
Prerequisites
- Vercel account
- Vercel CLI (optional — `npx vercel` is enough)
Backend on Vercel
Create a new Vercel project
and connect this repository.
Set Root Directory to backend
Set environment variables
Set Environment Variables in the Vercel project to match production (same names as backend/.env.production.local): NODE_ENV, Supabase keys, REDIS_* (prefix), FRONTEND_DOMAIN_URL, BACKEND_DOMAIN_URL, Stripe, OAuth, Sentry, email, etc.
Sensitive environment
Tip
pnpm vercel:env:sync:backend:prod This reads backend/.env.production.local and upserts keys into the Vercel production environment.
Warning
- Set FRONTEND_DOMAIN_URL without a trailing slash (for example https://www.openquok.com, not https://www.openquok.com/).
- Set the web project's VITE_FRONTEND_DOMAIN_URL to the same canonical origin string as FRONTEND_DOMAIN_URL so Meta and other OAuth flows receive redirect URIs that match what you register in their dashboards (see Production deployment).
- Include both apex and
wwwin ALLOWED_FRONTEND_ORIGINS (example: https://openquok.com,https://www.openquok.com) when visitors may hit either hostname, even if OAuth uses only one canonical host. - Keep the web app's VITE_API_BASE_URL pointing to the same backend origin used by BACKEND_DOMAIN_URL.
If these do not match, browser preflight for auth endpoints (such as /api/v1/auth/refresh) can fail with a CORS error.
Deploy
Deploy from the dashboard (push to the production branch) or from the repository root:
Note
Link the backend once (creates backend/.vercel):
cd backend
npx vercel link backend/.vercel is usually gitignored; on a fresh clone, run vercel link again or set VERCEL_ORG_ID and VERCEL_PROJECT_ID before deploy (CI uses the env vars).
Deploy backend to Vercel (preview) — from the repo root; uploads the monorepo and installs workspace packages.
pnpm vercel:deploy:backend Deploy backend to Vercel (production) — same command shape, production target.
pnpm vercel:deploy:backend:prod After deploy, set BACKEND_DOMAIN_URL to your backend URL (for example https://your-api.vercel.app or a custom domain). Point Stripe webhooks and Google OAuth redirect URIs at that URL. Set the web app’s VITE_API_BASE_URL to the same backend base URL.
Example CLI prompts when running npx vercel link under backend/ (your paths and names may differ):
? Set up and deploy "~/Projects/.../openquok-monorepo/backend"? yes
? Which scope should contain your project? your-team
? Link to existing project? yes
? What's the name of your existing project? openquok-backendWeb on Vercel
Create a second Vercel project
and connect the same repository.
Set Root Directory to web
Set environment variables
Set Environment Variables to match production (same keys as web/.env.production.local): VITE_API_BASE_URL (your deployed backend), VITE_FRONTEND_DOMAIN_URL, VITE_PUBLIC_SUPABASE_* (prefix), Stripe and analytics keys as needed.
Deploy
Note
Link the web app once:
cd web
npx vercel link web/.vercel is usually gitignored; on a fresh clone, run vercel link again or set VERCEL_ORG_ID and VERCEL_PROJECT_ID before pnpm vercel:deploy:web (same pattern as CI).
Deploy web to Vercel (preview) — from the repo root; installs with pnpm at the monorepo root and builds the web workspace package.
pnpm vercel:deploy:web Deploy web to Vercel (production) — same command shape, production target.
pnpm vercel:deploy:web:prodCLI auth server on Vercel
The device-flow helper lives under agent/server. Create a third Vercel project with Root Directory set to agent/server.
Link the project once
cd agent/server
npx vercel link agent/server/.vercel is gitignored; use VERCEL_ORG_ID and VERCEL_PROJECT_ID in CI if needed.
Environment variables
Maintain production values in agent/server/.env.production.local (gitignored), matching agent/server/.env.production.example. Sync into Vercel from the repository root:
pnpm vercel:env:sync:agent-server:prod Required keys include DATABASE_URL, OPENQUOK_OAUTH_CLIENT_ID, OPENQUOK_OAUTH_CLIENT_SECRET, SERVER_URL (API origin, e.g. https://cli-auth.openquok.com, no trailing slash), and BROWSER_ORIGIN (web origin for browser steps, e.g. https://www.openquok.com).
Deploy web browser routes
The /cli/device/* pages live in the web project. Copy web/.env.production.example to web/.env.production.local, set CLI_AUTH_SERVER_URL to your auth server API origin, sync, and deploy:
pnpm vercel:env:sync:web:prod
pnpm vercel:deploy:web:prod Deploy auth server API
pnpm vercel:deploy:agent-server pnpm vercel:deploy:agent-server:prod Or both projects:
pnpm vercel:deploy:cli-device-flow:prod Register on your OpenQuok OAuth app (OpenQuok production reference):
https://www.openquok.com/cli/device/callbackSee Configuration - Agent → Scaling & Postgres for shared DATABASE_URL, SERVER_URL, and pooled connections on Vercel.
Custom domains (e.g. Route 53)
Add each domain in the Vercel project (Settings → Domains), create the DNS records Vercel shows (often CNAME to cname.vercel-dns.com or A records for apex), then set:
- Backend: BACKEND_DOMAIN_URL, FRONTEND_DOMAIN_URL (and ensure CORS allows the frontend origin).
- Web: VITE_API_BASE_URL, VITE_FRONTEND_DOMAIN_URL.
- CLI auth server (if deployed): SERVER_URL for the API host; BROWSER_ORIGIN for browser URLs. Update the OAuth app callback when the web hostname changes (OpenQuok production: https://www.openquok.com/cli/device/callback).