django-rest-framework

The most widely-used toolkit for building Web APIs on top of Django, with serializers, viewsets, and a built-in browsable API.

Framework
PyPI
v3.18.0
30,165stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity100
Maintenance72
Community96
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
90/100Excellent
Architecture92
Code Quality88
Innovation78
Learning Curve100

Django REST Framework (DRF) turns a Django project into a full Web API platform. It layers a serialization system, class-based generic views, viewsets, routers, and pluggable authentication/permission backends on top of Django’s ORM and URL routing, so a ModelViewSet registered with a DefaultRouter can expose a working, browsable CRUD API for a model in a handful of lines.

Beyond CRUD, DRF ships the pieces most APIs eventually need anyway: content negotiation and multiple renderers (JSON, browsable HTML, and custom formats), pagination strategies (page number, limit/offset, cursor), throttling, versioning, an OpenAPI schema generator, and a token-based authtoken app. It’s been the default choice for Python API development since 2011 and remains the reference implementation most other Django API libraries are compared against.

What You Get

  • Serializers (Serializer and ModelSerializer) that validate incoming data and control exactly how model/queryset data is rendered, including nested and hyperlinked relations
  • Generic views and viewsets (ListCreateAPIView, ModelViewSet, etc.) that implement standard list/create/retrieve/update/destroy behavior via composable mixins
  • Routers (SimpleRouter, DefaultRouter) that generate URL confs automatically from registered viewsets, including an optional API root view
  • A browsable API — every endpoint is also viewable as an interactive, styled HTML page in a browser, with forms for POST/PUT/PATCH
  • Pluggable authentication (session, basic, token via the bundled authtoken app) and fine-grained permission classes
  • Pagination (page number, limit/offset, cursor-based), filtering hooks, throttling, and API versioning strategies out of the box
  • An OpenAPI schema generator (rest_framework.schemas) for auto-documenting and exploring the API

Common Use Cases

  • Exposing a Django app’s models as a versioned, paginated JSON API for a separate frontend (React/Vue/mobile) to consume
  • Building internal/admin APIs where the browsable API’s HTML forms let non-frontend engineers exercise endpoints without Postman
  • Adding token-based authentication to a Django backend that also needs to serve a public or partner-facing API
  • Layering custom business validation onto Django models via serializer validate_*/validate() hooks before persisting or returning data
  • Auto-generating OpenAPI schemas for API documentation tools directly from existing viewsets and serializers

Under The Hood

Architecture DRF is layered directly on Django’s class-based view system: views.APIView (rest_framework/views.py) subclasses Django’s View and adds content negotiation, request/response wrapping (rest_framework.request.Request, rest_framework.response.Response), and DRF-specific exception handling; generics.GenericAPIView (rest_framework/generics.py) adds queryset/serializer resolution and pagination on top of that; and the mixins in rest_framework/mixins.py (CreateModelMixin, ListModelMixin, etc.) implement the actual list/create/retrieve/update/destroy logic as small, composable classes that generic views and viewsets.ModelViewSet (rest_framework/viewsets.py) combine. Routers (rest_framework/routers.py) close the loop by introspecting registered viewsets and generating Django URL patterns, including an auto-generated API root. Because each layer only depends on the interface of the layer below (queryset/serializer_class attributes, get_serializer(), get_queryset()), swapping the serializer, pagination, or permission classes on a view doesn’t require touching the routing or mixin layer — the design that makes DRF’s generic views composable rather than a single monolithic base class.

Tech Stack Pure Python 3.10+ with a single hard dependency on Django 5.2/6.0/6.1 (pyproject.toml) — no other runtime dependencies. Optional extras cover common integration points: django-filter for queryset filtering, django-guardian for per-object permissions, markdown and pygments for the browsable API’s documentation rendering, psycopg for Postgres, and pyyaml/uritemplate for the OpenAPI schema tooling. The project builds with setuptools and ships its own authtoken Django app (rest_framework/authtoken/) as a self-contained token-auth add-on with its own models, migrations, and admin registration.

Code Quality The test suite (tests/) contains over 1,300 test functions across 60+ files covering authentication, serializers, pagination, permissions, filtering, model inheritance edge cases, and the browsable API renderer, run via pytest-django against a real Postgres service in CI across the Python 3.10–3.14 matrix (.github/workflows/main.yml). Pre-commit hooks (isort, flake8 with flake8-bugbear and flake8-tidy-imports, pyupgrade, django-upgrade, codespell) enforce style and catch common Django-upgrade issues before merge. The codebase favors extensive docstrings over static type hints — mypy/pyright are not part of the toolchain — but naming and error-handling (explicit assert guards with descriptive messages in generics.py, structured APIException subclasses in exceptions.py) are consistent throughout.

What Makes It Unique The defining feature that sets DRF apart from comparable API layers is the browsable API itself — every endpoint renders as an interactive HTML page with real input forms for POST/PUT/PATCH, generated automatically from the same serializer that handles JSON, with no extra code from the API author. Combined with the composable mixin/generic-view architecture (each CRUD behavior is a standalone mixin rather than baked into one base class) and a router layer that derives full URL confs from viewset registrations, DRF lets a team go from a Django model to a documented, browsable, authenticated API surface with comprehensive but incremental customization at every layer.

Used by 15 apps in this directory

Python
56%
Other

authentik

Authentication · Security

25,385

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
Python56%
TypeScript34%
Updated yesterday
Python
68%
Other

Baserow

No Code Platforms · Databases

5,830

Open-source no-code platform to build databases, apps, automations, and AI agents — self-hosted or cloud, with full data ownership.

View details
89
Repo Health
84
Technical
68
Dependency
Built with
Python68%
JavaScript16%
Vue12%
Updated yesterday
Python
83%
Other

Bugsink

Developer Tools · Monitoring

2,056

Self-hosted error tracking that accepts Sentry SDKs out of the box, so you keep your instrumentation and drop the monthly bill.

View details
84
Repo Health
80
Technical
71
Dependency
Built with
Python83%
HTML15%
Updated 3 days ago
Python
50%
MIT

Docs

File Storage · CMS

16,788

Open-source collaborative knowledge platform with real-time editing, AI writing tools, and full self-hosting control — built by the French and German governments.

View details
88
Repo Health
81
Technical
71
Dependency
Built with
Python50%
TypeScript42%
Updated yesterday
Python
63%
BSD 3

Flagsmith

Developer Tools · Devops · Ab Testing Experimentation

6,539

Open-source feature flagging, remote config, and A/B/multivariate testing platform for web, mobile, and server-side apps — self-host or use the hosted SaaS.

View details
90
Repo Health
82
Technical
63
Dependency
Built with
Python63%
TypeScript31%
Updated 2 days ago
HTML
46%
LGPL-2.1

Horilla

Human Resources · ERP

1,356

Open-source HRMS covering recruitment, attendance, payroll, and biometrics in one self-hosted Django application.

View details
88
Repo Health
60
Technical
65
Dependency
Built with
HTML46%
Python38%
JavaScript12%
Updated yesterday
TypeScript
38%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,222

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
TypeScript38%
JavaScript27%
Python25%
Updated today
Python
65%
MIT

LibrePhotos

File Storage

8,061

Self-hosted photo library with AI-powered face recognition, semantic search, and automatic event albums — no cloud required.

View details
82
Repo Health
78
Technical
66
Dependency
Built with
Python65%
TypeScript32%
Updated 2 days ago
Python
45%
GPL 3.0

MaxKB

AI Development · Knowledge Management

22,727

Build enterprise-grade AI agents with RAG, workflows & multi-modal support

View details
91
Repo Health
68
Technical
66
Dependency
Built with
Python45%
Vue37%
TypeScript17%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search