ulo
ulo
Documentation

Start here

IntroductionInstallationQuick StartProject StructureDevelopment Workflow
Coming from NestJSNestJS topics, mapped

The model

Protocols

Integrations

Operating

Reference

Getting Started

Development Workflow

Rebuild and restart on save with ulo dev, and keep the port answering across restarts.

On every save the project rebuilds and the new binary replaces the running one. ulo dev runs this loop; the generic Rust watch tools do the same.

ulo dev

From the project root:

ulo dev

ulo dev builds with cargo build, starts the binary, and rebuilds on every change to a .rs or .toml file. Paths in .gitignore, target/ and .git/ are not watched, and changes are throttled at 250 ms.

The running application keeps serving while a rebuild runs. Only a build that succeeds stops it: the process gets SIGTERM, then SIGKILL after 2 seconds, and the new binary starts. A build that fails prints cargo's errors and leaves the running application in place. The 2-second window can be shorter than the application's own drain (10 seconds unless set), so a restart under ulo dev can cut an in-flight request that a production shutdown would have finished (see Graceful shutdown).

Options select what cargo builds; every flag is on CLI Commands.

Holding the port across restarts

Between the old process stopping and the new one binding, nothing listens, and connections are refused. --listen closes that gap: ulo dev binds the address itself and hands the same socket to every child as file descriptor 3, through the systemd socket-activation variables. Connections made during a rebuild wait in the kernel's backlog and are answered by the new process.

ulo dev --listen 127.0.0.1:3000

The application's main does not change. Under ulo dev, a server written with the held address, as in examples/01-hello:

Server::new(format!("127.0.0.1:{port}"))

adopts the held socket in place of binding its own, so ulo dev --listen 127.0.0.1:3000 -p ex-01-hello restarts without refusing a connection. An application that names its socket explicitly, as examples/40-socket-activation does with Endpoint::inherited_index(0), adopts descriptor 3 whatever the address. See Socket activation.

--listen takes an address with a host (0.0.0.0:8080), not a bare port, and holds TCP sockets only: a UDP link binds its address itself. Holding needs Unix file-descriptor passing, so on other platforms the flag is ignored with a warning.

Other watchers

watchexec restarts an arbitrary command when files change:

cargo install watchexec-cli
watchexec -r -e rs,toml -- cargo run

bacon is a terminal UI built around compile feedback. bacon run rebuilds and restarts the application on save, and plain bacon runs cargo check on save.

Neither holds the socket, so connections are refused during a rebuild.

Faster rebuilds

The save-to-running gap is compile plus link time. Two settings shorten it.

Keep only line tables in the dev profile. Full debuginfo is a large share of compile and link cost, and panic backtraces stay resolvable:

Cargo.toml
[profile.dev]
debug = "line-tables-only"

On Linux, mold cuts link time:

.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

Adjust the target triple to the host.

Project Structure

The files ulo new writes, how its main wires an application, and where new modules go.

Coming from NestJS

A mapping from NestJS constructs to Ulo's, a small NestJS controller ported, and the differences that change how code is written.

On this page

ulo devHolding the port across restartsOther watchersFaster rebuilds