StackShareStackShare
Follow on
StackShare

Discover and share technology stacks from companies around the world.

Follow on

© 2025 StackShare. All rights reserved.

Product

  • Stacks
  • Tools
  • Feed

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  1. Stackups
  2. Application & Data
  3. Microframeworks
  4. Microframeworks
  5. Django REST framework vs GraphQL

Django REST framework vs GraphQL

OverviewDecisionsComparisonAlternatives

Overview

Django REST framework
Django REST framework
Stacks1.9K
Followers2.1K
Votes312
GraphQL
GraphQL
Stacks34.9K
Followers28.1K
Votes309

Django REST framework vs GraphQL: What are the differences?

Introduction

Django REST framework and GraphQL are two popular technologies used for building APIs in web applications. While both serve the purpose of creating APIs, they have significant differences in their approach and functionality. In this article, we will highlight the key differences between Django REST framework and GraphQL.

  1. Data Fetching: In Django REST framework, data is fetched using traditional RESTful principles, where each endpoint corresponds to a specific URL and HTTP method. The client explicitly requests the exact data it needs. On the other hand, GraphQL allows the client to specify the shape and structure of the response it expects. The client can request multiple resources and customize the data structure in a single request, reducing the number of round trips required.

  2. Flexibility and Overfetching/Underfetching: Django REST framework follows a predefined structure, where the server defines the structure of the response. This can lead to overfetching (receiving more data than needed) or underfetching (not receiving enough data), especially when dealing with complex data relationships. In contrast, GraphQL gives clients the power to request only the required fields, avoiding overfetching and underfetching issues. It allows clients to precisely define the shape of the response, reducing unnecessary data transmission.

  3. Backend Agnostic: Django REST framework is tightly coupled with Django, a popular Python web framework. It seamlessly integrates with Django models and follows the Django development patterns. GraphQL, on the other hand, is backend-agnostic, which means it can be used with any programming language or framework. This flexibility allows developers to easily integrate GraphQL with their existing backend systems.

  4. Versioning and Evolution: In Django REST framework, versioning APIs is typically done by appending a version number to the URL. This approach can lead to URL proliferation and version management issues. GraphQL, on the other hand, provides a built-in solution for versioning and evolution. The schema-first approach allows adding new fields and deprecating existing fields without breaking the existing queries. Clients can work with a single version of the schema while still benefiting from the capabilities offered by the updated schema.

  5. Caching and Performance: Django REST framework provides built-in support for HTTP caching, allowing clients to cache responses and improve performance. It utilizes HTTP headers like ETags and Last-Modified to control caching behavior. GraphQL, being transport-agnostic, doesn't have built-in support for caching. However, it provides flexibility in implementing caching strategies tailored to specific use cases. Caching in GraphQL can be implemented at various levels, such as per field, query, or operation, based on the nature of the data and client requirements.

  6. Tooling and Ecosystem: Django REST framework has a mature ecosystem and extensive built-in support for common features like authentication, serialization, pagination, and filtering. It provides comprehensive documentation, extensive libraries, and a wide user community. GraphQL, although relatively newer, has been gaining popularity rapidly. It also has a growing ecosystem with tools like relay, Apollo, and GraphiQL. GraphQL offers powerful developer tooling with its introspection capabilities, which allow clients to query the schema and understand the available fields and types.

In Summary, Django REST framework and GraphQL differ in their approach to data fetching, flexibility, backend compatibility, versioning, caching, and tooling. While Django REST framework adheres to REST principles and is tightly coupled with Django, GraphQL provides more flexibility, precise data retrieval, backend-agnostic support, schema evolution capabilities, and versatile caching strategies. Both technologies have their own strengths and are suited for different use cases.

Share your Stack

Help developers discover the tools you use. Get visibility for your team's tech choices and contribute to the community's knowledge.

View Docs
CLI (Node.js)
or
Manual

Advice on Django REST framework, GraphQL

Kristan Eres
Kristan Eres

Senior Solutions Analyst

Jul 30, 2020

Needs adviceonDjangoDjangoPythonPythonFlaskFlask

My journey to developing REST APIs started with Flask Restful, and I've found it to be enough for the needs of my project back then. Now that I've started investing more time on personal projects, I've yet to decide if I should move to use Django for writing REST APIs. I often see job posts looking for Python+Django developers, but it's usually for full-stack developers. I'm primarily interested in Data Engineering, so most of my web projects are back end.

Should I continue with what I know (Flask) or move on to Django?

392k views392k
Comments
Saurav
Saurav

Application Devloper at Bny Mellon

Mar 27, 2020

Needs advice

I have just started learning Python 3 weeks ago. I want to create a REST API using python. The API will be used to save form data in an Oracle database. The front end is using AngularJS 8 with Angular Material. In python, there are so many frameworks to develop REST APIs.

I am looking for some suggestions which REST framework to choose?

Here are some features I am looking for:

  • Easy integration and unit testing, like in Angular. We just want to run a command.

  • Code packaging, like in java maven project we can build and package. I am looking for something which I can push in as an artifact and deploy whole code as a package.

  • Support for swagger/ OpenAPI

  • Support for JSON Web Token

  • Support for test case coverage report

Framework can have features included or can be available by extension. Also, you can suggest a framework other than the ones I have mentioned.

337k views337k
Comments
Raj
Raj

Oct 10, 2020

Review

It purely depends on your app needs. Does it need to be scalable, do you have lots of features, OR it is a simple project with very simple needs - many of those parameters clarify which technologies will fit.

If you are looking for a quick solution, that reduces lot of development time, take a look at postgraphile (https://www.graphile.org/postgraphile/). You have to just define the schema and you get the entire graph-ql apis built for you and you can just focus on your frontend.

On frontend, React is good, but also need to remember that it is popular because it introduced one way data writes and in-built virtual dom + diffing to determine which dom to modify. Though personally I liked it, am recently more inclined to Svelte because its lightweightedness and absence of virtual dom and its simplicity compared to the huge ecosystem that React has surrounded itself with.

In all situations, frameworks keep changing over time. What is best today is not considered even good few years from now. What is important is to have the logic in a separate, clean manner void of too many framework related dependencies - that way you can switch one framework with another very easily.

3.77k views3.77k
Comments

Detailed Comparison

Django REST framework
Django REST framework
GraphQL
GraphQL

It is a powerful and flexible toolkit that makes it easy to build Web APIs.

GraphQL is a data query language and runtime designed and used at Facebook to request and deliver data to mobile and web apps since 2012.

The Web browsable API is a huge usability win for your developers.;Authentication policies including OAuth1a and OAuth2 out of the box.;Serialization that supports both ORM and non-ORM data sources.;Customizable all the way down - just use regular function-based views if you don't need the more powerful features.;Extensive documentation, and great community support.;Used and trusted by large companies such as Mozilla and Eventbrite.
Hierarchical;Product-centric;Client-specified queries;Backwards Compatible;Structured, Arbitrary Code;Application-Layer Protocol;Strongly-typed;Introspective
Statistics
Stacks
1.9K
Stacks
34.9K
Followers
2.1K
Followers
28.1K
Votes
312
Votes
309
Pros & Cons
Pros
  • 67
    Easy to use
  • 65
    Browsable api
  • 53
    Great documentation
  • 51
    Customizable
  • 42
    Fast development
Cons
  • 2
    Reimplements Django functionality
  • 2
    Bad documentation
  • 1
    No support for URL Namespaces
  • 0
    Bad CSRF handling
Pros
  • 75
    Schemas defined by the requests made by the user
  • 63
    Will replace RESTful interfaces
  • 62
    The future of API's
  • 49
    The future of databases
  • 12
    Self-documenting
Cons
  • 4
    More code to type.
  • 4
    Hard to migrate from GraphQL to another technology
  • 2
    Takes longer to build compared to schemaless.
  • 1
    All the pros sound like NFT pitches
  • 1
    Works just like any other API at runtime
Integrations
Rollbar
Rollbar
Sentry
Sentry
Django
Django
Stream
Stream
Kloudless
Kloudless
No integrations available

What are some alternatives to Django REST framework, GraphQL?

Node.js

Node.js

Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Rails

Rails

Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Django

Django

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

Laravel

Laravel

It is a web application framework with expressive, elegant syntax. It attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.

.NET

.NET

.NET is a general purpose development platform. With .NET, you can use multiple languages, editors, and libraries to build native applications for web, mobile, desktop, gaming, and IoT for Windows, macOS, Linux, Android, and more.

ASP.NET Core

ASP.NET Core

A free and open-source web framework, and higher performance than ASP.NET, developed by Microsoft and the community. It is a modular framework that runs on both the full .NET Framework, on Windows, and the cross-platform .NET Core.

ExpressJS

ExpressJS

Express is a minimal and flexible node.js web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications.

Symfony

Symfony

It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP..

Spring

Spring

A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

Spring Boot

Spring Boot

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

Related Comparisons

Bootstrap
Materialize

Bootstrap vs Materialize

Laravel
Django

Django vs Laravel vs Node.js

Bootstrap
Foundation

Bootstrap vs Foundation vs Material UI

Node.js
Spring Boot

Node.js vs Spring-Boot

Liquibase
Flyway

Flyway vs Liquibase