rustf
A convention-based MVC web framework for Rust, inspired by Total.js v4. Designed to be equally intuitive for human developers and AI coding assistants: auto-discovery, predictable patterns, a Total.js-style template engine, sessions, and a multi-database model layer.
Status:
1.0.0-rc1โ release candidate. APIs are close to stable; feedback welcome.
๐ Documentation ยท Repository
Quick start
[]
= "1.0.0-rc1"
= { = "1", = ["full"] }
= { = "1", = ["derive"] }
= "1"
use *;
async
// src/controllers/home.rs
use *;
async
Highlights
- Auto-discovery โ controllers, models, middleware, workers, events discovered at build time (no
mod.rswiring). - Total.js-style views โ
@{...}template engine with conditionals, loops, sections, layouts, form helpers (@{text}/@{textarea}/@{checkbox}/@{radio}/โฆ), and meta helpers (@{title}/@{description}/@{meta}). - Model layer โ query builder +
BaseModelover PostgreSQL, MySQL/MariaDB and SQLite (viasqlx). - Sessions โ in-memory by default; Redis-backed for multi-instance/clustered deployments.
- Security built-in โ CSRF, security headers, path-traversal protection, context-aware escaping.
Cargo features (opt-out)
All database drivers and Redis are on by default. For a leaner build, disable defaults and enable only what you need:
= { = "1.0.0-rc1", = false, = [
"embedded-views",
"db-postgres", # pulls in `database` + `decimal` automatically
] }
| Feature | Default | Enables |
|---|---|---|
db-postgres / db-mysql / db-sqlite |
โ | per-driver SQL support (each implies database) |
database |
โ | driverless SQL core + decimal |
redis |
โ | Redis-backed (cross-instance) session storage |
embedded-views |
โ | compile templates into the binary |
schema |
โ | YAML schema validation + codegen |
cli |
โ | clap-based argument parsing |
TOML config loading, the auto-discovery macros, and UUID support are core and always compiled.
See the Installation guide for the full table.
License
Licensed under either of Apache License 2.0 or MIT license at your option.