# waougri/httpxx architecture

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

- Interactive diagram: https://gitdiagram.com/waougri/httpxx
- Repository: https://github.com/waougri/httpxx

## Overview

httpxx is a minimal C++ HTTP/1.1 server. Its main workflow is a TCP client sending raw request bytes, which the socket parses into a request; the server dispatches it through method/path routing to a registered endpoint and handler, which builds a JSON, template-rendered, or static-file response for the socket to serialize and send. The README describes these runtime relationships; source excerpts chiefly cover the deprecated implementation, so details of the current v2 internals are not independently verified.

Main entry points: [`lib/v2/httpxx/request_handlers.hh`](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh) (Request Handlers), [`lib/v2/httpxx/socket.hh`](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/socket.hh) (HTTP Socket), [`lib/v2/httpxx/router.hh`](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/router.hh) (Router), [`lib/v2/httpxx/endpoint.hh`](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/endpoint.hh) (Endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["HTTP Runtime"]
  node_socket["HTTP Socket<br/>[socket.hh]"]
  node_server["HTTP Server<br/>[server.hh]"]
  node_request["Request Model<br/>[objects.hh]"]
end

subgraph group_routing["Routing and Handlers"]
  node_router["Router<br/>[router.hh]"]
  node_endpoint["Endpoint<br/>[endpoint.hh]"]
  node_handlers["Request Handlers"]
  node_example_routes["Registered Routes<br/>[main.cc]"]
end

subgraph group_responses["Response Rendering"]
  node_response["Response Model<br/>[objects.hh]"]
  node_json_response["JSON Response"]
  node_template_rendering["Template Rendering"]
  node_inja["Inja Renderer<br/>[inja.hpp]"]
  node_static_serving["Static File Serving"]
end

subgraph group_configuration["Configuration and Assets"]
  node_static_assets["Static Assets<br/>[index.html]"]
  node_configuration["Server Configuration<br/>[configuration.hh]"]
  node_toml["TOML Parser<br/>[tomlpp.hh]"]
  node_config_file["Example Config<br/>[config.toml]"]
end

node_client(("TCP Client"))

node_client -->|"sends bytes"| node_socket
node_socket -->|"parses bytes"| node_request
node_server -->|"dispatches request"| node_router
node_router -->|"matches route"| node_endpoint
node_endpoint -->|"calls handler"| node_handlers
node_example_routes -->|"registers routes"| node_router
node_handlers -->|"builds response"| node_response
node_handlers -->|"builds JSON"| node_json_response
node_handlers -->|"renders template"| node_template_rendering
node_template_rendering -->|"uses renderer"| node_inja
node_handlers -->|"serves file"| node_static_serving
node_static_serving -->|"reads asset"| node_static_assets
node_socket -->|"sends response bytes"| node_client
node_config_file -->|"parsed by"| node_toml
node_toml -->|"loads settings"| node_configuration

click node_socket "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/socket.hh"
click node_server "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/server.hh"
click node_request "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/objects.hh"
click node_router "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/router.hh"
click node_endpoint "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/endpoint.hh"
click node_handlers "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh"
click node_example_routes "https://github.com/waougri/httpxx/blob/master/example/main.cc"
click node_response "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/objects.hh"
click node_json_response "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh"
click node_template_rendering "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh"
click node_inja "https://github.com/waougri/httpxx/blob/master/lib/v2/include/inja.hpp"
click node_static_serving "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh"
click node_static_assets "https://github.com/waougri/httpxx/blob/master/example/static/index.html"
click node_configuration "https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/configuration.hh"
click node_toml "https://github.com/waougri/httpxx/blob/master/lib/v2/include/tomlpp.hh"
click node_config_file "https://github.com/waougri/httpxx/blob/master/example/config.toml"

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_socket,node_server,node_request,node_client toneBlue
class node_router,node_endpoint,node_handlers,node_example_routes toneAmber
class node_response,node_json_response,node_template_rendering,node_inja,node_static_serving toneMint
class node_static_assets,node_configuration,node_toml,node_config_file toneRose
```

## Components

### HTTP Runtime

- [HTTP Socket](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/socket.hh): `lib/v2/httpxx/socket.hh`
- [HTTP Server](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/server.hh): `lib/v2/httpxx/server.hh`
- [Request Model](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/objects.hh): `lib/v2/httpxx/objects.hh`

### Routing and Handlers

- [Router](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/router.hh): `lib/v2/httpxx/router.hh`
- [Endpoint](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/endpoint.hh): `lib/v2/httpxx/endpoint.hh`
- [Request Handlers](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh): `lib/v2/httpxx/request_handlers.hh`
- [Registered Routes](https://github.com/waougri/httpxx/blob/master/example/main.cc): `example/main.cc`

### Response Rendering

- [Response Model](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/objects.hh): `lib/v2/httpxx/objects.hh`
- [JSON Response](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh): `lib/v2/httpxx/request_handlers.hh`
- [Template Rendering](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh): `lib/v2/httpxx/request_handlers.hh`
- [Inja Renderer](https://github.com/waougri/httpxx/blob/master/lib/v2/include/inja.hpp): `lib/v2/include/inja.hpp`
- [Static File Serving](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/request_handlers.hh): `lib/v2/httpxx/request_handlers.hh`

### Configuration and Assets

- [Static Assets](https://github.com/waougri/httpxx/blob/master/example/static/index.html): `example/static/index.html`
- [Server Configuration](https://github.com/waougri/httpxx/blob/master/lib/v2/httpxx/configuration.hh): `lib/v2/httpxx/configuration.hh`
- [TOML Parser](https://github.com/waougri/httpxx/blob/master/lib/v2/include/tomlpp.hh): `lib/v2/include/tomlpp.hh`
- [Example Config](https://github.com/waougri/httpxx/blob/master/example/config.toml): `example/config.toml`

### Other components

- **TCP Client**

## Connections

- TCP Client → HTTP Socket: sends bytes (evidence: `README.md`)
- HTTP Socket → Request Model: parses bytes (evidence: `README.md`)
- HTTP Server → Router: dispatches request (evidence: `README.md`)
- Router → Endpoint: matches route (evidence: `README.md`)
- Endpoint → Request Handlers: calls handler (evidence: `README.md`)
- Registered Routes → Router: registers routes (evidence: `README.md`)
- Request Handlers → Response Model: builds response (evidence: `README.md`)
- Request Handlers → JSON Response: builds JSON (evidence: `README.md`)
- Request Handlers → Template Rendering: renders template (evidence: `README.md`)
- Template Rendering → Inja Renderer: uses renderer (evidence: `README.md`)
- Request Handlers → Static File Serving: serves file (evidence: `README.md`)
- Static File Serving → Static Assets: reads asset (evidence: `README.md`)
- HTTP Socket → TCP Client: sends response bytes (evidence: `README.md`)
- Example Config → TOML Parser: parsed by (evidence: `README.md`)
- TOML Parser → Server Configuration: loads settings (evidence: `README.md`)
