# hyeonju-u/temp architecture

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

- Interactive diagram: https://gitdiagram.com/hyeonju-u/temp
- Repository: https://github.com/hyeonju-u/temp

## Overview

This is a single-threaded C HTTP/1.1 server that serves static files and optionally reverse-proxies requests by path to round-robin backends. The principal workflow is accepting a client connection, parsing its request, routing it to a proxy route or static-file handler, then sending the resulting response; the event loop and timer heap support nonblocking I/O and connection deadlines. The graph preserves the documented proxy, configuration, and graceful-shutdown branches. Some subsystem links rely on README descriptions because their implementation excerpts were not supplied.

Main entry points: [`src/server.c`](https://github.com/hyeonju-u/temp/blob/main/src/server.c) (Server Orchestrator), [`src/main.c`](https://github.com/hyeonju-u/temp/blob/main/src/main.c) (Process Entry), [`src/proxy.c`](https://github.com/hyeonju-u/temp/blob/main/src/proxy.c) (Proxy Relay), [`src/static_file.c`](https://github.com/hyeonju-u/temp/blob/main/src/static_file.c) (Static File Handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server Runtime"]
  node_server["Server Orchestrator<br/>[server.c]"]
  node_event["Event Loop<br/>[event.c]"]
  node_connection["Connection State<br/>[connection.c]"]
  node_main["Process Entry<br/>[main.c]"]
end

subgraph group_http["HTTP Handling"]
  node_parser["Request Parser<br/>[http_parser.c]"]
  node_response["Response Builder<br/>[http_response.c]"]
end

subgraph group_static["Static Content"]
  node_static_handler["Static File Handler<br/>[static_file.c]"]
  node_mime["MIME Lookup<br/>[mime.c]"]
end

subgraph group_proxy["Reverse Proxy"]
  node_proxy_config["Proxy Configuration<br/>[proxy_config.c]"]
  node_proxy["Proxy Relay<br/>[proxy.c]"]
  node_proxy_message["Proxy Message Handling<br/>[proxy_message.c]"]
end

subgraph group_support["Runtime Support"]
  node_timer["Deadline Heap<br/>[timer_heap.c]"]
  node_buffer["Byte Buffers<br/>[buffer.c]"]
  node_signals["Signal Handling<br/>[signals.c]"]
  node_log["Logging<br/>[log.c]"]
end

node_client(("HTTP Client"))
node_backend(("Backend Servers"))

node_client -->|"sends requests"| node_server
node_server -->|"dispatches events"| node_event
node_server -->|"manages connections"| node_connection
node_server -->|"parses requests"| node_parser
node_server -->|"matches routes"| node_proxy_config
node_server -->|"starts proxying"| node_proxy
node_server -->|"opens static files"| node_static_handler
node_server -->|"builds responses"| node_response
node_static_handler -->|"looks up types"| node_mime
node_proxy -->|"parses and builds messages"| node_proxy_message
node_proxy -->|"forwards requests"| node_backend
node_backend -->|"returns responses"| node_proxy
node_server -->|"manages deadlines"| node_timer
node_server -->|"buffers I/O"| node_buffer
node_main -->|"loads configuration"| node_proxy_config
node_main -->|"creates and runs"| node_server
node_main -->|"installs handlers"| node_signals
node_main -->|"sets log level"| node_log
node_server -->|"records runtime events"| node_log

click node_server "https://github.com/hyeonju-u/temp/blob/main/src/server.c"
click node_event "https://github.com/hyeonju-u/temp/blob/main/src/event.c"
click node_connection "https://github.com/hyeonju-u/temp/blob/main/src/connection.c"
click node_parser "https://github.com/hyeonju-u/temp/blob/main/src/http_parser.c"
click node_response "https://github.com/hyeonju-u/temp/blob/main/src/http_response.c"
click node_static_handler "https://github.com/hyeonju-u/temp/blob/main/src/static_file.c"
click node_mime "https://github.com/hyeonju-u/temp/blob/main/src/mime.c"
click node_proxy_config "https://github.com/hyeonju-u/temp/blob/main/src/proxy_config.c"
click node_proxy "https://github.com/hyeonju-u/temp/blob/main/src/proxy.c"
click node_proxy_message "https://github.com/hyeonju-u/temp/blob/main/src/proxy_message.c"
click node_timer "https://github.com/hyeonju-u/temp/blob/main/src/timer_heap.c"
click node_buffer "https://github.com/hyeonju-u/temp/blob/main/src/buffer.c"
click node_signals "https://github.com/hyeonju-u/temp/blob/main/src/signals.c"
click node_log "https://github.com/hyeonju-u/temp/blob/main/src/log.c"
click node_main "https://github.com/hyeonju-u/temp/blob/main/src/main.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_server,node_event,node_connection,node_main,node_client toneBlue
class node_parser,node_response toneAmber
class node_static_handler,node_mime,node_backend toneMint
class node_proxy_config,node_proxy,node_proxy_message toneRose
class node_timer,node_buffer,node_signals,node_log toneIndigo
```

## Components

### Server Runtime

- [Server Orchestrator](https://github.com/hyeonju-u/temp/blob/main/src/server.c): `src/server.c`
- [Event Loop](https://github.com/hyeonju-u/temp/blob/main/src/event.c): `src/event.c`
- [Connection State](https://github.com/hyeonju-u/temp/blob/main/src/connection.c): `src/connection.c`
- [Process Entry](https://github.com/hyeonju-u/temp/blob/main/src/main.c): `src/main.c`

### HTTP Handling

- [Request Parser](https://github.com/hyeonju-u/temp/blob/main/src/http_parser.c): `src/http_parser.c`
- [Response Builder](https://github.com/hyeonju-u/temp/blob/main/src/http_response.c): `src/http_response.c`

### Static Content

- [Static File Handler](https://github.com/hyeonju-u/temp/blob/main/src/static_file.c): `src/static_file.c`
- [MIME Lookup](https://github.com/hyeonju-u/temp/blob/main/src/mime.c): `src/mime.c`

### Reverse Proxy

- [Proxy Configuration](https://github.com/hyeonju-u/temp/blob/main/src/proxy_config.c): `src/proxy_config.c`
- [Proxy Relay](https://github.com/hyeonju-u/temp/blob/main/src/proxy.c): `src/proxy.c`
- [Proxy Message Handling](https://github.com/hyeonju-u/temp/blob/main/src/proxy_message.c): `src/proxy_message.c`

### Runtime Support

- [Deadline Heap](https://github.com/hyeonju-u/temp/blob/main/src/timer_heap.c): `src/timer_heap.c`
- [Byte Buffers](https://github.com/hyeonju-u/temp/blob/main/src/buffer.c): `src/buffer.c`
- [Signal Handling](https://github.com/hyeonju-u/temp/blob/main/src/signals.c): `src/signals.c`
- [Logging](https://github.com/hyeonju-u/temp/blob/main/src/log.c): `src/log.c`

### Other components

- **HTTP Client**
- **Backend Servers**

## Connections

- HTTP Client → Server Orchestrator: sends requests (evidence: `README.md`)
- Server Orchestrator → Event Loop: dispatches events (evidence: `README.md`)
- Server Orchestrator → Connection State: manages connections (evidence: `README.md`)
- Server Orchestrator → Request Parser: parses requests (evidence: `src/server.c`)
- Server Orchestrator → Proxy Configuration: matches routes (evidence: `src/server.c`)
- Server Orchestrator → Proxy Relay: starts proxying (evidence: `src/server.c`)
- Server Orchestrator → Static File Handler: opens static files (evidence: `src/server.c`)
- Server Orchestrator → Response Builder: builds responses (evidence: `src/server.c`)
- Static File Handler → MIME Lookup: looks up types (evidence: `src/static_file.c`)
- Proxy Relay → Proxy Message Handling: parses and builds messages (evidence: `src/proxy.c`)
- Proxy Relay → Backend Servers: forwards requests (evidence: `README.md`)
- Backend Servers → Proxy Relay: returns responses (evidence: `README.md`)
- Server Orchestrator → Deadline Heap: manages deadlines (evidence: `README.md`)
- Server Orchestrator → Byte Buffers: buffers I/O (evidence: `README.md`)
- Process Entry → Proxy Configuration: loads configuration (evidence: `src/main.c`)
- Process Entry → Server Orchestrator: creates and runs (evidence: `src/main.c`)
- Process Entry → Signal Handling: installs handlers (evidence: `src/main.c`)
- Process Entry → Logging: sets log level (evidence: `src/main.c`)
- Server Orchestrator → Logging: records runtime events (evidence: `src/server.c`)
