# ilyashdev/tinynet architecture

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

## Overview

TinyNet is a dependency-free .NET HTTP/1 web framework, with an included notes application. Its main workflow is to build configuration, services, routes and middleware; accept a connection; parse each request; dispatch it through middleware, routing, filters and a handler; then write the response. The graph also preserves the example app’s notes flow and the framework’s configuration, DI and overload behavior. Unsampled relationships rely on explicit README statements or SOURCE INDEX references; no unsampled source is claimed as inspected.

Main entry points: [`TinyNet/Application/AppBuilder.cs`](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Application/AppBuilder.cs) (App builder), [`TinyNet/Protocols/Http1/ConnectionHandler.cs`](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Protocols/Http1/ConnectionHandler.cs) (Connection handler), [`TinyNet.Example/Pages/NotesPage.cs`](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Pages/NotesPage.cs) (Notes page handlers), [`TinyNet.Example/Program.cs`](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Program.cs) (Example registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Application setup"]
  node_builder["App builder<br/>[AppBuilder.cs]"]
  node_defaults["Framework defaults"]
  node_config["Configuration"]
end

subgraph group_http["HTTP runtime"]
  node_app["Web application<br/>[WebApplication.cs]"]
  node_listener["TCP listener"]
  node_connection["Connection handler"]
  node_parser["HTTP head parser<br/>[HeadParser.cs]"]
  node_body["Request body streams"]
  node_requestmodel["HTTP request<br/>[HttpRequest.cs]"]
  node_context["Request context<br/>[HttpContext.cs]"]
  node_response["Response builder and model<br/>[ResponseBuilder.cs]"]
  node_writer["HTTP response writer<br/>[ResponseWriter.cs]"]
end

subgraph group_request["Request handling"]
  node_routes["Route tree<br/>[GroupRoute.cs]"]
  node_compiler["Route compiler<br/>[RouteCompiler.cs]"]
  node_router["URL router<br/>[UrlRouter.cs]"]
  node_dispatcher["Route dispatcher<br/>[RouteDispatcher.cs]"]
  node_filters["Endpoint filters<br/>[Endpoint.cs]"]
  node_pipeline["Middleware pipeline"]
end

subgraph group_support["Framework services"]
  node_di["Dependency injection<br/>[DIContainer.cs]"]
  node_errors["Request errors"]
end

subgraph group_example["Notes example"]
  node_exampleprogram["Example registration<br/>[Program.cs]"]
  node_notespage["Notes page handlers<br/>[NotesPage.cs]"]
  node_notestore["Note store<br/>[NoteStore.cs]"]
  node_note["Note model<br/>[Note.cs]"]
  node_layout["Page layout and form<br/>[Layout.cs]"]
  node_requestid["Request ID service<br/>[RequestId.cs]"]
  node_requestidmw["Request ID middleware"]
  node_originfilter["Same-origin filter"]
end

node_client(("HTTP client"))

node_client -.->|"opens connection"| node_listener
node_builder -->|"builds configuration"| node_config
node_builder -->|"registers services"| node_di
node_builder -->|"compiles routes"| node_routes
node_builder -->|"builds pipeline"| node_pipeline
node_builder -->|"creates host"| node_app
node_builder -->|"loads defaults"| node_defaults
node_builder -->|"compiles tree"| node_compiler
node_compiler -->|"provides endpoints"| node_router
node_router -->|"dispatches request"| node_dispatcher
node_dispatcher -.->|"runs filters"| node_filters
node_pipeline -->|"invokes router"| node_dispatcher
node_app -->|"accepts connections"| node_listener
node_app -->|"handles connections"| node_connection
node_listener -.->|"yields connection"| node_connection
node_connection -->|"parses request head"| node_parser
node_connection -->|"creates body stream"| node_body
node_connection -->|"constructs request"| node_requestmodel
node_connection -->|"creates context"| node_context
node_connection -->|"invokes application"| node_pipeline
node_connection -->|"writes response"| node_writer
node_context -->|"resolves scoped services"| node_di
node_context -->|"creates builder"| node_response
node_connection -->|"opens request scope"| node_di
node_builder -->|"maps request errors"| node_errors
node_exampleprogram -->|"configures app"| node_builder
node_exampleprogram -->|"registers handlers"| node_notespage
node_exampleprogram -->|"registers service"| node_notestore
node_exampleprogram -->|"registers middleware"| node_requestidmw
node_exampleprogram -->|"attaches filter"| node_originfilter
node_notespage -->|"reads and updates"| node_notestore
node_notestore -->|"stores notes"| node_note
node_notespage -->|"renders pages"| node_layout
node_notespage -->|"uses identifier"| node_requestid
node_requestidmw -->|"uses identifier"| node_requestid
node_notespage -->|"reads request data"| node_requestmodel
node_notespage -->|"builds page response"| node_response

click node_builder "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Application/AppBuilder.cs"
click node_defaults "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Application/FrameworkDefaults.cs"
click node_config "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Configurations/ConfigurationBuilder.cs"
click node_di "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/DI/DIContainer.cs"
click node_routes "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/GroupRoute.cs"
click node_compiler "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/RouteCompiler.cs"
click node_router "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/UrlRouter.cs"
click node_dispatcher "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/RouteDispatcher.cs"
click node_filters "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/Endpoint.cs"
click node_pipeline "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Middlewares/MiddlewarePipeline.cs"
click node_app "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Application/WebApplication.cs"
click node_listener "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Transport/TcpConnectionListener.cs"
click node_connection "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Protocols/Http1/ConnectionHandler.cs"
click node_parser "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Protocols/Http1/HeadParser.cs"
click node_body "https://github.com/ilyashdev/tinynet/tree/master/TinyNet/Protocols/Streams"
click node_requestmodel "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Http/HttpRequest.cs"
click node_context "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Http/HttpContext.cs"
click node_response "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Http/ResponseBuilder.cs"
click node_writer "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Protocols/Http1/ResponseWriter.cs"
click node_errors "https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Exceptions/RequestException.cs"
click node_exampleprogram "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Program.cs"
click node_notespage "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Pages/NotesPage.cs"
click node_notestore "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Services/NoteStore.cs"
click node_note "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Models/Note.cs"
click node_layout "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Pages/Layout.cs"
click node_requestid "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Services/RequestId.cs"
click node_requestidmw "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Middlewares/RequestIdMiddleware.cs"
click node_originfilter "https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Filters/SameOriginFilter.cs"

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_builder,node_defaults,node_config,node_client toneBlue
class node_app,node_listener,node_connection,node_parser,node_body,node_requestmodel,node_context,node_response,node_writer toneAmber
class node_routes,node_compiler,node_router,node_dispatcher,node_filters,node_pipeline toneMint
class node_di,node_errors toneRose
class node_exampleprogram,node_notespage,node_notestore,node_note,node_layout,node_requestid,node_requestidmw,node_originfilter toneIndigo
```

## Components

### Application setup

- [App builder](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Application/AppBuilder.cs): `TinyNet/Application/AppBuilder.cs`
- [Framework defaults](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Application/FrameworkDefaults.cs): `TinyNet/Application/FrameworkDefaults.cs`
- [Configuration](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Configurations/ConfigurationBuilder.cs): `TinyNet/Configurations/ConfigurationBuilder.cs`

### HTTP runtime

- [Web application](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Application/WebApplication.cs): `TinyNet/Application/WebApplication.cs`
- [TCP listener](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Transport/TcpConnectionListener.cs): `TinyNet/Transport/TcpConnectionListener.cs`
- [Connection handler](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Protocols/Http1/ConnectionHandler.cs): `TinyNet/Protocols/Http1/ConnectionHandler.cs`
- [HTTP head parser](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Protocols/Http1/HeadParser.cs): `TinyNet/Protocols/Http1/HeadParser.cs`
- [Request body streams](https://github.com/ilyashdev/tinynet/tree/master/TinyNet/Protocols/Streams): `TinyNet/Protocols/Streams`
- [HTTP request](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Http/HttpRequest.cs): `TinyNet/Http/HttpRequest.cs`
- [Request context](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Http/HttpContext.cs): `TinyNet/Http/HttpContext.cs`
- [Response builder and model](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Http/ResponseBuilder.cs): `TinyNet/Http/ResponseBuilder.cs`
- [HTTP response writer](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Protocols/Http1/ResponseWriter.cs): `TinyNet/Protocols/Http1/ResponseWriter.cs`

### Request handling

- [Route tree](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/GroupRoute.cs): `TinyNet/Routing/GroupRoute.cs`
- [Route compiler](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/RouteCompiler.cs): `TinyNet/Routing/RouteCompiler.cs`
- [URL router](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/UrlRouter.cs): `TinyNet/Routing/UrlRouter.cs`
- [Route dispatcher](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/RouteDispatcher.cs): `TinyNet/Routing/RouteDispatcher.cs`
- [Endpoint filters](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Routing/Endpoint.cs): `TinyNet/Routing/Endpoint.cs`
- [Middleware pipeline](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Middlewares/MiddlewarePipeline.cs): `TinyNet/Middlewares/MiddlewarePipeline.cs`

### Framework services

- [Dependency injection](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/DI/DIContainer.cs): `TinyNet/DI/DIContainer.cs`
- [Request errors](https://github.com/ilyashdev/tinynet/blob/master/TinyNet/Exceptions/RequestException.cs): `TinyNet/Exceptions/RequestException.cs`

### Notes example

- [Example registration](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Program.cs): `TinyNet.Example/Program.cs`
- [Notes page handlers](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Pages/NotesPage.cs): `TinyNet.Example/Pages/NotesPage.cs`
- [Note store](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Services/NoteStore.cs): `TinyNet.Example/Services/NoteStore.cs`
- [Note model](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Models/Note.cs): `TinyNet.Example/Models/Note.cs`
- [Page layout and form](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Pages/Layout.cs): `TinyNet.Example/Pages/Layout.cs`
- [Request ID service](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Services/RequestId.cs): `TinyNet.Example/Services/RequestId.cs`
- [Request ID middleware](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Middlewares/RequestIdMiddleware.cs): `TinyNet.Example/Middlewares/RequestIdMiddleware.cs`
- [Same-origin filter](https://github.com/ilyashdev/tinynet/blob/master/TinyNet.Example/Filters/SameOriginFilter.cs): `TinyNet.Example/Filters/SameOriginFilter.cs`

### Other components

- **HTTP client**

## Connections

- HTTP client → TCP listener: opens connection (evidence: `README.md`)
- App builder → Configuration: builds configuration (evidence: `TinyNet/Application/AppBuilder.cs`)
- App builder → Dependency injection: registers services (evidence: `TinyNet/Application/AppBuilder.cs`)
- App builder → Route tree: compiles routes (evidence: `TinyNet/Application/AppBuilder.cs`)
- App builder → Middleware pipeline: builds pipeline (evidence: `TinyNet/Application/AppBuilder.cs`)
- App builder → Web application: creates host (evidence: `TinyNet/Application/AppBuilder.cs`)
- App builder → Framework defaults: loads defaults (evidence: `README.md`)
- App builder → Route compiler: compiles tree (evidence: `TinyNet/Application/AppBuilder.cs`)
- Route compiler → URL router: provides endpoints (evidence: `TinyNet/Application/AppBuilder.cs`)
- URL router → Route dispatcher: dispatches request (evidence: `README.md`)
- Route dispatcher → Endpoint filters: runs filters (evidence: `README.md`)
- Middleware pipeline → Route dispatcher: invokes router (evidence: `TinyNet/Application/AppBuilder.cs`)
- Web application → TCP listener: accepts connections (evidence: `README.md`)
- Web application → Connection handler: handles connections (evidence: `README.md`)
- TCP listener → Connection handler: yields connection (evidence: `README.md`)
- Connection handler → HTTP head parser: parses request head (evidence: `TinyNet/Protocols/Http1/ConnectionHandler.cs`)
- Connection handler → Request body streams: creates body stream (evidence: `TinyNet/Protocols/Http1/ConnectionHandler.cs`)
- Connection handler → HTTP request: constructs request (evidence: `TinyNet/Protocols/Http1/ConnectionHandler.cs`)
- Connection handler → Request context: creates context (evidence: `TinyNet/Protocols/Http1/ConnectionHandler.cs`)
- Connection handler → Middleware pipeline: invokes application (evidence: `TinyNet/Protocols/Http1/ConnectionHandler.cs`)
- Connection handler → HTTP response writer: writes response (evidence: `TinyNet/Protocols/Http1/ConnectionHandler.cs`)
- Request context → Dependency injection: resolves scoped services (evidence: `TinyNet/Http/HttpContext.cs`)
- Request context → Response builder and model: creates builder (evidence: `TinyNet/Http/HttpContext.cs`)
- Connection handler → Dependency injection: opens request scope (evidence: `TinyNet/Protocols/Http1/ConnectionHandler.cs`)
- App builder → Request errors: maps request errors (evidence: `TinyNet/Application/AppBuilder.cs`)
- Example registration → App builder: configures app (evidence: `TinyNet.Example/Program.cs`)
- Example registration → Notes page handlers: registers handlers (evidence: `TinyNet.Example/Program.cs`)
- Example registration → Note store: registers service (evidence: `TinyNet.Example/Program.cs`)
- Example registration → Request ID middleware: registers middleware (evidence: `TinyNet.Example/Program.cs`)
- Example registration → Same-origin filter: attaches filter (evidence: `TinyNet.Example/Program.cs`)
- Notes page handlers → Note store: reads and updates (evidence: `TinyNet.Example/Pages/NotesPage.cs`)
- Note store → Note model: stores notes (evidence: `TinyNet.Example/Services/NoteStore.cs`)
- Notes page handlers → Page layout and form: renders pages (evidence: `TinyNet.Example/Pages/NotesPage.cs`)
- Notes page handlers → Request ID service: uses identifier (evidence: `TinyNet.Example/Pages/NotesPage.cs`)
- Request ID middleware → Request ID service: uses identifier (evidence: `TinyNet.Example/Middlewares/RequestIdMiddleware.cs`)
- Notes page handlers → HTTP request: reads request data (evidence: `TinyNet.Example/Pages/NotesPage.cs`)
- Notes page handlers → Response builder and model: builds page response (evidence: `TinyNet.Example/Pages/NotesPage.cs`)
