ulo
DocsFrom NestJSGitHub

ụlọ (/ʊ́lɔ̀/, oo-law) is Igbo for house.

Structure for Rust services.

Ulo organises an application into modules, controllers and injectable services. Every call, on every transport, passes the same guards, interceptors and error handlers. The HTTP server is a crate chosen in main.

Get startedComing from NestJSulo = "=0.1.0-alpha.3"
src/notes.rs
#[injectable]pub struct Notes {    #[injectable(default)]    all: Mutex<Vec<Note>>,} #[controller]pub struct NotesController {    notes: Dep<Notes>,} #[handlers]impl NotesController {    #[ulo_http::post("/notes")]    fn create(        &self,        Valid(Json(new)): Valid<Json<NewNote>>,    ) -> Created<Json<Note>> {        let note = self.notes.add(new.title);        let at = format!("/notes/{}", note.id);        Created::at(at, Json(note))    }} #[module(providers = [Notes], controllers = [NotesController])]pub struct NotesModule;
src/main.rs
let app = App::builder(AppModule)    .runtime(Tokio::current())    .wire()?    .connect()    .await?    // The only line that names a server.    .bind(Server::new("0.0.0.0:3000"))    .listen()    .await?; app.serve(shutdown_signal()).await?;

Servers

A server crate, or the framework you already run.

ulo-http-hyper owns its sockets. The five embedding crates mount the application inside a host framework, which keeps its own routes and middleware. Controllers move between the two without change, and one conformance suite tests every crate against hyper's behaviour.

  • ulo-http-hyperon hyper: the reference server. It owns its sockets, with TLS, h2c and header timeouts set on it
  • ulo-http-axumon axum: a tower::Service, mounted with nest_service or fallback_service
  • ulo-http-actixon actix-web: an HttpServiceFactory. No WebSocket upgrades on the HTTP port
  • ulo-http-poemon poem: a poem::Endpoint, mounted with Route::nest
  • ulo-http-rocketon rocket: catch-all routes, one per method
  • ulo-http-salvoon salvo: a salvo::Handler, nested or as the catch-all goal

Transports

The same chain, wherever the request came from.

Guards, interceptors and error handlers are generic over the transport. One enhancer type can implement its trait for several transports and run on each.

HTTP

Controllers, extractors and SSE. Unscoped middleware runs before routing and sees requests no route matches.

WebSocket

Gateways with message handlers, rooms and cross-process broadcast, on the HTTP port or a port of their own.

RPC

Pattern-matched handlers over TCP, UDP, NATS, Redis, RabbitMQ, MQTT or Kafka.

gRPC

Contract-first services from a .proto file, dispatched by path to ordinary controllers.

GraphQL

async-graphql or juniper, over HTTP, with subscriptions over a WebSocket gateway.

Integrations

Configuration, data, health and tooling.

Each is its own crate and registers as a module. An application compiles only the integrations it depends on.

DatabasesSeaORM, SQLx, Diesel, MongoDB and Redis, each checked for reachability at startup
Configurationdefaults, files, the environment and explicit values layered into one typed value, checked by wire()
Health checksliveness, readiness and startup probes over HTTP and gRPC, fed by checks any module contributes
TestingTestApp with provider overrides, and a clock a test can replace for timeouts and retries
CLIulo new, ulo generate and a watching ulo dev
Lifecycleinit, bootstrap and shutdown hooks, and a drain window for in-flight executions

Quick start

The quick start goes from an empty directory to a running route, then adds a service, typed requests and validation.

StartRead the docs