FastCRUD is a Python package that adds async CRUD helpers and optional auto-generated REST endpoints on FastAPI. It targets SQLAlchemy 2.0 and Pydantic v2 data models.
Overview
FastCRUD streamlines database-backed APIs by wrapping common create, read, update, and delete patterns for async SQLAlchemy sessions. Teams can mount a crud_router to get documented REST routes quickly, or call FastCRUD methods inside hand-written FastAPI routes for finer control.
Query features include dynamic filtering with operator syntax, sorting, joins with auto-detected join conditions, offset pagination, and cursor pagination for large lists. The design is modular so projects extend or override behavior without forking the whole stack.
SQLModel can replace separate SQLAlchemy models and Pydantic schemas where teams prefer a single class definition. Documentation notes aggregates, CTEs, bulk writes, and heavy analytics as cases better handled with raw SQLAlchemy instead of FastCRUD helpers.
A bundled Agent Skills file teaches coding agents the recommended setup pattern, pagination defaults, and filter operators when generating FastAPI data layers.
Key features
- Fully async database operations
- SQLAlchemy 2.0 and SQLModel support
- Auto-generated CRUD routers
- Dynamic filters and sorting
- Join queries with auto conditions
- Offset and cursor pagination
- Direct use inside custom routes
- Bundled AI agent skill guidance
Use cases
- Rapid FastAPI resource endpoints
- Admin APIs over relational data
- Infinite-scroll list backends
- Prototype services with SQLite
- Standardized CRUD in larger apps