wemake-services/django-modern-rest

Modern REST framework for Django with types and async support!

Python

1,486

1,275 commits

updated Oct 1, 2026

See the code

See what people are saying

SourceMessageScoreDate

Django-modern-rest 0.16.0 release

4

Oct 1, 2026

README

Modern REST Logo - Light

Modern REST framework for Django with types and async support!

wemake.services Modern REST Tests Result Codecov No AI slop PyPI Downloads Supported Python Version Code Style Ask DeepWiki Telegram group

Features

  • Blazingly fast
  • Supports async Django without any sync_to_async / async_to_sync calls inside, tested to work with free-threading builds
  • Supports pydantic2, msgspec, attrs, dataclasses, TypedDict as model schemas, but not bound to any of these libraries
  • Fully typed and checked with mypy, pyright, ty, and pyrefly in strict modes
  • Supports content negotiation, has default implementations for json, msgpack, SSE, Json Lines, and more
  • Strict schema validation of both requests and responses, including errors
  • Supports OpenAPI 3.1 / 3.2 semantic schema generation out of the box
  • Supports all your existing django primitives and packages, no custom runtimes
  • Great testing tools with schemathesis, polyfactory, tracecov, bundled pytest plugin, and default Django's testing primitives
  • 100% test coverage with 4000+ of carefully designed unit, integration, typing, and property-based tests on different databases and caches
  • High security standards
  • Built by the community for the community, not a single-person project
  • Great docs
  • No AI slop, but built for the LLM era
  • No emojis 🌚️️

Benchmark - Light

Sync mode

Testimonials

The one thing I really love about django-modern-rest is its pluggable serializers and validators. Frameworks that are tightly coupled with pydantic can be really painful to work with.

— Kirill Podoprigora, CPython core developer

Using django-modern-rest has been a game-changer for my productivity. The strict type safety and schema validation for both requests and responses mean I spend less time debugging and more time building.

— Josiah Kaviani, Django core developer

I rarely see frameworks that treat their OpenAPI schema as a first-class citizen. django-modern-rest not only generates a schema that accurately reflects your code, but also gives you the tools to verify it.

— Dmitry Dygalo, author of Schemathesis

Installation

Works for:

  • CPython 3.11+ or PyPy 3.11+
  • Django 5.0, 5.1, 5.2, 6.0, 6.1
pip install django-modern-rest

There are several included extras:

  • 'django-modern-rest[msgspec]' provides msgspec support and the fastest json parsing, recommended to be always included
  • 'django-modern-rest[pydantic]' provides pydantic support
  • 'django-modern-rest[attrs]' provides attrs support
  • 'django-modern-rest[jwt]' provides pyjwt auth support
  • 'django-modern-rest[openapi]' provides OpenAPI schema validation, yaml OpenAPI view, and generates better OpenAPI examples with polyfactory

Example

The shortest example (click here to copy the whole file):

>>> import uuid
>>> import pydantic
>>> from dmr import Body, Controller, Headers
>>> # Or use `dmr.plugins.msgspec` or write your own!
>>> from dmr.plugins.pydantic import PydanticFastSerializer

>>> class UserCreateModel(pydantic.BaseModel):
...     email: str

>>> class UserModel(UserCreateModel):
...     uid: uuid.UUID
...     consumer: str

>>> class HeaderModel(pydantic.BaseModel):
...     consumer: str = pydantic.Field(alias='X-API-Consumer')

>>> class UserController(Controller[PydanticFastSerializer]):
...     async def post(  # <- can be sync as well!
...         self,
...         parsed_body: Body[UserCreateModel],
...         parsed_headers: Headers[HeaderModel],
...     ) -> UserModel:
...         """All added props have the correct runtime and static types."""
...         return UserModel(
...             uid=uuid.uuid4(),
...             email=parsed_body.email,
...             consumer=parsed_headers.consumer,
...         )

And then route this controller in your urls.py:

>>> from django.urls import path
>>> from dmr.routing import Router

>>> router = Router(
...     'api/',
...     [
...         path('user/', UserController.as_view(), name='users'),
...     ],
... )
>>> urlpatterns = [
...     router.to_urlpatterns(namespace='api'),
... ]

Done! Now you have your shiny API with 100% type safe validation and interactive docs.

Next steps:

Contributors

Contributors

License

MIT

Credits

This project was generated with wemake-python-package. Current template version is: e1fcf312d7f715323dcff0d376a40b7e3b47f9b7. See what is updated since then.

api
django
django-modern-rest
django-ninja
django-rest-api
django-rest-framework
fastapi-alternative
rest
rest-api
restful-api

Significant stargazers

Mathieu Kniewallner

76 followers · starred Apr 2026

Igor Latkin

42 followers · starred Mar 2026

devdanzin

123 followers · starred Mar 2026

Bo Lopker

115 followers · starred Jun 2026

wemake-services/django-modern-rest

Modern REST framework for Django with types and async support!

Python

1,486

1,275 commits

updated Oct 1, 2026

See the code

See what people are saying

SourceMessageScoreDate

Django-modern-rest 0.16.0 release

4

Oct 1, 2026

README

Modern REST Logo - Light

Modern REST framework for Django with types and async support!

wemake.services Modern REST Tests Result Codecov No AI slop PyPI Downloads Supported Python Version Code Style Ask DeepWiki Telegram group

Features

  • Blazingly fast
  • Supports async Django without any sync_to_async / async_to_sync calls inside, tested to work with free-threading builds
  • Supports pydantic2, msgspec, attrs, dataclasses, TypedDict as model schemas, but not bound to any of these libraries
  • Fully typed and checked with mypy, pyright, ty, and pyrefly in strict modes
  • Supports content negotiation, has default implementations for json, msgpack, SSE, Json Lines, and more
  • Strict schema validation of both requests and responses, including errors
  • Supports OpenAPI 3.1 / 3.2 semantic schema generation out of the box
  • Supports all your existing django primitives and packages, no custom runtimes
  • Great testing tools with schemathesis, polyfactory, tracecov, bundled pytest plugin, and default Django's testing primitives
  • 100% test coverage with 4000+ of carefully designed unit, integration, typing, and property-based tests on different databases and caches
  • High security standards
  • Built by the community for the community, not a single-person project
  • Great docs
  • No AI slop, but built for the LLM era
  • No emojis 🌚️️

Benchmark - Light

Sync mode

Testimonials

The one thing I really love about django-modern-rest is its pluggable serializers and validators. Frameworks that are tightly coupled with pydantic can be really painful to work with.

— Kirill Podoprigora, CPython core developer

Using django-modern-rest has been a game-changer for my productivity. The strict type safety and schema validation for both requests and responses mean I spend less time debugging and more time building.

— Josiah Kaviani, Django core developer

I rarely see frameworks that treat their OpenAPI schema as a first-class citizen. django-modern-rest not only generates a schema that accurately reflects your code, but also gives you the tools to verify it.

— Dmitry Dygalo, author of Schemathesis

Installation

Works for:

  • CPython 3.11+ or PyPy 3.11+
  • Django 5.0, 5.1, 5.2, 6.0, 6.1
pip install django-modern-rest

There are several included extras:

  • 'django-modern-rest[msgspec]' provides msgspec support and the fastest json parsing, recommended to be always included
  • 'django-modern-rest[pydantic]' provides pydantic support
  • 'django-modern-rest[attrs]' provides attrs support
  • 'django-modern-rest[jwt]' provides pyjwt auth support
  • 'django-modern-rest[openapi]' provides OpenAPI schema validation, yaml OpenAPI view, and generates better OpenAPI examples with polyfactory

Example

The shortest example (click here to copy the whole file):

>>> import uuid
>>> import pydantic
>>> from dmr import Body, Controller, Headers
>>> # Or use `dmr.plugins.msgspec` or write your own!
>>> from dmr.plugins.pydantic import PydanticFastSerializer

>>> class UserCreateModel(pydantic.BaseModel):
...     email: str

>>> class UserModel(UserCreateModel):
...     uid: uuid.UUID
...     consumer: str

>>> class HeaderModel(pydantic.BaseModel):
...     consumer: str = pydantic.Field(alias='X-API-Consumer')

>>> class UserController(Controller[PydanticFastSerializer]):
...     async def post(  # <- can be sync as well!
...         self,
...         parsed_body: Body[UserCreateModel],
...         parsed_headers: Headers[HeaderModel],
...     ) -> UserModel:
...         """All added props have the correct runtime and static types."""
...         return UserModel(
...             uid=uuid.uuid4(),
...             email=parsed_body.email,
...             consumer=parsed_headers.consumer,
...         )

And then route this controller in your urls.py:

>>> from django.urls import path
>>> from dmr.routing import Router

>>> router = Router(
...     'api/',
...     [
...         path('user/', UserController.as_view(), name='users'),
...     ],
... )
>>> urlpatterns = [
...     router.to_urlpatterns(namespace='api'),
... ]

Done! Now you have your shiny API with 100% type safe validation and interactive docs.

Next steps:

Contributors

Contributors

License

MIT

Credits

This project was generated with wemake-python-package. Current template version is: e1fcf312d7f715323dcff0d376a40b7e3b47f9b7. See what is updated since then.

api
django
django-modern-rest
django-ninja
django-rest-api
django-rest-framework
fastapi-alternative
rest
rest-api
restful-api

Significant stargazers

Mathieu Kniewallner

76 followers · starred Apr 2026

Igor Latkin

42 followers · starred Mar 2026

devdanzin

123 followers · starred Mar 2026

Bo Lopker

115 followers · starred Jun 2026

Languages

Python

99.5%