Dart
Spry has five Dart-native targets. They share the same route pipeline and differ only in how the compiled server is delivered.
All targets generate source under .spry/src/. The exe, aot, jit, and kernel targets also compile it to a binary or snapshot under .spry/dart/.
Dart VM
BuildTarget.vm skips compilation entirely. Spry generates source files and the server runs directly with dart run.
import 'package:spry/config.dart';
void main() {
defineSpryConfig(host: '127.0.0.1', port: 4000, target: BuildTarget.vm);
}Output:
.spry/src/
app.dart
hooks.dart
main.dartRun:
dart run spry serve # development
dart run .spry/src/main.dart # productionBest for local development and self-hosted environments where the Dart SDK is already present. Static assets are served from publicDir at the project root — run the binary from the project root to avoid path drift.
Native executable
BuildTarget.exe compiles to a self-contained native executable. No Dart SDK required on the target machine.
import 'package:spry/config.dart';
void main() {
defineSpryConfig(target: BuildTarget.exe);
}Output:
.spry/dart/
server ← native executable
public/ ← copied from publicDirRun:
dart run spry build
./.spry/dart/serverThe executable and public/ directory are everything you need to deploy. On Linux/macOS make sure the binary has execute permission (chmod +x .spry/dart/server). This is usually the right choice for Docker images and CI-produced release artifacts.
AOT snapshot
BuildTarget.aot compiles to an AOT snapshot. Requires dartaotruntime on the target machine, but not the full SDK.
import 'package:spry/config.dart';
void main() {
defineSpryConfig(target: BuildTarget.aot);
}Output:
.spry/dart/
server.aot
public/Run:
dart run spry build
dartaotruntime .spry/dart/server.aotdartaotruntime must be from the same Dart release used during the build — version mismatches will fail at startup.
JIT snapshot
BuildTarget.jit compiles to a JIT snapshot. Requires the Dart VM but avoids re-parsing source on every startup.
import 'package:spry/config.dart';
void main() {
defineSpryConfig(target: BuildTarget.jit);
}Output:
.spry/dart/
server.jit
public/Run:
dart run spry build
dart run .spry/dart/server.jitKernel snapshot
BuildTarget.kernel compiles to a kernel snapshot — the most portable Dart snapshot format. Runs on any compatible Dart VM regardless of platform.
import 'package:spry/config.dart';
void main() {
defineSpryConfig(target: BuildTarget.kernel);
}Output:
.spry/dart/
server.dill
public/Run:
dart run spry build
dart run .spry/dart/server.dillChoosing a target
| Target | Needs at runtime | Startup | Best for |
|---|---|---|---|
vm | Dart SDK | Interpreted | Development, SDK-available hosts |
exe | Nothing | Fastest | Docker, portable releases |
aot | dartaotruntime | Fast | Cold-start sensitive, no full SDK |
jit | Dart VM | Medium | Snapshot without AOT complexity |
kernel | Dart VM | Slower | Maximum portability |