LogoZonai
zonai.dev

zonai compile

Compile worker executables without creating a deployment bundle.

Compile all worker executables from source and write them to .zonai/executables/. Also regenerates .dart_tool/zonai/project_main.dart. Does not create a deployment bundle (use zonai build for that).

zonai compile [flags]

Flags#

FlagDescription
--flavor <name> Config flavor to compile with — also selects .env.<name>
--releaseCompile without Dart asserts
--dart-define KEY=VALUE Override or add one compile-time define; repeat per key. Space-separated, not --dart-define=KEY=VALUE
-c, --config <path>Path to a custom zonai.yaml

There is no --dart-define-from-file — .env / .env.<flavor> is loaded from the project root on its own. See Environment Variables.

Workers Compiled#

  • db_config — config worker
  • db_rules — rules worker (run in-process instead when the project binary is linked)
  • db_operations — operations worker (run in-process instead when the project binary is linked)
  • db_extensions — extensions worker
  • db_rate_limit — rate limit worker
  • db_crons — crons worker

When to Use Manually#

In dev mode (zonai serve), Zonai watches source files and recompiles workers automatically — manual compile is rarely needed during development. Use it for:

  • Setting up a fresh clone before starting the server
  • Verifying compilation succeeds in CI
  • Updating compiled binaries after discarding changes that left executables stale
  • Preparing workers before running zonai rules without starting the server

vs. zonai build#

  • zonai compile — workers only, to .zonai/executables/. Use during development.
  • zonai build — workers + build/zonai + migrations, templates and settings under build/. Use for deployment.