# cmarin00000/boanrust architecture

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

- Interactive diagram: https://gitdiagram.com/cmarin00000/boanrust
- Repository: https://github.com/cmarin00000/boanrust

## Overview

Boa is an event-driven HTTP server: it accepts client connections, parses requests, maps URIs to files or CGI programs, and returns responses. The repository also contains a small Rust migration crate, but its implementation is not described by the README or shown in the excerpts. The C server’s detailed internal call flow is only partly evidenced, so uncertain links are dashed rather than presented as verified calls.

Main entry points: [`boa-0.94.13/src/request.c`](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/request.c) (Connection Handling), [`boa-0.94.13/src/alias.c`](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/alias.c) (URI Translation), [`boa-0.94.13/src/select.c`](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/select.c) (Socket Event Loop), [`boa-0.94.13/src/get.c`](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/get.c) (Static File Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Server Runtime"]
  node_listener["Server Startup<br/>[boa.c]"]
  node_eventloop["Socket Event Loop<br/>[select.c]"]
  node_connection["Connection Handling<br/>[request.c]"]
  node_queue["Request Queues<br/>[queue.c]"]
end

subgraph group_request["Request Handling"]
  node_reader["Request Reading<br/>[read.c]"]
  node_parser["HTTP Parsing<br/>[request.c]"]
  node_responses["HTTP Responses<br/>[response.c]"]
  node_output["Buffered Output<br/>[buffer.c]"]
end

subgraph group_content["Content Delivery"]
  node_uri["URI Translation<br/>[alias.c]"]
  node_pathguard["Path Guard<br/>[lib.rs]"]
  node_staticfiles["Static File Service<br/>[get.c]"]
  node_directory["Directory Listings<br/>[index_dir.c]"]
  node_mime["MIME Lookup<br/>[hash.c]"]
  node_cgi["CGI Execution<br/>[cgi.c]"]
  node_cgiheaders["CGI Headers<br/>[cgi_header.c]"]
end

subgraph group_support["Configuration and Support"]
  node_configparse["Config Parsing<br/>[y.tab.c]"]
  node_lexer["Config Lexer<br/>[lex.yy.c]"]
  node_config["Server Configuration<br/>[config.c]"]
  node_logging["Request Logging<br/>[log.c]"]
end

subgraph group_migration["Rust Migration"]
  node_rustentry["Rust Entry Point<br/>[main.rs]"]
  node_pathguardheader["Path Guard Interface<br/>[boa_pathguard.h]"]
end

node_client(("HTTP Client"))

node_client -.->|"opens connection"| node_listener
node_listener -.->|"starts loop"| node_eventloop
node_eventloop -.->|"dispatches sockets"| node_connection
node_connection -->|"enqueues requests"| node_queue
node_connection -->|"sends overload response"| node_responses
node_eventloop -.->|"dispatches I/O"| node_reader
node_reader -.->|"provides request data"| node_parser
node_config -.->|"parses configuration"| node_configparse
node_configparse -.->|"requests tokens"| node_lexer
node_parser -.->|"resolves request path"| node_uri
node_uri -.->|"validates path"| node_pathguard
node_uri -.->|"selects file"| node_staticfiles
node_staticfiles -.->|"looks up type"| node_mime
node_staticfiles -.->|"lists directory"| node_directory
node_uri -.->|"selects script"| node_cgi
node_cgi -.->|"processes output headers"| node_cgiheaders
node_cgi -.->|"produces response"| node_responses
node_responses -.->|"writes response"| node_output
node_connection -->|"flushes output"| node_output
node_connection -.->|"records errors"| node_logging
node_rustentry -.->|"uses interface"| node_pathguardheader

click node_listener "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/boa.c"
click node_eventloop "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/select.c"
click node_connection "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/request.c"
click node_queue "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/queue.c"
click node_reader "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/read.c"
click node_parser "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/request.c"
click node_configparse "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/y.tab.c"
click node_lexer "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/lex.yy.c"
click node_config "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/config.c"
click node_uri "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/alias.c"
click node_pathguard "https://github.com/cmarin00000/boanrust/blob/main/BoaNRust/src/lib.rs"
click node_staticfiles "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/get.c"
click node_directory "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/index_dir.c"
click node_mime "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/hash.c"
click node_cgi "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/cgi.c"
click node_cgiheaders "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/cgi_header.c"
click node_responses "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/response.c"
click node_output "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/buffer.c"
click node_logging "https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/log.c"
click node_rustentry "https://github.com/cmarin00000/boanrust/blob/main/BoaNRust/src/main.rs"
click node_pathguardheader "https://github.com/cmarin00000/boanrust/blob/main/BoaNRust/boa_pathguard.h"

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_listener,node_eventloop,node_connection,node_queue,node_client toneBlue
class node_reader,node_parser,node_responses,node_output toneAmber
class node_uri,node_pathguard,node_staticfiles,node_directory,node_mime,node_cgi,node_cgiheaders toneMint
class node_configparse,node_lexer,node_config,node_logging toneRose
class node_rustentry,node_pathguardheader toneIndigo
```

## Components

### Server Runtime

- [Server Startup](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/boa.c): `boa-0.94.13/src/boa.c`
- [Socket Event Loop](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/select.c): `boa-0.94.13/src/select.c`
- [Connection Handling](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/request.c): `boa-0.94.13/src/request.c`
- [Request Queues](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/queue.c): `boa-0.94.13/src/queue.c`

### Request Handling

- [Request Reading](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/read.c): `boa-0.94.13/src/read.c`
- [HTTP Parsing](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/request.c): `boa-0.94.13/src/request.c`
- [HTTP Responses](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/response.c): `boa-0.94.13/src/response.c`
- [Buffered Output](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/buffer.c): `boa-0.94.13/src/buffer.c`

### Content Delivery

- [URI Translation](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/alias.c): `boa-0.94.13/src/alias.c`
- [Path Guard](https://github.com/cmarin00000/boanrust/blob/main/BoaNRust/src/lib.rs): `BoaNRust/src/lib.rs`
- [Static File Service](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/get.c): `boa-0.94.13/src/get.c`
- [Directory Listings](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/index_dir.c): `boa-0.94.13/src/index_dir.c`
- [MIME Lookup](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/hash.c): `boa-0.94.13/src/hash.c`
- [CGI Execution](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/cgi.c): `boa-0.94.13/src/cgi.c`
- [CGI Headers](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/cgi_header.c): `boa-0.94.13/src/cgi_header.c`

### Configuration and Support

- [Config Parsing](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/y.tab.c): `boa-0.94.13/src/y.tab.c`
- [Config Lexer](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/lex.yy.c): `boa-0.94.13/src/lex.yy.c`
- [Server Configuration](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/config.c): `boa-0.94.13/src/config.c`
- [Request Logging](https://github.com/cmarin00000/boanrust/blob/main/boa-0.94.13/src/log.c): `boa-0.94.13/src/log.c`

### Rust Migration

- [Rust Entry Point](https://github.com/cmarin00000/boanrust/blob/main/BoaNRust/src/main.rs): `BoaNRust/src/main.rs`
- [Path Guard Interface](https://github.com/cmarin00000/boanrust/blob/main/BoaNRust/boa_pathguard.h): `BoaNRust/boa_pathguard.h`

### Other components

- **HTTP Client**

## Connections

- HTTP Client → Server Startup: opens connection
- Server Startup → Socket Event Loop: starts loop
- Socket Event Loop → Connection Handling: dispatches sockets
- Connection Handling → Request Queues: enqueues requests (evidence: `boa-0.94.13/src/request.c`)
- Connection Handling → HTTP Responses: sends overload response (evidence: `boa-0.94.13/src/request.c`)
- Socket Event Loop → Request Reading: dispatches I/O
- Request Reading → HTTP Parsing: provides request data
- Server Configuration → Config Parsing: parses configuration
- Config Parsing → Config Lexer: requests tokens
- HTTP Parsing → URI Translation: resolves request path
- URI Translation → Path Guard: validates path
- URI Translation → Static File Service: selects file
- Static File Service → MIME Lookup: looks up type
- Static File Service → Directory Listings: lists directory
- URI Translation → CGI Execution: selects script
- CGI Execution → CGI Headers: processes output headers
- CGI Execution → HTTP Responses: produces response
- HTTP Responses → Buffered Output: writes response
- Connection Handling → Buffered Output: flushes output (evidence: `boa-0.94.13/src/request.c`)
- Connection Handling → Request Logging: records errors
- Rust Entry Point → Path Guard Interface: uses interface
