# actix/actix-web architecture

> Architecture diagram of the GitHub repository actix/actix-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/actix/actix-web
- Repository: https://github.com/actix/actix-web

## Overview

Actix Web is a Rust web framework workspace: an application accepts HTTP requests, routes them to handlers, extracts request data, and returns responses. The runtime spans application/server setup, route matching, HTTP protocol services, and optional product capabilities such as middleware, WebSockets, multipart forms, static files, and the awc client. The README documents the main user workflow and capabilities; sampled source and the SOURCE INDEX support selected internal relationships, while unsampled wiring is omitted.

Main entry points: [`actix-web/src/app.rs`](https://github.com/actix/actix-web/blob/main/actix-web/src/app.rs) (Application Builder), [`actix-http/src/service.rs`](https://github.com/actix/actix-web/blob/main/actix-http/src/service.rs) (HTTP Service), [`actix-web/src/server.rs`](https://github.com/actix/actix-web/blob/main/actix-web/src/server.rs) (HTTP Server), [`actix-web/src/handler.rs`](https://github.com/actix/actix-web/blob/main/actix-web/src/handler.rs) (Handler Dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Application"]
  node_server["HTTP Server<br/>[server.rs]"]
  node_app["Application Builder<br/>[app.rs]"]
  node_routing["Resource Routing<br/>[resource.rs]"]
  node_router["Path Matching<br/>[router.rs]"]
  node_handler["Handler Dispatch<br/>[handler.rs]"]
  node_extractors["Request Extractors<br/>[query.rs]"]
  node_responses["Response Types<br/>[responder.rs]"]
end

subgraph group_http["HTTP Runtime"]
  node_httpservice["HTTP Service<br/>[service.rs]"]
  node_http1["HTTP/1 Runtime<br/>[dispatcher.rs]"]
  node_http2["HTTP/2 Runtime<br/>[dispatcher.rs]"]
  node_httpcore["HTTP Types<br/>[lib.rs]"]
end

subgraph group_features["Web Capabilities"]
  node_middleware["Middleware<br/>[mod.rs]"]
  node_websocket["WebSockets<br/>[ws.rs]"]
  node_multipart["Multipart Forms<br/>[multipart.rs]"]
  node_multipartform["Form Extraction<br/>[mod.rs]"]
  node_staticfiles["Static Files<br/>[files.rs]"]
  node_namedfile["Named File Responses<br/>[named.rs]"]
  node_codegen["Route Macros<br/>[route.rs]"]
end

subgraph group_client["HTTP Client"]
  node_awc["Client API<br/>[request.rs]"]
  node_connector["Client Connections<br/>[connector.rs]"]
end

node_user(("Application Developer"))
node_external(("Remote HTTP Service"))

node_user -->|"starts"| node_server
node_server -->|"hosts"| node_app
node_app -.->|"registers"| node_routing
node_routing -.->|"matches paths"| node_router
node_router -.->|"dispatches"| node_handler
node_handler -.->|"uses"| node_extractors
node_handler -.->|"produces"| node_responses
node_app -->|"configures"| node_middleware
node_server -->|"builds services"| node_httpservice
node_httpservice -.->|"dispatches HTTP/1"| node_http1
node_httpservice -.->|"dispatches HTTP/2"| node_http2
node_httpservice -->|"uses types"| node_httpcore
node_app -.->|"supports"| node_websocket
node_app -.->|"supports"| node_multipart
node_multipart -->|"provides forms"| node_multipartform
node_app -->|"mounts assets"| node_staticfiles
node_staticfiles -->|"serves files"| node_namedfile
node_app -.->|"uses route macros"| node_codegen
node_user -->|"creates requests"| node_awc
node_awc -.->|"sends requests"| node_connector
node_connector -.->|"connects to"| node_external

click node_server "https://github.com/actix/actix-web/blob/main/actix-web/src/server.rs"
click node_app "https://github.com/actix/actix-web/blob/main/actix-web/src/app.rs"
click node_routing "https://github.com/actix/actix-web/blob/main/actix-web/src/resource.rs"
click node_router "https://github.com/actix/actix-web/blob/main/actix-router/src/router.rs"
click node_handler "https://github.com/actix/actix-web/blob/main/actix-web/src/handler.rs"
click node_extractors "https://github.com/actix/actix-web/blob/main/actix-web/src/types/query.rs"
click node_responses "https://github.com/actix/actix-web/blob/main/actix-web/src/response/responder.rs"
click node_middleware "https://github.com/actix/actix-web/blob/main/actix-web/src/middleware/mod.rs"
click node_httpservice "https://github.com/actix/actix-web/blob/main/actix-http/src/service.rs"
click node_http1 "https://github.com/actix/actix-web/blob/main/actix-http/src/h1/dispatcher.rs"
click node_http2 "https://github.com/actix/actix-web/blob/main/actix-http/src/h2/dispatcher.rs"
click node_httpcore "https://github.com/actix/actix-web/blob/main/actix-http/src/lib.rs"
click node_websocket "https://github.com/actix/actix-web/blob/main/actix-web-actors/src/ws.rs"
click node_multipart "https://github.com/actix/actix-web/blob/main/actix-multipart/src/multipart.rs"
click node_multipartform "https://github.com/actix/actix-web/blob/main/actix-multipart/src/form/mod.rs"
click node_staticfiles "https://github.com/actix/actix-web/blob/main/actix-files/src/files.rs"
click node_namedfile "https://github.com/actix/actix-web/blob/main/actix-files/src/named.rs"
click node_codegen "https://github.com/actix/actix-web/blob/main/actix-web-codegen/src/route.rs"
click node_awc "https://github.com/actix/actix-web/blob/main/awc/src/request.rs"
click node_connector "https://github.com/actix/actix-web/blob/main/awc/src/client/connector.rs"

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_server,node_app,node_routing,node_router,node_handler,node_extractors,node_responses toneBlue
class node_httpservice,node_http1,node_http2,node_httpcore toneAmber
class node_middleware,node_websocket,node_multipart,node_multipartform,node_staticfiles,node_namedfile,node_codegen toneMint
class node_awc,node_connector toneRose
class node_user,node_external toneIndigo
```

## Components

### Web Application

- [HTTP Server](https://github.com/actix/actix-web/blob/main/actix-web/src/server.rs): `actix-web/src/server.rs`
- [Application Builder](https://github.com/actix/actix-web/blob/main/actix-web/src/app.rs): `actix-web/src/app.rs`
- [Resource Routing](https://github.com/actix/actix-web/blob/main/actix-web/src/resource.rs): `actix-web/src/resource.rs`
- [Path Matching](https://github.com/actix/actix-web/blob/main/actix-router/src/router.rs): `actix-router/src/router.rs`
- [Handler Dispatch](https://github.com/actix/actix-web/blob/main/actix-web/src/handler.rs): `actix-web/src/handler.rs`
- [Request Extractors](https://github.com/actix/actix-web/blob/main/actix-web/src/types/query.rs): `actix-web/src/types/query.rs`
- [Response Types](https://github.com/actix/actix-web/blob/main/actix-web/src/response/responder.rs): `actix-web/src/response/responder.rs`

### HTTP Runtime

- [HTTP Service](https://github.com/actix/actix-web/blob/main/actix-http/src/service.rs): `actix-http/src/service.rs`
- [HTTP/1 Runtime](https://github.com/actix/actix-web/blob/main/actix-http/src/h1/dispatcher.rs): `actix-http/src/h1/dispatcher.rs`
- [HTTP/2 Runtime](https://github.com/actix/actix-web/blob/main/actix-http/src/h2/dispatcher.rs): `actix-http/src/h2/dispatcher.rs`
- [HTTP Types](https://github.com/actix/actix-web/blob/main/actix-http/src/lib.rs): `actix-http/src/lib.rs`

### Web Capabilities

- [Middleware](https://github.com/actix/actix-web/blob/main/actix-web/src/middleware/mod.rs): `actix-web/src/middleware/mod.rs`
- [WebSockets](https://github.com/actix/actix-web/blob/main/actix-web-actors/src/ws.rs): `actix-web-actors/src/ws.rs`
- [Multipart Forms](https://github.com/actix/actix-web/blob/main/actix-multipart/src/multipart.rs): `actix-multipart/src/multipart.rs`
- [Form Extraction](https://github.com/actix/actix-web/blob/main/actix-multipart/src/form/mod.rs): `actix-multipart/src/form/mod.rs`
- [Static Files](https://github.com/actix/actix-web/blob/main/actix-files/src/files.rs): `actix-files/src/files.rs`
- [Named File Responses](https://github.com/actix/actix-web/blob/main/actix-files/src/named.rs): `actix-files/src/named.rs`
- [Route Macros](https://github.com/actix/actix-web/blob/main/actix-web-codegen/src/route.rs): `actix-web-codegen/src/route.rs`

### HTTP Client

- [Client API](https://github.com/actix/actix-web/blob/main/awc/src/request.rs): `awc/src/request.rs`
- [Client Connections](https://github.com/actix/actix-web/blob/main/awc/src/client/connector.rs): `awc/src/client/connector.rs`

### Other components

- **Application Developer**
- **Remote HTTP Service**

## Connections

- Application Developer → HTTP Server: starts
- HTTP Server → Application Builder: hosts
- Application Builder → Resource Routing: registers
- Resource Routing → Path Matching: matches paths
- Path Matching → Handler Dispatch: dispatches
- Handler Dispatch → Request Extractors: uses
- Handler Dispatch → Response Types: produces
- Application Builder → Middleware: configures (evidence: `actix-web/src/app.rs`)
- HTTP Server → HTTP Service: builds services (evidence: `actix-web/src/server.rs`)
- HTTP Service → HTTP/1 Runtime: dispatches HTTP/1
- HTTP Service → HTTP/2 Runtime: dispatches HTTP/2
- HTTP Service → HTTP Types: uses types (evidence: `actix-http/src/service.rs`)
- Application Builder → WebSockets: supports
- Application Builder → Multipart Forms: supports
- Multipart Forms → Form Extraction: provides forms (evidence: `actix-multipart/src/lib.rs`)
- Application Builder → Static Files: mounts assets
- Static Files → Named File Responses: serves files
- Application Builder → Route Macros: uses route macros
- Application Developer → Client API: creates requests
- Client API → Client Connections: sends requests
- Client Connections → Remote HTTP Service: connects to
