# ruarq/webserver architecture

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

- Interactive diagram: https://gitdiagram.com/ruarq/webserver
- Repository: https://github.com/ruarq/webserver

## Overview

RN-Praxis is a small C HTTP server backed by an HTTP message library. Its principal workflow accepts client requests, buffers and parses HTTP messages, dispatches supported methods, serves or modifies resources under a configured root, then serializes and sends responses. The HTTP library also provides request/response and message parsing and serialization. The README is empty, and excerpts omit parts of the server loop and handlers, so uncertain internal wiring is not shown.

Main entry points: [`server/src/webserver.c`](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c) (Request dispatch), [`http/src/response.c`](https://github.com/ruarq/webserver/blob/main/http/src/response.c) (Response model), [`http/src/parser.c`](https://github.com/ruarq/webserver/blob/main/http/src/parser.c) (Request parser), [`http/src/request.c`](https://github.com/ruarq/webserver/blob/main/http/src/request.c) (Request model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Server runtime"]
  node_main["Server entry<br/>[main.c]"]
  node_server_loop["Webserver loop<br/>[webserver.c]"]
  node_client_io["Client I/O<br/>[webserver.c]"]
  node_request_dispatch["Request dispatch<br/>[webserver.c]"]
  node_response_queue["Response queue<br/>[webserver.c]"]
end

subgraph group_protocol["HTTP protocol"]
  node_request_parser["Request parser<br/>[parser.c]"]
  node_request_model["Request model<br/>[request.c]"]
  node_message_model["Message model<br/>[message.c]"]
  node_response_model["Response model<br/>[response.c]"]
end

subgraph group_resources["Resource handling"]
  node_get_handler["GET handler<br/>[webserver.c]"]
  node_put_handler["PUT handler<br/>[webserver.c]"]
  node_delete_handler["DELETE handler<br/>[webserver.c]"]
  node_resource_path["Path mapping<br/>[webserver.c]"]
  node_resource_loader["Resource loader<br/>[webserver.c]"]
  node_root_files[("Root files")]
end

node_client(("HTTP client"))
node_os_network["OS networking"]

node_client -->|"sends requests"| node_os_network
node_os_network -->|"delivers bytes"| node_client_io
node_main -->|"runs server"| node_server_loop
node_server_loop -->|"polls clients"| node_client_io
node_client_io -->|"buffers requests"| node_request_dispatch
node_request_dispatch -->|"parses requests"| node_request_parser
node_request_parser -->|"populates"| node_request_model
node_request_model -->|"uses message fields"| node_message_model
node_request_dispatch -->|"dispatches GET"| node_get_handler
node_request_dispatch -->|"dispatches PUT"| node_put_handler
node_request_dispatch -->|"dispatches DELETE"| node_delete_handler
node_get_handler -->|"maps path"| node_resource_path
node_get_handler -->|"loads resource"| node_resource_loader
node_put_handler -->|"maps path"| node_resource_path
node_put_handler -->|"writes file"| node_root_files
node_delete_handler -->|"maps path"| node_resource_path
node_delete_handler -->|"deletes file"| node_root_files
node_resource_loader -->|"reads file"| node_root_files
node_get_handler -->|"prepares response"| node_response_model
node_put_handler -->|"prepares response"| node_response_model
node_delete_handler -->|"prepares response"| node_response_model
node_request_dispatch -->|"queues responses"| node_response_queue
node_server_loop -->|"pops responses"| node_response_queue
node_server_loop -->|"serializes response"| node_response_model
node_server_loop -->|"sends response"| node_client_io
node_client_io -->|"writes bytes"| node_os_network
node_os_network -->|"returns response"| node_client

click node_main "https://github.com/ruarq/webserver/blob/main/server/src/main.c"
click node_server_loop "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_client_io "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_request_dispatch "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_response_queue "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_request_parser "https://github.com/ruarq/webserver/blob/main/http/src/parser.c"
click node_request_model "https://github.com/ruarq/webserver/blob/main/http/src/request.c"
click node_message_model "https://github.com/ruarq/webserver/blob/main/http/src/message.c"
click node_response_model "https://github.com/ruarq/webserver/blob/main/http/src/response.c"
click node_get_handler "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_put_handler "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_delete_handler "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_resource_path "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"
click node_resource_loader "https://github.com/ruarq/webserver/blob/main/server/src/webserver.c"

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_main,node_server_loop,node_client_io,node_request_dispatch,node_response_queue,node_client toneBlue
class node_request_parser,node_request_model,node_message_model,node_response_model toneAmber
class node_get_handler,node_put_handler,node_delete_handler,node_resource_path,node_resource_loader,node_root_files toneMint
class node_os_network toneIndigo
```

## Components

### Server runtime

- [Server entry](https://github.com/ruarq/webserver/blob/main/server/src/main.c): `server/src/main.c`
- [Webserver loop](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- [Client I/O](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- [Request dispatch](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- [Response queue](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`

### HTTP protocol

- [Request parser](https://github.com/ruarq/webserver/blob/main/http/src/parser.c): `http/src/parser.c`
- [Request model](https://github.com/ruarq/webserver/blob/main/http/src/request.c): `http/src/request.c`
- [Message model](https://github.com/ruarq/webserver/blob/main/http/src/message.c): `http/src/message.c`
- [Response model](https://github.com/ruarq/webserver/blob/main/http/src/response.c): `http/src/response.c`

### Resource handling

- [GET handler](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- [PUT handler](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- [DELETE handler](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- [Path mapping](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- [Resource loader](https://github.com/ruarq/webserver/blob/main/server/src/webserver.c): `server/src/webserver.c`
- **Root files**

### Other components

- **HTTP client**
- **OS networking**

## Connections

- HTTP client → OS networking: sends requests
- OS networking → Client I/O: delivers bytes
- Server entry → Webserver loop: runs server
- Webserver loop → Client I/O: polls clients
- Client I/O → Request dispatch: buffers requests
- Request dispatch → Request parser: parses requests
- Request parser → Request model: populates
- Request model → Message model: uses message fields
- Request dispatch → GET handler: dispatches GET
- Request dispatch → PUT handler: dispatches PUT
- Request dispatch → DELETE handler: dispatches DELETE
- GET handler → Path mapping: maps path
- GET handler → Resource loader: loads resource
- PUT handler → Path mapping: maps path
- PUT handler → Root files: writes file
- DELETE handler → Path mapping: maps path
- DELETE handler → Root files: deletes file
- Resource loader → Root files: reads file
- GET handler → Response model: prepares response
- PUT handler → Response model: prepares response
- DELETE handler → Response model: prepares response
- Request dispatch → Response queue: queues responses
- Webserver loop → Response queue: pops responses
- Webserver loop → Response model: serializes response
- Webserver loop → Client I/O: sends response
- Client I/O → OS networking: writes bytes
- OS networking → HTTP client: returns response
