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
| Parameter | Type | Required | Description |
|---|---|---|---|
options | VercelAdapterOptions | No | Configuration for the Vercel deployment. |
VercelAdapterOptions
| Property | Type | Default | Description |
|---|---|---|---|
runtime | 'nodejs' | 'edge' | 'nodejs' | Runtime for serverless functions. |
regions | string[] | — | Vercel regions to deploy to (e.g. ['iad1', 'sfo1']). |
maxBodySize | number | 1048576 | Maximum 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:
- Generates
.vercel/output/config.json - Copies client assets and pre-rendered pages to
.vercel/output/static/ - Generates a serverless function at
.vercel/output/functions/index.func/(unless infrontend-only mode) - Creates the
.vc-config.jsonfor the function with the specified runtime and regions - 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"],
}),
});
