Ultimo is a modern Rust web framework built on Hyper + Tokio:
secure-by-default, fast, and type-safe end to end β with automatic TypeScript
client generation from your Rust API. REST and JSON-RPC live in one app, and
the framework is 100% safe Rust (#![forbid(unsafe_code)]).
Why Ultimo
- π Automatic TypeScript clients β define your API in Rust, get a fully typed TS client generated for you.
- π REST + JSON-RPC 2.0 in one app β plain HTTP routes and RPC procedures side by side, with batch requests and notifications.
- π WebSockets β RFC 6455 with a built-in pub/sub system (zero extra deps).
- π Streaming responses β chunked/streaming bodies via
ctx.stream(...). - π‘ Server-Sent Events β typed serverβclient push via
ctx.sse(...)+EventSource. - π Auth, built in β JWT and API-key middleware plus scope-based authorization guards.
- π‘οΈ Secure by default β 100% safe Rust, secure sessions/cookies, CSRF, security-headers middleware, request body-size limits, and supply-chain CI.
- β‘ Fast β native Rust on the Hyper + Tokio core, O(1) constant-time routing, benchmarks regression-guarded in CI (details).
- ποΈ Databases β first-class SQLx and Diesel integration (PostgreSQL / MySQL / SQLite).
- π§ͺ Testing utilities β in-process
TestClient, response assertions, and fixtures. - π€ Built for coding agents β typed RustβTS codegen, scaffolds that build,
llms.txtdocs, and Context7. See Using Ultimo with AI coding agents.
Quick start
[]
= "0.9"
= { = "1", = ["full"] }
= { = "1", = ["derive"] }
use *;
async
MSRV: Rust 1.86. Everything beyond the core is opt-in via Cargo features (see below).
Type-safe clients
Ultimo's headline feature: define an API once in Rust and generate a typed TypeScript client β no hand-written types, no drift.
# Generate a TypeScript client from your RPC definitions
// Generated, fully typed β autocomplete + compile-time checks
const user = await client.getUser({ id: 1 });
console.log(user.name);
See TypeScript Clients for the full workflow.
Feature flags
Everything is opt-in (default = []):
| Feature | What it enables |
|---|---|
websocket |
RFC 6455 WebSocket support + pub/sub |
session |
Cookie-based session management |
jwt |
JWT authentication middleware (HS256) |
api-key |
API-key authentication with a pluggable store |
csrf |
CSRF protection (double-submit cookie) |
static-files |
Static file serving + SPA fallback (serve_static, serve_spa) |
compression |
Automatic gzip/brotli response compression (pure Rust, no C deps) |
client-gen |
Derive RPC client TypeScript types from Rust types (via ts-rs) |
oidc |
Verify OIDC/JWKS (RS256/ES256) tokens β Clerk, Auth0, Cognito, Supabase |
testing |
In-process TestClient, assertions, fixtures |
test-helpers |
WebSocket test helpers (for integration tests) |
sqlx-postgres Β· sqlx-mysql Β· sqlx-sqlite |
SQLx integration per backend |
diesel-postgres Β· diesel-mysql Β· diesel-sqlite |
Diesel integration per backend |
= { = "0.9", = ["websocket", "jwt", "sqlx-postgres"] }
CLI
ultimo buildis not implemented yet β usecargo build --releasefor now. See the roadmap.
Documentation
Full guides at docs.ultimo.dev β getting started, routing, middleware, RPC + TypeScript clients, OpenAPI, sessions, authentication, WebSockets, database integration, testing, and performance.
Examples
Runnable examples live in examples/.
Run one locally with:
Live demos
Try them without cloning (hosted on Render free tier β first request may take ~30s):
| Demo | What it shows |
|---|---|
| basic-example | Routing, JSON, query params, HTML |
| session-auth | Cookie sessions + CSRF protection |
| jwt-auth | JWT authentication + scope guards |
| websocket-chat | WebSocket pub/sub chat room |
| spa-demo | Static files + SPA fallback |
| openapi-demo | Swagger UI + OpenAPI spec |
Contributing
Issues and PRs welcome. See CONTRIBUTING.md and the roadmap. Security policy: SECURITY.md.
License
MIT Β© Ultimo Contributors. See LICENSE.