// the find
SakaDream/actix-web-rest-api-with-jwt
A simple CRUD backend app using Actix-web, Diesel and JWT
A CRUD REST API template built with Actix-web 4, Diesel ORM, and JWT authentication, using PostgreSQL as the backing store. It demonstrates the full auth flow (signup/login/logout with session tracking) plus paginated, filterable CRUD on an address book entity. Aimed at developers learning the Rust web stack who want a working reference rather than a toy hello-world.
Session invalidation is actually implemented — logout writes to a `login_history` table and middleware checks it, which most JWT tutorials skip entirely. Diesel migrations are versioned and committed, so the schema is reproducible rather than applied by hand. Pagination and multi-field filtering on the list endpoint are built in from the start, not bolted on. Docker Compose files for both local and prod environments are included and the repo ships pre-built Windows Postgres DLLs, which removes the most common Windows setup friction.
Last substantive activity is from 2019–2020 with a cosmetic update in 2024; it predates Actix-web 4's async-native patterns and Diesel 2.x breaking changes, so you will hit compilation errors on current toolchains without manual fixes. The secret key is read from a flat file on disk (`secret.key`) rather than an environment variable or secrets manager — a footgun in any real deployment. Error handling collapses almost everything into a 500 with a generic message, giving callers no actionable information and making debugging painful. The `gender` field is a boolean mapped as `true = male / false = female`, which is the kind of data model decision that causes a migration and a refactor the moment requirements touch reality.