Vercel
Deploy oversight to Vercel using the included serverless adapter. Vercel serves the web frontend as static assets and routes API requests through a catch-all serverless function.
Serverless Adapter
The api/[...path].ts file acts as a Vercel serverless function
that forwards all incoming requests to the Fastify server:
import type { IncomingMessage, ServerResponse } from "node:http";
let handler: ((req: IncomingMessage, res: ServerResponse) => void) | null = null;
async function getHandler() {
if (!handler) {
const { buildApp } = await import("../packages/server/dist/index.js");
const app = await buildApp();
await app.ready();
handler = (req, res) => {
app.server.emit("request", req, res);
};
}
return handler;
}
export default async function(req, res) {
const h = await getHandler();
h(req, res);
}
The adapter lazily initializes the Fastify app on the first request and reuses it across subsequent invocations within the same serverless container.
Deploying
# Install the Vercel CLI
npm install -g vercel
# Deploy from the repo root
vercel
Alternatively, connect the GitHub repository in the Vercel dashboard for automatic deployments on push.
Environment Variables
Set these in the Vercel dashboard under your project's Settings > Environment Variables. Mark variables as available for both Production and Preview environments as needed.
| Variable | Required | Description |
|---|---|---|
SUPABASE_URL |
Yes | Supabase project URL |
SUPABASE_SERVICE_ROLE_KEY |
Yes | Supabase service role JWT |
SUPABASE_ANON_KEY |
Yes | Supabase anon/public JWT |
VITE_SUPABASE_URL |
Yes | Same as SUPABASE_URL (Vite build-time) |
VITE_SUPABASE_ANON_KEY |
Yes | Same as SUPABASE_ANON_KEY (Vite build-time) |
Build Configuration
In the Vercel dashboard, configure the following build settings:
| Setting | Value |
|---|---|
| Framework Preset | Other |
| Build Command | pnpm run build |
| Output Directory | packages/web/dist |
| Install Command | pnpm install |
| Node.js Version | 20.x |
Limitations
Runner
The oversight runner is a long-lived daemon that cannot run on Vercel. You must host the runner separately — either on your local machine or a persistent server:
# From the repo root (with .env configured)
pnpm runner
WebSockets
Vercel serverless functions do not support WebSocket connections. If your oversight setup relies on real-time subscriptions beyond what Supabase Realtime provides client-side, you will need a persistent server deployment.