The dev server (flux dev) is your constant companion while you build a Flux
app: it watches, parses, type-checks, lowers, and diffs your .flux sources,
then ships binary patches to the connected host apps. This guide covers every
knob it exposes.
Start the server on the defaults
Section titled “Start the server on the defaults”Run it from your project root (or point it anywhere with --root):
flux dev# Listening on ws://127.0.0.1:7331The defaults serve a project in the current directory, bound to localhost:
| Flag | Default | Role |
|---|---|---|
--root <path> |
. |
Project root to watch and serve |
--ws-host <addr> |
127.0.0.1 |
WebSocket bind address |
--ws-port <port> |
7331 |
Patch channel to the host apps |
--http-port <port> |
7332 |
HTTP asset server |
--token <secret> |
unset | Require a pairing token in the Hello handshake |
The same defaults live in flux.toml under [dev], so a checked-in project
configures its ports for every contributor. See the
flux.toml reference.
Verify the server is healthy
Section titled “Verify the server is healthy”The asset server exposes a health probe:
curl http://127.0.0.1:7332/healthokServe a physical device over the LAN
Section titled “Serve a physical device over the LAN”Simulators and emulators reach 127.0.0.1 on your machine; a physical device
cannot. Expose the server on your LAN and point the host app at your machine’s
LAN IP:
flux dev --ws-host 0.0.0.0In the host app, set the server address to ws://192.168.1.42:7331, replacing
the IP with the address of the machine running flux dev. The Android host
stores this in its resources; the iOS host takes it in its connection screen.
Require a pairing token
Section titled “Require a pairing token”An open dev loop on localhost is safe by default. A LAN-exposed server must authenticate the hosts that push bytecode to it:
flux dev --ws-host 0.0.0.0 --token <secret>The host presents its token during the Hello handshake (wire protocol
Appendix D, pairing/auth section). Hosts read their token from:
- the
FLUX_DEV_TOKENenvironment variable, or [dev] tokeninflux.toml.
A host without the token is rejected at the handshake and receives no frames.
What the server does on save
Section titled “What the server does on save”Every save triggers the full pipeline — you never restart anything:
- Parse and type-check every
.fluxfile. Diagnostics appear in the server log with source spans. - Lower the program to the Reactive Tree IR.
- Diff the new tree against the previous one.
- Serialize the minimal edit script as a binary patch and send it over
:7331.
A handler-body edit is typically a few hundred bytes on the wire because
props and closures are content-addressed (BLAKE3) and cached on the host
after the first Init frame. See The wire, explained.
Next steps
Section titled “Next steps”- Ship a native release when dev looks right.
- Wire protocol reference for the frames the server sends.
