Choosing between Django REST Framework, FastAPI, and Django Ninja for API development

I’m trying to decide which Python framework to use for my next project and could use some advice. I work with Django and GraphQL daily, but I’m curious about other options for building APIs.

My project requirements:

  • CRUD operations with database integration
  • Chat functionality using AI models
  • React frontend (API-only backend needed)
  • BigQuery integration for analytics
  • No admin interface required

Django Ninja looks promising for my needs, but I’m concerned about the maintenance situation. It seems to rely heavily on a single developer, and there’s already a community fork called Django Shinobi due to update delays.

FastAPI caught my attention initially. However, I’m unsure about the ORM ecosystem. The documentation suggests SQLModel, but I’m wondering if options like Tortoise or SQLAlchemy are as robust as Django’s built-in ORM.

Django REST Framework is the safe choice with proven stability. My main concern is whether the async limitations will affect performance when working with AI models and external API calls.

Has anyone worked with these frameworks in similar scenarios? What are your experiences with their performance and developer experience?

Update: Several people mentioned Litestar with SQLAlchemy. What advantages does this combination offer compared to the frameworks I’m considering?

Wait, you’re already comfortable with django and graphql but thinking of switching? What’s pushing you to change? Are you hitting performance issues or just exploring? fastapi’s async features could help with ai model calls, but I’m curious what limitations you’re facing with your current setup.

djanog ninja’s solid despite the maintainer concerns - i’ve been using it 6 months and it’s way cleaner than drf. performance difference with ai calls won’t be noticeable unless you’re handling thousands of requests. tortoise orm’s decent but django’s orm is more mature.

I’d go with FastAPI and SQLAlchemy for what you’re building. The async support is huge when you’re dealing with AI models and external APIs like BigQuery. Sure, Django’s ORM is solid, but SQLAlchemy handles async way better. Your Django Ninja concerns are spot on - the maintenance situation is sketchy. We had security patches delayed in production and had to migrate because of it. Having one maintainer is a real business risk. For chat with AI models, FastAPI’s async handling saves you from the bottlenecks you’d hit with DRF. Makes a big difference when you’re juggling multiple AI API calls per request. SQLModel gives you great type safety while keeping SQLAlchemy’s power. The switch from Django to FastAPI isn’t too brutal, especially since you’re already deep into APIs. Plus the automatic OpenAPI docs make React integration much cleaner.