ulo
ulo
Documentation

Start here

Coming from NestJSNestJS topics, mapped

The model

Protocols

OverviewQuick startCall shapesEnhancersErrors and statusClientOperations

Integrations

Operating

Reference

gRPC

Overview

Contract-first gRPC services from a .proto file, served over HTTP/2 with the same dependency injection and enhancers as every other transport.

ulo-grpc serves gRPC from a .proto file. A build step turns the proto into messages, a client and one marker type per method. Handlers on an ordinary controller bind to those markers, and a dispatcher calls them by path. tonic's generated server trait is never implemented, so there is no *Server::new(handler) step.

The .proto is the contract. A handler whose message types or call shape differ from its marker's fails to compile, with the type it declared beside the type the marker requires.

Crates

CrateRole
ulo-buildbuild.rs code generation over a vendored protoc: messages, clients and method markers
ulo-grpcthe transport: Server, #[ulo_grpc::method], status mapping, health, reflection, client modules
ulo-health-grpcoptional: drives grpc.health.v1 from the application's readiness

The crate that runs the build step also depends on tonic (features channel and codegen), tonic-prost and prost, because the generated code names them. Rust 1.88 is enough. gRPC runs on tokio, since tonic is tokio-only. An app on another runtime fails listen() at the gRPC server.

How the pieces fit

  1. build.rs compiles the proto with ulo_build::configure().compile(..).
  2. ulo_grpc::include_proto!("pkg.v1") includes the generated code, markers included.
  3. #[ulo_grpc::method(pb::service::Method)] binds a handler to a marker.
  4. ulo_grpc::Server::new(addr) serves them. Any gRPC client reaches the result.

gRPC serves on its own port. Nothing routes an application/grpc request that arrives on an HTTP server's port to it.

In this section

  • Quick start: a service from proto to a running server (examples/29-grpc-service).
  • Call shapes: unary, server-streaming, client-streaming and bidirectional handlers.
  • Enhancers: guards, interceptors and error handlers on gRPC.
  • Errors and status: kinds to codes and error details.
  • Client: a generated client as an ordinary provider, with deadlines forwarded (examples/30-grpc-client).
  • Operations: TLS, limits, reflection, health, deadlines and shutdown.

For pattern-routed services without a proto, see Microservices.

Kafka

The Kafka link, a topic per pattern with consumer groups, a reply topic and correlation headers.

Quick start

A gRPC service from a .proto file to a running server, with a guard and a domain error.

On this page

CratesHow the pieces fitIn this section