Uxar
Axum-based web framework for Postgres-backed JSON APIs where handler code drives OpenAPI, auth, and query execution.
⚠️ Experimental — usable, but unstable. APIs may change without notice. Expect breaking changes.
What it is
Uxar explores a handler-first model:
- OpenAPI is derived from handler signatures and doc-comments
- role-based auth is enforced via extractors (
permit!) - queries use SQL-shaped builders (
db::select/...) - application features are composed as Bundles
There is no separate annotation layer for API specs. The code is the spec.
Core ideas
-
Routes + OpenAPI from the same source
Handler signatures, doc-comments, andpermit!guards generate the spec. -
permit!role guards
Axum extractor enforcing roles at the type level; automatically emitsbearerAuthin OpenAPI. -
Bundle composition
A Bundle is Uxar’s unit of composition — a feature can include routes, background jobs, signals, and docs, and be mounted as a single value. -
Built-in JWT
Access + refresh tokens via HTTP-only cookies orAuthorizationheader. -
SQL-shaped query builders
db::select/insert/update/deletereturn builders directly; bind parameters, filters, and SQL errors are deferred to the terminal async call. -
Cron + signals
Compile-time validated cron/periodic emitters connected to typed in-process signal handlers.
Example
Full source: uxar/examples/notes.rs — login, CRUD routes, cron job, in-process signal.
cargo run --example notes
# open http://localhost:8080/v1/api/docs
use ;
use Json;
use JsonSchema;
use ;
/// A note row returned from the database.
/// List all notes belonging to the authenticated user.
async
/// Create a note for the authenticated user.
async
async