Rustango docs
← Getting started

Common tasks

Short answers to "how do I …?". Each answer is one line and links to the page with the code. The pages assume the app from Getting started.

Some tasks have no complete, copy-and-run example yet. Those rows link the closest page and say "(complete example coming)".

Table of contents

Tasks

TaskAnswerRead
Sign up a userCheck the password with passwords::strength_score, hash it with passwords::hash, and store the hash on the user row.Getting started, Step 14 · Hashing on signup
Log inCheck the password with passwords::verify, then start a session or issue a JWT.Getting started, Step 14 · Verifying on login · Sessions
Reset a passwordPasswordReset::issue makes a signed link to email; confirm_password_reset_pool checks it and stores the new hash.Password reset (complete example coming)
Upload a filesave_uploads checks the file and writes it to a Storage; you save the returned key on a model.Upload an avatar, end to end
Send an emailBuild an Email, pick a mailer, and call email.send(&mailer).Sending email
Run a background jobImplement Job, register it on a queue, start the queue, and dispatch from a handler.Background jobs
Test a viewWrap your router in TestClient and send requests in process, with no server.Testing
DeploySet RUSTANGO_ENV=prod, run migrate and check --deploy, then build with cargo build --release.Getting started, Step 18 · Auditing before you deploy

More recipes: the cookbook

The cookbook is a runnable blog app with recipes for models, the ORM, migrations, the admin, REST APIs, multi-tenancy and more. The recipes are backed by tests. For multi-tenancy itself, start with Multi-tenancy.