# expressjs/express architecture

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

- Interactive diagram: https://gitdiagram.com/expressjs/express
- Repository: https://github.com/expressjs/express

## Overview

Express is a Node.js web framework. A client request reaches the application through Node’s HTTP server, is dispatched through configured middleware and routes, and invokes application handlers that inspect the request and produce a response. The framework supplies routing, request/response helpers, body parsers, static files, content negotiation, caching headers, and view rendering. The graph emphasizes runtime paths visible in the sampled source; router, static-serving, template-engine, and final-handler implementations are external dependencies.

Main entry points: [`lib/application.js`](https://github.com/expressjs/express/blob/master/lib/application.js) (Express Application), [`lib/response.js`](https://github.com/expressjs/express/blob/master/lib/response.js) (Response API), [`lib/view.js`](https://github.com/expressjs/express/blob/master/lib/view.js) (View Rendering), [`lib/express.js`](https://github.com/expressjs/express/blob/master/lib/express.js) (Application Factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application Entry"]
  node_app["Express Application<br/>[application.js]"]
  node_factory["Application Factory<br/>[express.js]"]
end

subgraph group_routing["Routing Pipeline"]
  node_router["Router Integration<br/>[express.js]"]
  node_route_handlers["Application Handlers"]
end

subgraph group_http["HTTP Semantics"]
  node_request["Request API<br/>[request.js]"]
  node_response["Response API<br/>[response.js]"]
  node_body_parsers["Body Parsers<br/>[express.js]"]
end

subgraph group_rendering["Rendering Delivery"]
  node_view_rendering["View Rendering<br/>[view.js]"]
  node_file_delivery["Static File Delivery<br/>[express.js]"]
end

subgraph group_internals["Framework Internals"]
  node_http_helpers["HTTP Helpers<br/>[utils.js]"]
end

node_client(("HTTP Client"))
node_node_http["Node HTTP Server"]
node_filesystem["Filesystem"]
node_template_engines["Template Engines"]
node_final_handler["Final Error Handler"]
node_router_package["Router Package"]

node_client -->|"sends request"| node_node_http
node_app -->|"creates server"| node_node_http
node_node_http -->|"dispatches request"| node_app
node_factory -->|"creates application"| node_app
node_app -->|"dispatches request"| node_router
node_router -->|"uses router"| node_router_package
node_router -->|"invokes handlers"| node_route_handlers
node_app -->|"augments request"| node_request
node_app -->|"augments response"| node_response
node_route_handlers -->|"reads request"| node_request
node_route_handlers -->|"writes response"| node_response
node_factory -->|"exports parsers"| node_body_parsers
node_request -->|"parses query"| node_http_helpers
node_app -->|"compiles settings"| node_http_helpers
node_response -->|"generates headers"| node_http_helpers
node_response -->|"renders view"| node_view_rendering
node_app -->|"renders view"| node_view_rendering
node_view_rendering -->|"looks up views"| node_filesystem
node_view_rendering -.->|"renders template"| node_template_engines
node_factory -->|"exports static middleware"| node_file_delivery
node_file_delivery -->|"serves files"| node_filesystem
node_app -->|"handles errors"| node_final_handler

click node_app "https://github.com/expressjs/express/blob/master/lib/application.js"
click node_factory "https://github.com/expressjs/express/blob/master/lib/express.js"
click node_router "https://github.com/expressjs/express/blob/master/lib/express.js"
click node_request "https://github.com/expressjs/express/blob/master/lib/request.js"
click node_response "https://github.com/expressjs/express/blob/master/lib/response.js"
click node_body_parsers "https://github.com/expressjs/express/blob/master/lib/express.js"
click node_http_helpers "https://github.com/expressjs/express/blob/master/lib/utils.js"
click node_view_rendering "https://github.com/expressjs/express/blob/master/lib/view.js"
click node_file_delivery "https://github.com/expressjs/express/blob/master/lib/express.js"

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_app,node_factory,node_client toneBlue
class node_router,node_route_handlers toneAmber
class node_request,node_response,node_body_parsers,node_node_http,node_final_handler,node_router_package toneMint
class node_view_rendering,node_file_delivery toneRose
class node_http_helpers,node_filesystem,node_template_engines toneIndigo
```

## Components

### Application Entry

- [Express Application](https://github.com/expressjs/express/blob/master/lib/application.js): `lib/application.js`
- [Application Factory](https://github.com/expressjs/express/blob/master/lib/express.js): `lib/express.js`

### Routing Pipeline

- [Router Integration](https://github.com/expressjs/express/blob/master/lib/express.js): `lib/express.js`
- **Application Handlers**

### HTTP Semantics

- [Request API](https://github.com/expressjs/express/blob/master/lib/request.js): `lib/request.js`
- [Response API](https://github.com/expressjs/express/blob/master/lib/response.js): `lib/response.js`
- [Body Parsers](https://github.com/expressjs/express/blob/master/lib/express.js): `lib/express.js`

### Rendering Delivery

- [View Rendering](https://github.com/expressjs/express/blob/master/lib/view.js): `lib/view.js`
- [Static File Delivery](https://github.com/expressjs/express/blob/master/lib/express.js): `lib/express.js`

### Framework Internals

- [HTTP Helpers](https://github.com/expressjs/express/blob/master/lib/utils.js): `lib/utils.js`

### Other components

- **HTTP Client**
- **Node HTTP Server**
- **Filesystem**
- **Template Engines**
- **Final Error Handler**
- **Router Package**

## Connections

- HTTP Client → Node HTTP Server: sends request
- Express Application → Node HTTP Server: creates server
- Node HTTP Server → Express Application: dispatches request
- Application Factory → Express Application: creates application
- Express Application → Router Integration: dispatches request
- Router Integration → Router Package: uses router
- Router Integration → Application Handlers: invokes handlers
- Express Application → Request API: augments request
- Express Application → Response API: augments response
- Application Handlers → Request API: reads request
- Application Handlers → Response API: writes response
- Application Factory → Body Parsers: exports parsers
- Request API → HTTP Helpers: parses query
- Express Application → HTTP Helpers: compiles settings
- Response API → HTTP Helpers: generates headers
- Response API → View Rendering: renders view
- Express Application → View Rendering: renders view
- View Rendering → Filesystem: looks up views
- View Rendering → Template Engines: renders template
- Application Factory → Static File Delivery: exports static middleware
- Static File Delivery → Filesystem: serves files
- Express Application → Final Error Handler: handles errors
