# facil-io/cstl architecture

> Architecture diagram of the GitHub repository facil-io/cstl, 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/facil-io/cstl
- Repository: https://github.com/facil-io/cstl

## Overview

facil.io is a C/C++ header-oriented toolbox and microframework for building network services, with reusable data structures, parsers, cryptography, and runtime services. A typical service uses the IO/reactor facilities to handle network traffic, then HTTP and optional WebSocket or SSE capabilities to serve clients. The README also documents a broad standalone STL-style utility layer. The source index and excerpts establish module boundaries and some capabilities, but do not show most runtime call wiring; uncertain relationships are therefore omitted rather than inferred.

Main entry points: [`fio-stl/include.h`](https://github.com/facil-io/cstl/blob/master/fio-stl/include.h) (Combined Include), [`fio-stl/430 http api.h`](https://github.com/facil-io/cstl/blob/master/fio-stl/430%20http%20api.h) (HTTP Server), [`fio-stl/403 io reactor.h`](https://github.com/facil-io/cstl/blob/master/fio-stl/403%20io%20reactor.h) (IO Reactor), [`fio-stl/102 poll api.h`](https://github.com/facil-io/cstl/blob/master/fio-stl/102%20poll%20api.h) (Poll Backends)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Network Runtime"]
  node_io["IO Reactor<br/>[403 io reactor.h]"]
  node_poll["Poll Backends<br/>[102 poll api.h]"]
  node_ipc["Interprocess Communication<br/>[404 ipc.h]"]
  node_pubsub["Pub/Sub Engine<br/>[420 pubsub.h]"]
end

subgraph group_protocols["Network Protocols"]
  node_http["HTTP Server<br/>[430 http api.h]"]
  node_http1parse["HTTP/1 Parser<br/>[004 http1 parser.h]"]
  node_websocket["WebSocket Support<br/>[434 websocket.h]"]
  node_websocketparse["WebSocket Parser"]
  node_sse["Server-Sent Events<br/>[434 sse.h]"]
  node_redis["Redis Client<br/>[422 redis.h]"]
  node_resp3["RESP3 Parser<br/>[004 resp3.h]"]
end

subgraph group_security["Security"]
  node_tls["TLS 1.3<br/>[190 tls13.h]"]
  node_crypto["Cryptography<br/>[150 crypto core.h]"]
end

subgraph group_types["Data Types"]
  node_fiobj["FIOBJ Values<br/>[250 fiobj.h]"]
  node_strings["Binary-Safe Strings<br/>[201 string.h]"]
  node_arrays["Typed Arrays<br/>[202 array.h]"]
  node_maps["Typed Maps<br/>[210 map.h]"]
end

subgraph group_utilities["Core Utilities"]
  node_memory["Memory Allocator<br/>[010 mem.h]"]
  node_core["Platform Core<br/>[000 core.h]"]
  node_numeric["Numeric Helpers<br/>[002 atol.h]"]
  node_crc["CRC32<br/>[002 crc32.h]"]
  node_files["File Utilities<br/>[004 files.h]"]
  node_cli["Command-Line Tools<br/>[005 cli.h]"]
  node_markdown["Markdown Parser<br/>[012 gfm.h]"]
  node_json["JSON Parser<br/>[012 json.h]"]
  node_entry["Combined Include<br/>[include.h]"]
end

node_developer(("Application Developer"))
node_client(("Network Client"))

node_developer -->|"uses library"| node_entry
node_client -.->|"sends requests"| node_http
node_http -.->|"supports chat"| node_websocket
node_http -.->|"supports events"| node_sse
node_entry -->|"includes modules"| node_http
node_entry -->|"includes modules"| node_io
node_entry -->|"includes modules"| node_tls
node_entry -->|"includes modules"| node_pubsub
node_entry -->|"includes modules"| node_redis
node_entry -->|"includes modules"| node_fiobj
node_entry -->|"includes modules"| node_strings
node_entry -->|"includes modules"| node_arrays
node_entry -->|"includes modules"| node_maps
node_entry -->|"includes modules"| node_memory
node_entry -->|"includes modules"| node_markdown
node_entry -->|"includes modules"| node_json
node_entry -->|"includes modules"| node_ipc
node_entry -->|"includes modules"| node_http1parse
node_entry -->|"includes modules"| node_websocketparse
node_entry -->|"includes modules"| node_resp3
node_entry -->|"includes modules"| node_crypto
node_entry -->|"includes modules"| node_poll
node_entry -->|"includes modules"| node_core
node_entry -->|"includes modules"| node_numeric
node_entry -->|"includes modules"| node_crc
node_entry -->|"includes modules"| node_files
node_entry -->|"includes modules"| node_cli

click node_io "https://github.com/facil-io/cstl/blob/master/fio-stl/403%20io%20reactor.h"
click node_poll "https://github.com/facil-io/cstl/blob/master/fio-stl/102%20poll%20api.h"
click node_ipc "https://github.com/facil-io/cstl/blob/master/fio-stl/404%20ipc.h"
click node_pubsub "https://github.com/facil-io/cstl/blob/master/fio-stl/420%20pubsub.h"
click node_http "https://github.com/facil-io/cstl/blob/master/fio-stl/430%20http%20api.h"
click node_http1parse "https://github.com/facil-io/cstl/blob/master/fio-stl/004%20http1%20parser.h"
click node_websocket "https://github.com/facil-io/cstl/blob/master/fio-stl/434%20websocket.h"
click node_websocketparse "https://github.com/facil-io/cstl/blob/master/fio-stl/004%20websocket%20parser.h"
click node_sse "https://github.com/facil-io/cstl/blob/master/fio-stl/434%20sse.h"
click node_redis "https://github.com/facil-io/cstl/blob/master/fio-stl/422%20redis.h"
click node_resp3 "https://github.com/facil-io/cstl/blob/master/fio-stl/004%20resp3.h"
click node_tls "https://github.com/facil-io/cstl/blob/master/fio-stl/190%20tls13.h"
click node_crypto "https://github.com/facil-io/cstl/blob/master/fio-stl/150%20crypto%20core.h"
click node_fiobj "https://github.com/facil-io/cstl/blob/master/fio-stl/250%20fiobj.h"
click node_strings "https://github.com/facil-io/cstl/blob/master/fio-stl/201%20string.h"
click node_arrays "https://github.com/facil-io/cstl/blob/master/fio-stl/202%20array.h"
click node_maps "https://github.com/facil-io/cstl/blob/master/fio-stl/210%20map.h"
click node_memory "https://github.com/facil-io/cstl/blob/master/fio-stl/010%20mem.h"
click node_core "https://github.com/facil-io/cstl/blob/master/fio-stl/000%20core.h"
click node_numeric "https://github.com/facil-io/cstl/blob/master/fio-stl/002%20atol.h"
click node_crc "https://github.com/facil-io/cstl/blob/master/fio-stl/002%20crc32.h"
click node_files "https://github.com/facil-io/cstl/blob/master/fio-stl/004%20files.h"
click node_cli "https://github.com/facil-io/cstl/blob/master/fio-stl/005%20cli.h"
click node_markdown "https://github.com/facil-io/cstl/blob/master/fio-stl/012%20gfm.h"
click node_json "https://github.com/facil-io/cstl/blob/master/fio-stl/012%20json.h"
click node_entry "https://github.com/facil-io/cstl/blob/master/fio-stl/include.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_io,node_poll,node_ipc,node_pubsub,node_client toneBlue
class node_http,node_http1parse,node_websocket,node_websocketparse,node_sse,node_redis,node_resp3 toneAmber
class node_tls,node_crypto toneMint
class node_fiobj,node_strings,node_arrays,node_maps toneRose
class node_memory,node_core,node_numeric,node_crc,node_files,node_cli,node_markdown,node_json,node_entry,node_developer toneIndigo
```

## Components

### Network Runtime

- [IO Reactor](https://github.com/facil-io/cstl/blob/master/fio-stl/403%20io%20reactor.h): `fio-stl/403 io reactor.h`
- [Poll Backends](https://github.com/facil-io/cstl/blob/master/fio-stl/102%20poll%20api.h): `fio-stl/102 poll api.h`
- [Interprocess Communication](https://github.com/facil-io/cstl/blob/master/fio-stl/404%20ipc.h): `fio-stl/404 ipc.h`
- [Pub/Sub Engine](https://github.com/facil-io/cstl/blob/master/fio-stl/420%20pubsub.h): `fio-stl/420 pubsub.h`

### Network Protocols

- [HTTP Server](https://github.com/facil-io/cstl/blob/master/fio-stl/430%20http%20api.h): `fio-stl/430 http api.h`
- [HTTP/1 Parser](https://github.com/facil-io/cstl/blob/master/fio-stl/004%20http1%20parser.h): `fio-stl/004 http1 parser.h`
- [WebSocket Support](https://github.com/facil-io/cstl/blob/master/fio-stl/434%20websocket.h): `fio-stl/434 websocket.h`
- [WebSocket Parser](https://github.com/facil-io/cstl/blob/master/fio-stl/004%20websocket%20parser.h): `fio-stl/004 websocket parser.h`
- [Server-Sent Events](https://github.com/facil-io/cstl/blob/master/fio-stl/434%20sse.h): `fio-stl/434 sse.h`
- [Redis Client](https://github.com/facil-io/cstl/blob/master/fio-stl/422%20redis.h): `fio-stl/422 redis.h`
- [RESP3 Parser](https://github.com/facil-io/cstl/blob/master/fio-stl/004%20resp3.h): `fio-stl/004 resp3.h`

### Security

- [TLS 1.3](https://github.com/facil-io/cstl/blob/master/fio-stl/190%20tls13.h): `fio-stl/190 tls13.h`
- [Cryptography](https://github.com/facil-io/cstl/blob/master/fio-stl/150%20crypto%20core.h): `fio-stl/150 crypto core.h`

### Data Types

- [FIOBJ Values](https://github.com/facil-io/cstl/blob/master/fio-stl/250%20fiobj.h): `fio-stl/250 fiobj.h`
- [Binary-Safe Strings](https://github.com/facil-io/cstl/blob/master/fio-stl/201%20string.h): `fio-stl/201 string.h`
- [Typed Arrays](https://github.com/facil-io/cstl/blob/master/fio-stl/202%20array.h): `fio-stl/202 array.h`
- [Typed Maps](https://github.com/facil-io/cstl/blob/master/fio-stl/210%20map.h): `fio-stl/210 map.h`

### Core Utilities

- [Memory Allocator](https://github.com/facil-io/cstl/blob/master/fio-stl/010%20mem.h): `fio-stl/010 mem.h`
- [Platform Core](https://github.com/facil-io/cstl/blob/master/fio-stl/000%20core.h): `fio-stl/000 core.h`
- [Numeric Helpers](https://github.com/facil-io/cstl/blob/master/fio-stl/002%20atol.h): `fio-stl/002 atol.h`
- [CRC32](https://github.com/facil-io/cstl/blob/master/fio-stl/002%20crc32.h): `fio-stl/002 crc32.h`
- [File Utilities](https://github.com/facil-io/cstl/blob/master/fio-stl/004%20files.h): `fio-stl/004 files.h`
- [Command-Line Tools](https://github.com/facil-io/cstl/blob/master/fio-stl/005%20cli.h): `fio-stl/005 cli.h`
- [Markdown Parser](https://github.com/facil-io/cstl/blob/master/fio-stl/012%20gfm.h): `fio-stl/012 gfm.h`
- [JSON Parser](https://github.com/facil-io/cstl/blob/master/fio-stl/012%20json.h): `fio-stl/012 json.h`
- [Combined Include](https://github.com/facil-io/cstl/blob/master/fio-stl/include.h): `fio-stl/include.h`

### Other components

- **Application Developer**
- **Network Client**

## Connections

- Application Developer → Combined Include: uses library (evidence: `README.md`)
- Network Client → HTTP Server: sends requests
- HTTP Server → WebSocket Support: supports chat
- HTTP Server → Server-Sent Events: supports events
- Combined Include → HTTP Server: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → IO Reactor: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → TLS 1.3: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Pub/Sub Engine: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Redis Client: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → FIOBJ Values: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Binary-Safe Strings: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Typed Arrays: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Typed Maps: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Memory Allocator: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Markdown Parser: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → JSON Parser: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Interprocess Communication: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → HTTP/1 Parser: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → WebSocket Parser: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → RESP3 Parser: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Cryptography: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Poll Backends: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Platform Core: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Numeric Helpers: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → CRC32: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → File Utilities: includes modules (evidence: `fio-stl/include.h`)
- Combined Include → Command-Line Tools: includes modules (evidence: `fio-stl/include.h`)
