@domcojs/vercel
v3.2.2
Published
domco Vercel adapter
Readme
@domcojs/vercel
Deploys a domco app to Vercel with the Build Output API.
npm i -D @domcojs/vercel// vite.config.ts
import { adapter } from "@domcojs/vercel";
import { domco } from "domco";
import { defineConfig } from "vite";
export default defineConfig({ plugins: [domco({ adapter: adapter() })] });Runtime
The function runs on nodejs26.x, the latest Node.js LTS on Vercel, by default. Choose another Node.js version or Bun with config.runtime.
adapter({ config: { runtime: "nodejs24.x" } }); // or "bun1.x"Requests
Vercel ends TLS at its edge and forwards plain HTTP to the function. The adapter uses headers that Vercel sets at its edge, so every runtime (Node.js, Node.js with ISR, and Bun) sees the client's request:
req.urluses the client's protocol fromx-forwarded-proto.fetchreceives the client's IP asinfo.ipfromx-forwarded-for, which Vercel overwrites to prevent spoofing. Other headers a client can send, such asx-real-ip, are not read.
// src/server/+app.ts
import type { FetchInfo } from "domco";
export default {
fetch(req: Request, info?: FetchInfo) {
return new Response(`${req.url} from ${info?.ip}`);
},
};If another proxy sits in front of Vercel, Vercel may see the proxy's IP instead of the client's. See using a proxy with Vercel.
