Our Production Stack
At Qubions, our go-to stack is Django REST Framework for APIs and Next.js for frontends. We've shipped multiple production applications on this stack, and this post shares the patterns that actually work at scale.
Database Performance
PostgreSQL is our database of choice. The two things that have the biggest impact on query performance:
- Proper indexing: Use django-extensions'
show_urlsanddjango-debug-toolbarto find slow queries, then add targeted indexes. - select_related / prefetch_related: The N+1 problem is real. We audit every queryset in our serializers.
Caching Strategy
Redis sits between Django and the database for frequently accessed data. We use Django's cache framework with a per-view cache for API responses and a low-level cache for expensive computations. Cache invalidation follows a simple rule: invalidate on write, never on read.
Frontend Performance
Next.js App Router's server components are a game-changer. We fetch data server-side, stream HTML to the client, and hydrate only interactive components. This gives us sub-second LCP scores consistently.
DevOps
Everything runs in Docker containers orchestrated by Docker Compose (development) and deployed via CI/CD. Health checks, automatic restarts, and volume mounts for persistent data. Simple, reliable, reproducible.