Django REST Framework-style ViewSets for FastAPI. Register LIST, GET, POST, PUT, PATCH, DELETE from one class. Works with SQLAlchemy (sync/async), Tortoise ORM, and Peewee. Pydantic v2, OpenAPI schemas, pagination, optional OAuth2, and declarative eager loading (select_related / prefetch_related) to kill N+1 — without touching the viewset.
No reviews yetBe the first to leave a review for fastapi-viewsets
Maker
📌
Hey Product Hunt 👋
I'm Alexander — I built fastapi-viewsets because I missed DRF ViewSets when moving APIs to FastAPI.
What it does:
• One class → full CRUD (LIST/GET/POST/PUT/PATCH/DELETE)
• SQLAlchemy sync + async, Tortoise ORM, Peewee via adapters
• Pydantic v2 + auto OpenAPI
• Declarative eager loading via RelatedConfig on schemas (no more N+1 boilerplate)
• limit/offset pagination, optional OAuth2 on selected methods
Install:
pip install fastapi-viewsets
# or with ORM extras:
pip install "fastapi-viewsets[sqlalchemy]"
Repo: https://github.com/svalench/fast...
PyPI: https://pypi.org/project/fastapi...
Would love feedback from FastAPI folks — especially on the multi-ORM adapters and RelatedConfig API. Happy to answer anything in the comments 🚀
Report
this is honestly super useful, i basically wrote something like this by hand a few months ago so wish i had it then. one thing that would be a game changer for me though, would be built in support for soft delete patterns, like a flag in the viewset to automatically filter out is_deleted rows and add a restore endpoint. would save a bunch of boilerplate on every project
Report
Maker
@mihriban1537007 Thanks so much, 🙏 Really glad the DRF ergonomics + async combo resonates.
Soft delete with automatic LIST/GET filtering is a great call — exactly the kind of boilerplate we want to kill. Taking this into the next release backlog and will prototype a built-in hook so you don’t have to override every action.
Will update here (and in the repo) once there’s something to try. Appreciate the thoughtful feedback!
Report
honestly the declarative eager loading is kind of the killer feature for me, basically set the joins on the model and it just handles the rest without me wiring anything custom in the viewset. solid drop
Report
love that you brought DRF's ViewSet ergonomics to FastAPI without losing the async story. one thing that would seal it for me: a built-in hook for soft delete logic that also filters LIST/GET queries automatically, so marking a row as deleted just works across endpoints without me overriding every action.
Report
DRF ViewSets in FastAPI has been a pain point for a while, glad someone packaged this. One thing that would really help adoption: add first-class support for nested routes (like /posts/{id}/comments) that auto-generate the parent lookup and inject the related object into the handler context.
this is honestly super useful, i basically wrote something like this by hand a few months ago so wish i had it then. one thing that would be a game changer for me though, would be built in support for soft delete patterns, like a flag in the viewset to automatically filter out is_deleted rows and add a restore endpoint. would save a bunch of boilerplate on every project
@mihriban1537007 Thanks so much, 🙏 Really glad the DRF ergonomics + async combo resonates.
Soft delete with automatic LIST/GET filtering is a great call — exactly the kind of boilerplate we want to kill. Taking this into the next release backlog and will prototype a built-in hook so you don’t have to override every action.
Will update here (and in the repo) once there’s something to try. Appreciate the thoughtful feedback!
honestly the declarative eager loading is kind of the killer feature for me, basically set the joins on the model and it just handles the rest without me wiring anything custom in the viewset. solid drop
love that you brought DRF's ViewSet ergonomics to FastAPI without losing the async story. one thing that would seal it for me: a built-in hook for soft delete logic that also filters LIST/GET queries automatically, so marking a row as deleted just works across endpoints without me overriding every action.
DRF ViewSets in FastAPI has been a pain point for a while, glad someone packaged this. One thing that would really help adoption: add first-class support for nested routes (like /posts/{id}/comments) that auto-generate the parent lookup and inject the related object into the handler context.