Examples#

The repository includes complete applications under example-projects/. They show different levels of Restly adoption, from a tiny resource to a production-shaped service with shared view foundations and custom behavior.

Starter#

example-projects/starter is exactly what restly new myapp writes with its default answers: async views, PostgreSQL, and Alembic. Read it to see the prescribed layout at its smallest; a check in CI keeps it identical to the generator’s output. It depends on the released framework rather than this checkout, so local changes to Restly do not appear in it.

Blog#

example-projects/blog (README) is the smallest example: one model, one view, sync SQLAlchemy sessions, and auto-generated schemas. Use it as a smoke test or as the shortest path from an empty app to a working REST resource.

Shop#

example-projects/shop (README) shows relationships, multiple primary-key styles, async sessions, and React-Admin-compatible endpoints through AsyncReactAdminView. It also includes a small React Admin frontend wired against the API. These patterns are covered in React Admin Integration and Work with Foreign Keys and Relationships.

SaaS#

example-projects/saas (README) is the most complete example: a multi-tenant project management API with permission patterns, shared base views, mixins, custom create/update schemas, query modifiers, and Alembic migrations. Its runtime uses PostgreSQL through asyncpg, Pydantic settings, and an application-owned async engine. Compose provides separate development and test databases, and the Restly test fixtures build their schema from the checked-in migrations. It also builds a substantial non-CRUD surface on the same views. Each view lives beside its model and schemas in a subject package under example-projects/saas/app/, the layout Project structure describes. The routes below highlight the patterns involved:

Route

Pattern it demonstrates

POST /tasks/{id}/start / complete / reopen

State transitions via write_action on a RestView

POST /tasks/bulk, /tasks/bulk-delete, /tasks/import-csv

Per-row savepoints inside one shared_write_action_commit() block

POST /projects/{id}/clone

A project, its outbox event, and copied tasks committed together

POST /uploads + GET /uploads/{id}/lines

A file-upload flow with a custom create bracket

POST /task-labels/create-and-attach

Two rows committed through one write_action block

POST /users/{id}/change-password, GET /users/me

Account actions and a non-resource read

These patterns are covered in Compose Views with Mixins, Share Behaviour with Base Views, Customizing RestView, and Patterns.

Running them#

Each project is self-contained: run uv sync in its directory, then use the commands in its README (linked above).

The SaaS example also needs PostgreSQL. Its README includes the complete Compose, migration, application, and test commands.

To build one of these yourself, start with Getting Started and Build a Blog API.