Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Platform support

zapline runs on Linux, macOS and Windows. CI builds, lints and runs the full test suite on all three, and checks that projects generated by zapline new build and pass their tests on each.

Support matrix

LinuxmacOSWindows
Framework, all Cargo features✅✅✅
Default server runtimethread-per-core (SO_REUSEPORT)multi-threaded (work-stealing)multi-threaded (work-stealing)
HTTP/1.1, HTTP/2, TLS✅✅✅
Graceful shutdown onSIGINT, SIGTERMSIGINT, SIGTERMCtrl-C, Ctrl-Break, console close, system shutdown / docker stop
App::run_unix (Unix domain sockets)✅✅— (not available)
Static files✅✅✅ plus Windows-specific path protection (below)
zapline CLI✅✅✅
zapline dev restartSIGTERM, then kill after 5sSIGTERM, then kill after 5simmediate stop
zapline benchwrk or ohawrk or ohaoha
bench/run.sh comparison✅— (uses Linux taskset)—
Local checks./scripts/check.sh./scripts/check.sh.\scripts\check.ps1

Performance: the thread-per-core runtime depends on Linux's SO_REUSEPORT load balancing. On macOS and Windows, RuntimeMode::PerCore falls back to the work-stealing runtime automatically. That is fast and fully supported, but publish benchmark numbers from Linux.

Setting up on Windows

  1. Install the Visual Studio Build Tools with the "Desktop development with C++" workload. Rust uses its linker, and two dependencies (ring for TLS, zstd for compression) compile C code. rustup-init.exe offers to install it for you.
  2. Install Rust from https://rustup.rs (rustup-init.exe). The default x86_64-pc-windows-msvc toolchain is the one CI tests.
  3. In PowerShell:
git clone https://github.com/samsamurai301/zapline.git
cd zapline
.\scripts\check.ps1                      # fmt, clippy, tests, feature matrix, examples, docs
cargo install --path crates\zapline-cli  # installs zapline.exe and cargo-zapline.exe
zapline new my-api --zapline-path .\crates\zapline
cd my-api; zapline dev

If PowerShell blocks scripts, run powershell -ExecutionPolicy Bypass -File .\scripts\check.ps1.

For load testing, install oha with cargo install oha. zapline bench uses it automatically when wrk isn't available.

Windows-specific behavior

  • Ports: zapline doesn't set SO_REUSEADDR on Windows. There, unlike on Unix, the option would let another process bind the same port while your server is listening.
  • Shutdown: Windows force-terminates a process about 5 seconds after a console-close event and about 20 seconds after a shutdown event. If you rely on draining, keep shutdown_timeout below that, for example with .shutdown_timeout(Duration::from_secs(4)).
  • Static files: besides the protections on every platform (.., encoded separators, symlink escapes), ServeDir rejects:
    • drive and stream syntax (C:, file:stream)
    • DOS device names (CON, NUL, COM1, lpt1.txt, ...)
    • names ending in a dot or space, which Win32 silently strips (secret.txt. would open secret.txt)
  • Line endings: .gitattributes keeps every file LF on checkout, so templates, generated code and byte-exact tests behave the same as on Unix. Editors on Windows handle LF fine.

Setting up on macOS

Install the Xcode command-line tools (xcode-select --install) and Rust from https://rustup.rs. Then follow the same steps as on Linux. brew install wrk (or cargo install oha) gives you a load generator.

Deploying

Any of the three platforms works in production. For the highest throughput, deploy on Linux, for example in the slim container image that zapline new generates. That's where the thread-per-core runtime applies.