# Rainier > Rainier is a batteries-included MVC framework for Rust: routing, an ORM, queues, mail, auth, events, broadcasting and a scheduler in one application, with conventions an MVC developer already knows and a compiler that checks them. These are the docs for Rainier 2.0.0 (framework revision 7b8cb15, MSRV Rust 1.100). Every link below is the page's Markdown source; drop the `.md` for the HTML page. Applications depend on the framework by git (`git = "https://github.com/safewords/rainier-framework.git"`), not crates.io. ## Getting Started - [Overview](https://rainierframework.io/docs/2.x/overview.md): Rainier is an MVC framework for Rust: a service container, providers that wire it, a router with named routes and middleware groups, form requests, guards, jobs, mailables,… - [Installation](https://rainierframework.io/docs/2.x/installation.md): Rust 1.100 or later. The workspace declares rust-version = "1.100", the toolchain CI builds with and the one every deployment runs, so that is the floor for every feature. The… - [Directory Structure](https://rainierframework.io/docs/2.x/directory-structure.md): The sample project's layout maps one-for-one onto the conventional PHP MVC project layout. If you know where something lives in that tradition, you know where it lives here. - [Configuration](https://rainierframework.io/docs/2.x/configuration.md): Two layers: - [Architecture Overview](https://rainierframework.io/docs/2.x/architecture.md): Most full-stack frameworks ship as one package that pulls in everything. Rainier ships as twenty-four crates, and an application depends on exactly the ones it uses. An app that… - [The Request Lifecycle](https://rainierframework.io/docs/2.x/lifecycle.md): A request's journey is the classic MVC spine: the server → the HTTP kernel → global middleware → the router → route middleware → the controller → back out, with a seam at every… - [Service Container](https://rainierframework.io/docs/2.x/container.md): The container is a registry that knows how to build things, and how to hand you the same one twice when that is what you want. - [Service Providers](https://rainierframework.io/docs/2.x/providers.md): Service providers are where an application says how it is wired: a register phase that binds things, and a boot phase that uses them. - [Facades](https://rainierframework.io/docs/2.x/facades.md): A facade is a static proxy onto a container-resolved service — a global name for something the container owns. ## The Basics - [Routing](https://rainierframework.io/docs/2.x/routing.md): Routes are declared in src/routes/. A route file is a function taking a &mut Router rather than a script running against a static facade. - [Middleware](https://rainierframework.io/docs/2.x/middleware.md): Middleware sits around the rest of the chain. It can inspect the request on the way in, inspect or replace the response on the way out, wrap the whole call, or decline to call… - [Controllers](https://rainierframework.io/docs/2.x/controllers.md): A controller action is a plain async fn. There is no base class to extend, and no Controller trait to implement. - [Requests](https://rainierframework.io/docs/2.x/requests.md): Request is the whole of what arrived: method, URI, headers, a buffered body, parsed input, cookies, uploads, route parameters, and a typed extension map. - [Responses](https://rainierframework.io/docs/2.x/responses.md): A handler can return a Response, or anything that becomes one. - [Views](https://rainierframework.io/docs/2.x/views.md): The V in MVC. Templates live in resources/views/, use a directive syntax that will be familiar from PHP templating engines, and are addressed by dotted name. - [Vite](https://rainierframework.io/docs/2.x/vite.md): Frontend assets, the way a PHP framework does them: resources/js and resources/css are source, Vite compiles them into public/build, and a template asks for an entry with a… - [URL Generation](https://rainierframework.io/docs/2.x/urls.md): UrlGenerator turns a named route back into a URL: name the route once, derive every URL from it. - [Validation](https://rainierframework.io/docs/2.x/validation.md): Validation has two shapes: a validator you drive yourself, and a request contract — a form request — that authorises, validates, and hands the action a typed payload. - [Error Handling](https://rainierframework.io/docs/2.x/errors.md): Rainier has one error type. A handler returns Result, uses ? freely, and the framework turns whatever comes out into the right status code. ## Database - [Database: Getting Started](https://rainierframework.io/docs/2.x/database.md): Rainier's data layer is built on Rainier ORM, a multi-dialect DBAL where one #[derive(Entity)] serves SQLite, MySQL and Postgres — and Cloudflare D1, which speaks SQLite over HTTP… - [Models](https://rainierframework.io/docs/2.x/models.md): A model is a Rainier ORM Entity plus the two extra facts the framework needs: a display name for error messages, and the column route-model binding looks up by. - [Repositories](https://rainierframework.io/docs/2.x/repositories.md): Active-record ORMs put queries on the model: Post::where('published', true)->get(). Rainier puts them behind a contract, because a static method on a struct is not something a… - [Relationships](https://rainierframework.io/docs/2.x/relationships.md): HasOne, HasMany, BelongsTo and BelongsToMany, as values you load rather than properties that query themselves. - [Migrations](https://rainierframework.io/docs/2.x/migrations.md): Migrations are ordered, named, and idempotent. Each runs at most once, tracked in a rainier_migrations table, so migrate is safe to run on every boot. - [Pagination](https://rainierframework.io/docs/2.x/pagination.md): Both return Paginated — the rows, plus the counts a page needs. ## Digging Deeper - [Console](https://rainierframework.io/docs/2.x/console.md): The console is the command-line half of the framework. Your main.rs is the entry point, and it boots the same application an HTTP request would. - [Events](https://rainierframework.io/docs/2.x/events.md): The dispatcher is Rainier's hook bus — the seam where something happens and something else reacts without either knowing about the other. - [Queues](https://rainierframework.io/docs/2.x/queues.md): Deferred work: a Job contract, a Queue port with three drivers, and a Worker that runs them. - [Task Scheduling](https://rainierframework.io/docs/2.x/scheduling.md): One cron entry, and everything else in version control. - [Mail](https://rainierframework.io/docs/2.x/mail.md): A mailable is a value that knows what message it is. It says who the message is from and to, and what the body is — and it does no I/O, which is what makes the interesting part… - [Notifications](https://rainierframework.io/docs/2.x/notifications.md): A notification is a message to a recipient, sent over whichever channels suit that recipient. A Notification, a Notifiable, and channels, in rainier-notify. - [Broadcasting](https://rainierframework.io/docs/2.x/broadcasting.md): An event pushed to a browser, and the authorisation that decides who may listen. Three parts: an event that names its channels, a driver that publishes, and an endpoint that… - [WebSockets](https://rainierframework.io/docs/2.x/websockets.md): A connection that stays open, served on the same port as everything else. - [Kafka](https://rainierframework.io/docs/2.x/kafka.md): A partitioned log, wired into the three ports that can use one: broadcasting, sockets, and the queue. - [Cache](https://rainierframework.io/docs/2.x/cache.md): A cache port with the shape and the drivers you would expect. - [Filesystem](https://rainierframework.io/docs/2.x/filesystem.md): One port — Filesystem — over a local directory, an in-process map, and anything that speaks S3. An application writes the same six calls whichever disk is behind them. - [HTTP Client](https://rainierframework.io/docs/2.x/http-client.md): Calling somebody else's API, and — more importantly — asserting that you did. - [Helpers](https://rainierframework.io/docs/2.x/helpers.md): rainier-support is the crate everything else depends on and that depends on nothing. It holds four things: string inflection, a typed map, the error type, and future aliases. - [Scenarios](https://rainierframework.io/docs/2.x/scenarios.md): The other pages each explain one technology. This page composes them: a requirement you would recognise, the pieces that serve it, and the part a reference page cannot give you —… ## Security - [Authentication](https://rainierframework.io/docs/2.x/authentication.md): Authentication answers who is this. Authorization answers may they. They are separate crates' worth of separate, and keeping them separate is worth the discipline. - [Authorization](https://rainierframework.io/docs/2.x/authorization.md): Authentication answers who. A gate answers whether they may. - [Hashing](https://rainierframework.io/docs/2.x/hashing.md): Password hashing lives in rainier-crypt — it is cryptography, even though nothing here can be reversed — and the front door is the HashManager: the algorithms as peer drivers,… - [Encryption](https://rainierframework.io/docs/2.x/encryption.md): Encrypt what the client must not read, and sign what it may read but not change — one Crypt for both halves. - [Sessions](https://rainierframework.io/docs/2.x/sessions.md): A session is a bag of values that follows a browser between requests, keyed by an unguessable id in a cookie. - [Human Checks](https://rainierframework.io/docs/2.x/captcha.md): Behind the captcha feature: a form's widget token verified server-side, for Cloudflare Turnstile, hCaptcha or reCAPTCHA. ## Observability - [Observability](https://rainierframework.io/docs/2.x/observability.md): Three optional things, each with its own section in config/ — Prometheus metrics, an OpenAPI document, and OpenTelemetry tracing — plus logs and health checks, which are not… - [Lookout](https://rainierframework.io/docs/2.x/lookout.md): Lookout is Rainier's opt-in diagnostics suite. It records what each unit of work did — a request, a job, a console command, a scheduled task — as a batch of entries: the queries… ## Testing - [Testing](https://rainierframework.io/docs/2.x/testing.md): Two kinds: ## Deployment - [Deployment](https://rainierframework.io/docs/2.x/deployment.md): The sample project's defaults are chosen so a fresh clone runs with nothing installed. Several of them are wrong for production, deliberately and obviously. This is the list. - [Kubernetes jobs](https://rainierframework.io/docs/2.x/kubernetes-jobs.md): Run a reserved queue job as a one-shot batch/v1 Job pod on Kubernetes instead of in the worker's own process. ## Add-ins - [Choosing Add-ins](https://rainierframework.io/docs/2.x/add-ins.md): The framework's core — container, router, guards, queue, mail, cache — is always there. Everything on this page is opt-in: a cargo feature you name, or nothing of it is compiled.… - [Accounts](https://rainierframework.io/docs/2.x/accounts.md): Authentication gives you guards: a way to say who a request belongs to. Something still has to make that true — a registration form, a login endpoint, the forgotten-password… - [Two-Factor Authentication and Passkeys](https://rainierframework.io/docs/2.x/two-factor.md): A second factor, in two shapes: - [Single sign-on](https://rainierframework.io/docs/2.x/sso.md): "Sign in with GitHub", "Sign in with Google", "Sign in with your company account" — OAuth 2.0 and OpenID Connect, in rainier-sso, behind the framework's sso feature. - [OAuth Server](https://rainierframework.io/docs/2.x/oauth-server.md): An OAuth 2.0 authorization server in rainier-oauth-server, behind the framework's oauth-server feature: the token endpoint, the two halves of the authorization endpoint, personal… - [Billing](https://rainierframework.io/docs/2.x/billing.md): Taking money through Stripe — subscriptions, one-off payments, refunds — and knowing, on every request, whether somebody has paid. - [Interoperating With the Stack You Are Leaving](https://rainierframework.io/docs/2.x/compat.md): A rewrite that switches over in one night is the kind that does not happen. What happens is a Rainier application answering some routes while the old one answers the rest — the… ## Optional - [Source code](https://github.com/safewords/rainier-framework): the framework's repository - [Search index](https://rainierframework.io/docs/search.json): every section's heading and opening text, as JSON