Vercel
BuildTarget.vercel emits a complete Vercel Functions workspace under .spry/vercel/. Spry generates all the wrapper files required by the platform — you deploy the workspace as-is.
Config
import 'package:spry/config.dart';
void main() {
defineSpryConfig(
port: 3000,
target: BuildTarget.vercel,
reload: ReloadStrategy.hotswap,
);
}ReloadStrategy.hotswap keeps the Vercel dev server alive across rebuilds.
Build output
.spry/
src/
main.dart ← compile input
vercel/
runtime/
main.js ← compiled Dart-to-JS output
api/
index.mjs ← Vercel Function entry point
vercel.json ← rewrite rules (generated if missing)
package.json ← @vercel/functions dependency
public/ ← copied public assetsapi/index.mjs is a thin ESM wrapper that loads the compiled runtime and re-exports the fetch handler in the shape Vercel expects.
vercel.json is generated with a catch-all rewrite to /api so all requests are handled by the function:
{
"rewrites": [{ "source": "/(.*)", "destination": "/api" }]
}Deploy
# Build
dart run spry build
# Deploy from the generated workspace
cd .spry/vercel
vercel deployFor CI deployment, keep Vercel's Root Directory as the repository root and set the Build Command to dart run spry build. Vercel will pick up vercel.json from .spry/vercel/ after the build generates it. Alternatively, run cd .spry/vercel && vercel deploy as a post-build step.
Local dev
dart run spry servespry serve runs vercel dev inside .spry/vercel/ automatically, including installing @vercel/functions on first run.
Good fit
- Vercel-hosted server deployments
- Teams that want zero platform glue code in their repository
- Projects deploying both static assets and a server function on Vercel