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:

api/[...path].ts ts
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

Deploy with Vercel CLI bash
# 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

Serverless constraints: Vercel serverless functions have a maximum execution duration (10s on Hobby, 60s on Pro). Long-running API operations like analysis tasks will time out. For production use, consider deploying the server to a persistent host like Railway or a VPS.

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:

Run the runner locally bash
# 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.