Needs advice
on
Django REST frameworkDjango REST framework
and
FastAPIFastAPI

Not sure if we should use DRF or FastAPI. I hear many good things about FastAPI, but it doesn't seem to have a big community. Most important things for us: - speed - ease of development - scalability & security

We're likely going to use MongoDB, so not sure if that changes anything. Would appreciate any help!

READ LESS
5 upvotes·62.2K views
Replies (4)

I've used both in production.

Simply put: if there's a relational database or it's more than just a handful of endpoints, Django REST Framework is the way to go.

FastAPI is like Flask in that it shines where you want it to do very little for you. If you want it to do a lot for "free", the Django-verse is and will continue to be better.

Last of all, I'll add that we refactored away from FastAPI to just use Starlette under the hood, because FastAPI pretty much assumes you want a REST API, and when don't want a REST API, you begin fighting with it.

READ MORE
2 upvotes·16.3K views
Full Stack Engineer-Freelancer at HemansAI·
Recommends
on
FastAPI

I have worked with both frameworks, for your use case I would recommend using FastAPI. DRF, is no doubt an amazing framework and makes various things easy, but Django's MongoDB support is not that good currently, and since its a big framework, there are various things DRF and Django automatically do when you are using their predefined backend engines, which is not in the case of the MonoDB a NoSQL db. FastAPI will give you the flexibility and speed, for the community front, its also growing quite well there.

READ MORE
5 upvotes·1 comment·30.2K views
dagrimm
dagrimm
·
June 4th 2021 at 9:03AM

I think you ask the wrong questions. "Most important things - speed - ease of development - scalability & security" are more ops related tasks and can be handled by both frameworks well. You should ask what the framework should do - fastAPI is perfect for REST APIs, DRF is a REST framework on top of Django. So, if you have an application, where you build a user management system, CRM, analytics, etc. and you want to have a REST API on top of the monolithic backend, DRF might suit you well. If you are about smaller services with the focus on the REST part, fastAPI might fit you better. On the Mongo part, I agree that DRF is opinionated towards relational databases.

·
Reply
View all (4)
Avatar of Robert Roskam