# wemake-services/django-modern-rest architecture

> Architecture diagram of the GitHub repository wemake-services/django-modern-rest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wemake-services/django-modern-rest
- Repository: https://github.com/wemake-services/django-modern-rest

## Overview

django-modern-rest is a typed, async-capable REST framework for Django. Its main request path routes a Django request to a controller endpoint, which applies endpoint metadata and security/throttling checks, parses and validates input, then serializes and renders a response. The framework also provides schema-driven OpenAPI generation, streaming formats, and pluggable schema/serialization integrations. The graph combines documented capabilities with source-index references; unsampled subsystem internals and some wiring are therefore represented conservatively.

Main entry points: [`dmr/endpoint.py`](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/endpoint.py) (Endpoint execution), [`dmr/serializer.py`](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/serializer.py) (Serializer API), [`dmr/routing.py`](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/routing.py) (Request routing), [`dmr/controller.py`](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/controller.py) (Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request["Request handling"]
  node_routing["Request routing<br/>[routing.py]"]
  node_controller["Controller<br/>[controller.py]"]
  node_endpoint["Endpoint execution<br/>[endpoint.py]"]
  node_metadata["Endpoint metadata<br/>[metadata.py]"]
end

subgraph group_data["Data and responses"]
  node_parsers["Request parsers<br/>[parsers.py]"]
  node_validation["Request validation"]
  node_serializer["Serializer API<br/>[serializer.py]"]
  node_renderers["Response renderers<br/>[renderers.py]"]
  node_response["HTTP responses<br/>[response.py]"]
  node_negotiation["Content negotiation<br/>[negotiation.py]"]
end

subgraph group_security["Security controls"]
  node_security["Authentication<br/>[base.py]"]
  node_httpauth["HTTP authentication<br/>[http.py]"]
  node_authintegrations["Auth integrations"]
  node_throttling["Request throttling"]
end

subgraph group_schema["Schema and formats"]
  node_openapi["OpenAPI collection<br/>[collector.py]"]
  node_openapicontext["OpenAPI context<br/>[context.py]"]
  node_openapigen["OpenAPI generators"]
  node_openapiobjects["OpenAPI objects"]
end

subgraph group_extensions["Framework extensions"]
  node_streaming["Streaming responses<br/>[controller.py]"]
  node_plugins["Schema plugins"]
  node_pagination["Cursor pagination<br/>[cursor.py]"]
end

node_client(("API client"))

node_client -.->|"sends request"| node_routing
node_routing -->|"dispatches"| node_controller
node_controller -->|"invokes"| node_endpoint
node_controller -->|"configures"| node_metadata
node_endpoint -->|"reads"| node_metadata
node_endpoint -->|"parses input"| node_parsers
node_endpoint -->|"validates input"| node_validation
node_endpoint -->|"authenticates"| node_security
node_endpoint -->|"checks limits"| node_throttling
node_endpoint -->|"negotiates format"| node_negotiation
node_endpoint -->|"serializes result"| node_serializer
node_endpoint -->|"builds response"| node_response
node_serializer -->|"deserializes with"| node_parsers
node_serializer -->|"renders with"| node_renderers
node_security -.->|"supports scheme"| node_httpauth
node_security -.->|"has integrations"| node_authintegrations
node_routing -->|"exposes schema"| node_openapi
node_endpoint -->|"registers endpoint"| node_openapi
node_openapi -.->|"generates through"| node_openapicontext
node_openapicontext -->|"uses generators"| node_openapigen
node_openapigen -.->|"builds specification"| node_openapiobjects
node_streaming -->|"uses endpoint flow"| node_endpoint
node_streaming -->|"uses renderers"| node_renderers
node_plugins -->|"implements serializers"| node_serializer
node_pagination -.->|"provides cursors"| node_client

click node_routing "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/routing.py"
click node_controller "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/controller.py"
click node_endpoint "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/endpoint.py"
click node_metadata "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/metadata.py"
click node_parsers "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/parsers.py"
click node_validation "https://github.com/wemake-services/django-modern-rest/tree/master/dmr/validation"
click node_serializer "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/serializer.py"
click node_renderers "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/renderers.py"
click node_response "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/response.py"
click node_negotiation "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/negotiation.py"
click node_security "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/security/base.py"
click node_httpauth "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/security/http.py"
click node_authintegrations "https://github.com/wemake-services/django-modern-rest/tree/master/dmr/security"
click node_throttling "https://github.com/wemake-services/django-modern-rest/tree/master/dmr/throttling"
click node_openapi "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/openapi/collector.py"
click node_openapicontext "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/openapi/core/context.py"
click node_openapigen "https://github.com/wemake-services/django-modern-rest/tree/master/dmr/openapi/generators"
click node_openapiobjects "https://github.com/wemake-services/django-modern-rest/tree/master/dmr/openapi/objects"
click node_streaming "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/streaming/controller.py"
click node_plugins "https://github.com/wemake-services/django-modern-rest/tree/master/dmr/plugins"
click node_pagination "https://github.com/wemake-services/django-modern-rest/blob/master/dmr/pagination/cursor.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routing,node_controller,node_endpoint,node_metadata,node_client toneBlue
class node_parsers,node_validation,node_serializer,node_renderers,node_response,node_negotiation toneAmber
class node_security,node_httpauth,node_authintegrations,node_throttling toneMint
class node_openapi,node_openapicontext,node_openapigen,node_openapiobjects toneRose
class node_streaming,node_plugins,node_pagination toneIndigo
```

## Components

### Request handling

- [Request routing](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/routing.py): `dmr/routing.py`
- [Controller](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/controller.py): `dmr/controller.py`
- [Endpoint execution](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/endpoint.py): `dmr/endpoint.py`
- [Endpoint metadata](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/metadata.py): `dmr/metadata.py`

### Data and responses

- [Request parsers](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/parsers.py): `dmr/parsers.py`
- [Request validation](https://github.com/wemake-services/django-modern-rest/tree/master/dmr/validation): `dmr/validation`
- [Serializer API](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/serializer.py): `dmr/serializer.py`
- [Response renderers](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/renderers.py): `dmr/renderers.py`
- [HTTP responses](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/response.py): `dmr/response.py`
- [Content negotiation](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/negotiation.py): `dmr/negotiation.py`

### Security controls

- [Authentication](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/security/base.py): `dmr/security/base.py`
- [HTTP authentication](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/security/http.py): `dmr/security/http.py`
- [Auth integrations](https://github.com/wemake-services/django-modern-rest/tree/master/dmr/security): `dmr/security`
- [Request throttling](https://github.com/wemake-services/django-modern-rest/tree/master/dmr/throttling): `dmr/throttling`

### Schema and formats

- [OpenAPI collection](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/openapi/collector.py): `dmr/openapi/collector.py`
- [OpenAPI context](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/openapi/core/context.py): `dmr/openapi/core/context.py`
- [OpenAPI generators](https://github.com/wemake-services/django-modern-rest/tree/master/dmr/openapi/generators): `dmr/openapi/generators`
- [OpenAPI objects](https://github.com/wemake-services/django-modern-rest/tree/master/dmr/openapi/objects): `dmr/openapi/objects`

### Framework extensions

- [Streaming responses](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/streaming/controller.py): `dmr/streaming/controller.py`
- [Schema plugins](https://github.com/wemake-services/django-modern-rest/tree/master/dmr/plugins): `dmr/plugins`
- [Cursor pagination](https://github.com/wemake-services/django-modern-rest/blob/master/dmr/pagination/cursor.py): `dmr/pagination/cursor.py`

### Other components

- **API client**

## Connections

- API client → Request routing: sends request
- Request routing → Controller: dispatches (evidence: `dmr/routing.py`)
- Controller → Endpoint execution: invokes (evidence: `dmr/controller.py`)
- Controller → Endpoint metadata: configures (evidence: `dmr/controller.py`)
- Endpoint execution → Endpoint metadata: reads (evidence: `dmr/endpoint.py`)
- Endpoint execution → Request parsers: parses input (evidence: `dmr/endpoint.py`)
- Endpoint execution → Request validation: validates input (evidence: `dmr/endpoint.py`)
- Endpoint execution → Authentication: authenticates (evidence: `dmr/endpoint.py`)
- Endpoint execution → Request throttling: checks limits (evidence: `dmr/endpoint.py`)
- Endpoint execution → Content negotiation: negotiates format (evidence: `dmr/endpoint.py`)
- Endpoint execution → Serializer API: serializes result (evidence: `dmr/endpoint.py`)
- Endpoint execution → HTTP responses: builds response (evidence: `dmr/endpoint.py`)
- Serializer API → Request parsers: deserializes with (evidence: `dmr/serializer.py`)
- Serializer API → Response renderers: renders with (evidence: `dmr/serializer.py`)
- Authentication → HTTP authentication: supports scheme (evidence: `dmr/security/base.py`)
- Authentication → Auth integrations: has integrations (evidence: `dmr/security/base.py`)
- Request routing → OpenAPI collection: exposes schema (evidence: `dmr/routing.py`)
- Endpoint execution → OpenAPI collection: registers endpoint (evidence: `dmr/endpoint.py`)
- OpenAPI collection → OpenAPI context: generates through
- OpenAPI context → OpenAPI generators: uses generators (evidence: `dmr/openapi/core/context.py`)
- OpenAPI generators → OpenAPI objects: builds specification (evidence: `dmr/openapi/generators/component_parsers.py`)
- Streaming responses → Endpoint execution: uses endpoint flow (evidence: `dmr/streaming/controller.py`)
- Streaming responses → Response renderers: uses renderers (evidence: `dmr/streaming/controller.py`)
- Schema plugins → Serializer API: implements serializers (evidence: `dmr/plugins/pydantic/serializer.py`)
- Cursor pagination → API client: provides cursors
