How-To Guides#
These guides are task-focused: each one shows how to accomplish a specific goal with FastAPI-Restly. If you are new to the framework, start with Getting Started, then the Tutorial, and come back here when you have a concrete task.
Adopting and Modeling#
These guides cover bringing Restly into a codebase and defining the models and schemas it works from.
Adopt Restly beside existing FastAPI routes, then wire it into your sessions and models.
Define schemas with field aliases, write-only fields, and read-only computed fields.
Check foreign-key columns with MustExist and resolve relationships with IDRef or IDSchema, with a 404 on missing rows.
Shaping Requests and Responses#
These guides control what list endpoints accept and what your API returns, including errors.
Wrap successful responses in {data} envelopes and add list metadata such as
total counts, while keeping Restly’s handlers and serialization.
Load nested relationships for responses on reads and writes, extend the loaded
set, and resolve MissingGreenlet on async sessions.
Filter, sort, and paginate list endpoints using URL query parameters.
Learn the typed fr.exc exceptions to raise from overrides, the 422-vs-400
split, and app-wide error envelopes (problem+json).
Customizing Views#
These guides change what the generated views do, from overriding a single method to sharing behaviour across many views.
Find the idiomatic answers for nested resources and sub-resources, a different list schema, restoring soft-deleted rows, webhook receivers, login flows, custom actions, and tenant scoping.
Use Python inheritance to share CRUD overrides, dependencies, URL prefixes, and access control across multiple views.
Layer cross-cutting concerns (tenant scoping, soft delete, audit stamping) through cooperative mixins.
Use IDSchema, optional view generics, and typed CRUD methods without
fighting the framework.
Operating and Testing#
These guides connect the API to the outside world: frontends, OpenAPI consumers, tests, and production deployment.
Use AsyncReactAdminView to get a backend that ra-data-simple-rest connects to out of the box.
Set per-view tags and responses, add metadata to custom routes, replace a
generated route’s documented contract, and use x-resource-ref.
Start from a copy-paste conftest, work with savepoint-isolated fixtures, and consult the full fixture reference.
Configure a production engine, set up Alembic migrations, and follow an ASGI checklist.