adapter-vercel

Vercel adapter for Catmint. Transforms Catmint build output into the Vercel Build Output API v3 format for seamless deployment.

Import

import vercel from "@catmint/adapter-vercel";

Signature

function vercelAdapter(options?: VercelAdapterOptions): CatmintAdapter;

The default export is the vercelAdapter factory function.

Parameters

ParameterTypeRequiredDescription
optionsVercelAdapterOptionsNoConfiguration for the Vercel deployment.

VercelAdapterOptions

PropertyTypeDefaultDescription
runtime'nodejs' | 'edge''nodejs'Runtime for serverless functions.
regionsstring[]Vercel regions to deploy to (e.g. ['iad1', 'sfo1']).
maxBodySizenumber1048576Maximum request body size in bytes (default 1 MB). Requests exceeding this limit receive a 413 Payload Too Large response.

Return Value

Returns a CatmintAdapter object with name: '@catmint/adapter-vercel'. When the adapt() method is called during build, it:

  1. Generates .vercel/output/config.json
  2. Copies client assets and pre-rendered pages to .vercel/output/static/
  3. Generates a serverless function at .vercel/output/functions/index.func/ (unless in frontend-only mode)
  4. Creates the .vc-config.json for the function with the specified runtime and regions
  5. If the build manifest has hasMiddleware: true, middleware execution is included in the function handler. Routes with middleware-protected pre-rendered pages are rewritten to the function instead of being served statically.

Edge Runtime

When runtime: 'edge' is selected, the adapter validates that server functions do not reference Node.js-specific APIs (fs, child_process, node:, etc.) and logs warnings for potential incompatibilities. For middleware-protected static routes, a prerendered.js module is generated that inlines the pre-rendered HTML as a pathname-to-string map, since the Edge runtime cannot access the filesystem.

Examples

// catmint.config.ts — default Node.js runtime
import { defineConfig } from "catmint/config";
import vercel from "@catmint/adapter-vercel";

export default defineConfig({
  adapter: vercel(),
});
// Edge runtime with specific regions
import { defineConfig } from "catmint/config";
import vercel from "@catmint/adapter-vercel";

export default defineConfig({
  adapter: vercel({
    runtime: "edge",
    regions: ["iad1", "sfo1"],
  }),
});

See Also