r/FastAPI • u/igorbenav • Jul 02 '25
feedback request The one FastAPI boilerplate to rule them all
Hey, guys, for anyone who might benefit (or would like to contribute - good starting point for newbies)
For about 2 years I've been developing this boilerplate (with a lot of help from the community - 20 contributors) and it's pretty mature now (used in prod by many). Latest news was the addition of CRUDAdmin as an admin panel, plus a brand new documentation to help people use it and understand design decisions.
- Github: https://github.com/benavlabs/FastAPI-boilerplate
- Docs: https://benavlabs.github.io/FastAPI-boilerplate/
Main features:
- Pydantic V2 and SQLAlchemy 2.0 (fully async)
- User authentication with JWT (and cookie based refresh token)
- ARQ integration for task queue (way simpler than celery, but really powerful)
- Builtin cache and rate-limiting with redis
- Several deployment specific features (docs behind authentication and hidden based on the environment)
- NGINX for Reverse Proxy and Load Balancing
- Easy and powerful db interaction (FastCRUD)
Would love to hear your opinions and what could be improved. We used to have tens of issues, now it's down to just a few (phew), but I'd love to see new ones coming.
Note: this boilerplate works really well for microservices or small applications, but for bigger ones I'd use a DDD monolith. It's a great starting point though.
25
u/Trinkes Jul 02 '25
Do people group stuff like models, schemas, apis, etc together or by feature? It seems to me that everything together doesn't scale that well.
24
u/Drevicar Jul 03 '25
I’m beginning to think there are more FastAPI boilerplate templates than production apps written in FastAPI.
8
u/mspaintshoops Jul 02 '25
So, first off, this is really cool and even if I don’t end up getting a ton of use from it it’s nice to see a mature example of an API like this. Well done!
Now, my main question is this: at what point should someone use Django? Or, why this instead of Django?
I’m seeing
I mean, it’s great to see all of this in a FastAPI-centric application. But if someone is needing to design an application with all of these components nine times out of ten the move is to use Django.
7
u/_JohnWisdom Jul 02 '25
about to insult and make fun. Project is well written and really useful for many. I’m a firestore/redisearch type of guy, but still can grab some ideas from this clean codebase ^ cheers, congrats and thanks for sharing!
3
u/Effective-Total-2312 Jul 03 '25
Very nice ! I would perhaps make some comments (nothing crazy so far, but noticed some things I usually do in a different way and personally think it's better), but I would need to take more than 5 minutes to take a good look.
Just for reference, what's your background/experience ?
3
u/Independent_Hour_301 Jul 03 '25
Looks very neat! Thanks for sharing.
2
u/[deleted] Jul 03 '25
Hi do you have an observabitily stack of services to go with this boilerplate?
2
u/[deleted] Jul 03 '25
If u like, I’d recommend checking FastAPI guard for auth and etc.
In personal projects I like to use libraries that works with Pydantic like FastStream, redis_om, SQLModel (From FastAPI’s creator), PydanticAI, Reflex, FastDepends, etc etc
2
u/FZambia Jul 04 '25
What do you think about an optional integration with Centrifugo - https://github.com/centrifugal/centrifugo - for real-time messaging tasks (WebSocket)? It integrates with Python apps very well, for example here is how to make an efficient messenger app with Django - https://centrifugal.dev/docs/tutorial/intro
And the stack you are using in the boilerplate is exactly the one Centrifugo works best with (Redis, PG) and provides the most value for.
I'll help as much as I can if this will be interesting to you.
2
u/grimscythe_ Jul 04 '25
Just briefly looked through the code and the docs. This is some solid work here, a bit unusual in this day and age to actually have someone present something useful and mature enough to be used in prod.
Well done 👍👍👍
Once I'll find some time I'll take this for a spin.
2
u/sugarfreecaffeine Jul 13 '25
I’m using this to build a mobile app as we speak. Just wanted to say ty for this! I was confused at first but getting the hang how everything is out together.
1
u/[deleted] Jul 23 '25
This looks very much similar to the template provided by fastapi in their resources section. https://github.com/fastapi/full-stack-fastapi-template
1
u/[deleted] Jul 05 '25
Ill give it a go over the weekend. :)
1
u/jhamwee Dec 28 '25
What was your reasoning behind choosing SQLAlchemy + Pydantic rather than using SQLModel?
I’m impartial to both but curious as to why you don’t use the latter.