Vercel
Deploy a DaloyJS REST API to Vercel as a single standalone function on the Node.js runtime. Node.js is the default runtime and what Vercel recommends, and it runs on Fluid compute with per-request billing.
- your codeDaloyJS Appimport { app } from '../src/server.ts'
- adaptertoFetchHandler(app)export default at api/index.ts
- vercel.json/(.*) → /api rewriteDaloyJS owns routing at the site root
When to choose Vercel
- You want a standalone DaloyJS REST API on Vercel Functions.
- You want Fluid compute (the default since 2025) with per-request billing.
- You want preview deployments per PR with zero CI config.
Scaffold
The Vercel starter scaffolds a standalone REST API on the Node.js runtime (the toFetchHandler entrypoint shown below), which Vercel recommends for standalone functions.
Vercel Node.js Functions (standalone API)
For a standalone DaloyJS REST API on the Node.js runtime, use a single function at api/index.ts. Vercel Node.js Functions expect a default export with a fetch method.
Vercel maps api/index.ts to /api, but a DaloyJS app registers its routes at the root (/healthz, /docs, …). Add a rewrite so every path reaches the function and DaloyJS owns routing at the site root, without it the deployed root domain returns a Vercel 404:
vercel.json
The rewrites rule above is required for root routing. Add functions for per-function memory/duration limits, and regions to pin a region:
The legacy builds property is deprecated, use functions instead.
Deploy
Storage
Vercel KV and Vercel Postgres no longer exist as Vercel-owned products. They were sunset in December 2024 and existing stores were migrated automatically, Vercel KV to Upstash Redis, Vercel Postgres to Neon. For new projects, add the equivalent integration from the Vercel Marketplace (Neon for Postgres, Upstash for Redis), the integration provisions the store and injects the connection env vars into your project.
Vercel Blob and Edge Config are still first-party Vercel products. See Neon for the Postgres setup and distributed rate-limit store for the Redis setup.
Gotchas
- Standalone Vercel Node functions want a default export with
{ fetch }. UsetoFetchHandler. - Without the
/(.*)→/apirewrite, Vercel serves the function only at/apiand the root domain returns a 404. The rewrite is what lets DaloyJS own routing at the site root. - Secrets are available on
process.envat runtime. Add them withvercel env addrather than committing them.