Modern REST framework for Django with types and async support!
Featuresdjango>=5.0pydantic2, msgspec, attrs, dataclasses, TypedDict as model schemas, but not bound to any of these librariessync_to_async calls inside, tested to work with free-threading buildsmypy, pyright, and pyrefly in strict modesjson, msgpack, SSE, Json Lines, and moredjango primitives and packages, no custom runtimespytest plugin, and default Django's testing primitivesSync mode
TestimonialsThe 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-resthas 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-restnot only generates a schema that accurately reflects your code, but also gives you the tools to verify it.
— Dmitry Dygalo, author of Schemathesis
InstallationWorks for:
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 polyfactoryThe 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 include, path >>> from dmr.routing import Router >>> router = Router( ... 'api/', ... [ ... path('user/', UserController.as_view(), name='users'), ... ], ... ) >>> urlpatterns = [ ... path(router.prefix, include((router.urls, 'my_app'), namespace='api')), ... ]
Done! Now you have your shiny API with 100% type safe validation and interactive docs.
Next steps:
django-modern-rest!django-modern-rest!This project was generated with wemake-python-package. Current template version is: e1fcf312d7f715323dcff0d376a40b7e3b47f9b7. See what is updated since then.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | oxyde: Type-Safe, Pydantic-Centric Async ORM | 0 | 50 | 20-02-2026 |
| 2 | Oxyde ORM - Django-like Pydantic-driven Async ORM | 0 | 31.84 | 22-03-2026 |
| 3 | svc-infra: Bundled FastAPI Infrastructure | 0 | 35 | 02-01-2026 |
| 4 | django-tasks-db - An ORM-based backend for Django Tasks | 0 | 35 | 21-02-2026 |
| 5 | django-orm-lens: Django Schema Review | 0 | 35 | 10-08-2026 |
| 6 | django-nanopages - Django pages from Markdown | 0 | 26.67 | 25-01-2026 |
| 7 | Django: introducing django-integrity-policy | 0 | 35 | 03-06-2026 |
| 8 | dj-celery-panel: Celery Task Inspector for Django Admin | 0 | 24.29 | 05-02-2026 |
| 9 | rsloop: An Event Loop for Asyncio Written in Rust | 0 | 10 | 20-04-2026 |
| 10 | django-bolt - Rust-powered API Framework for Django | 0 | 32.22 | 17-02-2026 |