Netlify
BuildTarget.netlify emits a complete Netlify Functions workspace under .spry/netlify/. Spry generates all platform bootstrap files — you deploy the workspace directly.
Config
import 'package:spry/config.dart';
void main() {
defineSpryConfig(
port: 3000,
target: BuildTarget.netlify,
reload: ReloadStrategy.hotswap,
);
}ReloadStrategy.hotswap keeps the Netlify dev server alive across rebuilds.
Build output
.spry/
src/
main.dart ← compile input
netlify/
runtime/
main.js ← compiled Dart-to-JS output
functions/
index.mjs ← Netlify Function entry point
netlify.toml ← site config (generated if missing)
public/ ← copied public assetsfunctions/index.mjs is an ESM module that loads the compiled runtime and exports the fetch handler for Netlify Functions.
The generated netlify.toml configures the functions directory and a catch-all redirect so all requests route through the function:
[build]
publish = "public"
[functions]
directory = "functions"
[[redirects]]
from = "/*"
to = "/.netlify/functions/index"
status = 200Deploy
# Build
dart run spry build
# Deploy from the generated workspace
cd .spry/netlify
netlify deploy --prodFor CI deployment, keep your Build Command as dart run spry build and set Publish directory to .spry/netlify/public and Functions directory to .spry/netlify/functions in your Netlify site settings.
Local dev
dart run spry servespry serve runs netlify dev inside .spry/netlify/ automatically.
Good fit
- Netlify-hosted server deployments
- Projects that want Netlify Functions rather than Edge Functions
- Teams that want Spry to own all platform wrapper files