FastAPI-Restly#
FastAPI-Restly (fr) is a framework that supplements FastAPI with instant CRUD endpoints, built on SQLAlchemy 2.0 and Pydantic v2.
FastAPI-Restly implements true class-based views — real Python classes that support inheritance and method overrides. Share common behavior across views by subclassing, and override individual CRUD methods without touching the rest.
Quick Start#
Zero-boilerplate mode (auto-schema)#
import fastapi_restly as fr
from fastapi import FastAPI
from sqlalchemy.orm import Mapped
app = FastAPI()
# Setup database
fr.configure(async_database_url="sqlite+aiosqlite:///app.db")
# Define your models
class User(fr.IDBase):
name: Mapped[str]
email: Mapped[str]
# Create instant CRUD endpoints
@fr.include_view(app)
class UserView(fr.AsyncRestView):
prefix = "/users"
model = User
Explicit schema mode#
class UserSchema(fr.IDSchema):
name: str
email: str
@fr.include_view(app)
class UserView(fr.AsyncRestView):
prefix = "/users"
model = User
schema = UserSchema
Use auto-schema when you want speed and low boilerplate. Use explicit schemas when you need strict public API contracts, custom validation, aliases, or field-level serialization control.
Features#
Instant CRUD endpoints — GET, POST, PATCH, DELETE with zero boilerplate
True class-based views — Real inheritance and method overrides; share logic across views by subclassing
SQLAlchemy 2.0 support — Async-first with modern patterns
Pydantic v2 integration — Full validation and serialization
Automatic schema generation — Create and update schemas generated automatically
Query modifiers — Easy filtering, sorting, and pagination
Relationship support — Handle foreign keys and nested objects
Testing utilities — Built-in test helpers with savepoint isolation
Documentation#
Fast path from zero to a working CRUD API.
Tutorial walkthroughs and in-depth topic guides covering every framework feature.
Generated endpoints, all public symbols, query parameters, and autodoc.
Installation#
git clone https://github.com/rjprins/fastapi-restly.git
cd fastapi-restly
uv sync
Development#
git clone https://github.com/rjprins/fastapi-restly.git
cd fastapi-restly
uv sync
uv run pytest