# stasync/keel-dotnet architecture

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

- Interactive diagram: https://gitdiagram.com/stasync/keel-dotnet
- Repository: https://github.com/stasync/keel-dotnet

## Overview

Keel is a set of base libraries: reliable UDP messaging, dependency injection with scoped object construction and events, and reusable utilities. The main workflows are application code using the client/server Update loop or configuring a binder and resolving services; serialization, UDP transport, factories, injection, and event dispatch are internal layers. Networking and dependency injection both depend on Utils as documented. Some capabilities are documented but their implementation was not sampled, so those links are shown only where evidence supports them.

Main entry points: [`dependency_injection/Scope.cs`](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Scope.cs) (Scopes and resolution), [`networking/Udp/LowLevel/UdpProtocol.cs`](https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/UdpProtocol.cs) (Delivery protocol), [`dependency_injection/Events/Broadcaster.cs`](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Events/Broadcaster.cs) (Event broadcaster), [`utils/Debug/Logger.cs`](https://github.com/stasync/keel-dotnet/blob/main/utils/Debug/Logger.cs) (Logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_networking["UDP networking"]
  node_reliable_client["Reliable client"]
  node_reliable_server["Reliable server"]
  node_protocol["Delivery protocol<br/>[UdpProtocol.cs]"]
  node_transport["UDP transport<br/>[UdpTransport.cs]"]
  node_serialization["Message serialization<br/>[NetWriter.cs]"]
  node_reader["Message reading<br/>[NetReader.cs]"]
  node_simulators["Packet simulators"]
  node_transfer_layers["Transfer layers"]
end

subgraph group_injection["Dependency injection"]
  node_binder["Scope binder<br/>[ScopeBinder.cs]"]
  node_dependency_map["Dependency map"]
  node_root_scope["Root scope<br/>[RootScope.cs]"]
  node_scope["Scopes and resolution<br/>[Scope.cs]"]
  node_factories["Instance factories<br/>[InstanceFactory.cs]"]
  node_injection_cache["Injection targets"]
  node_cycle_check["Cycle detection"]
  node_broadcaster["Event broadcaster<br/>[Broadcaster.cs]"]
  node_event_cache["Listener discovery"]
end

subgraph group_utilities["Utilities"]
  node_logger["Logging<br/>[Logger.cs]"]
  node_log_worker["Queued log worker<br/>[LogWorker.cs]"]
  node_worker["Background workers<br/>[Worker.cs]"]
  node_launch_args["Launch arguments<br/>[LaunchArguments.cs]"]
  node_encryption["Encryption utilities"]
  node_domain_utils["Domain helpers<br/>[DomainUtils.cs]"]
end

node_app(("Application"))
node_udp_peer(("UDP peer"))

node_app -->|"connects and updates"| node_reliable_client
node_app -->|"updates and handles"| node_reliable_server
node_reliable_client -->|"delegates delivery"| node_protocol
node_reliable_server -.->|"uses protocol"| node_protocol
node_protocol -->|"sends datagrams"| node_transport
node_protocol -->|"registers simulators"| node_simulators
node_protocol -->|"registers layers"| node_transfer_layers
node_udp_peer -.->|"exchanges datagrams"| node_transport
node_app -->|"packs messages"| node_serialization
node_serialization -->|"paired decoding"| node_reader
node_app -->|"reads messages"| node_reader
node_app -->|"configures bindings"| node_binder
node_binder -->|"builds map"| node_dependency_map
node_app -->|"creates scope"| node_root_scope
node_root_scope -->|"initializes scope"| node_scope
node_scope -->|"resolves from"| node_dependency_map
node_scope -.->|"produces instances"| node_factories
node_scope -->|"finds injection targets"| node_injection_cache
node_scope -->|"validates dependencies"| node_cycle_check
node_scope -.->|"supports event service"| node_broadcaster
node_broadcaster -->|"discovers listeners"| node_event_cache
node_app -->|"broadcasts events"| node_broadcaster
node_log_worker -->|"runs on"| node_worker
node_log_worker -.->|"logs output"| node_logger
node_app -->|"writes logs"| node_logger
node_app -->|"reads settings"| node_launch_args
node_app -->|"uses encryption"| node_encryption
node_app -->|"runs background work"| node_worker
node_logger -.->|"utility dependency"| node_domain_utils

click node_reliable_client "https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/ReliableUdpClient.cs"
click node_reliable_server "https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/ReliableUdpServer.cs"
click node_protocol "https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/UdpProtocol.cs"
click node_transport "https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/UdpTransport.cs"
click node_serialization "https://github.com/stasync/keel-dotnet/blob/main/networking/NetWriter.cs"
click node_reader "https://github.com/stasync/keel-dotnet/blob/main/networking/NetReader.cs"
click node_simulators "https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/IncomingPacketSimulator.cs"
click node_transfer_layers "https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/DataTransferLayer.cs"
click node_binder "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/ScopeBinder.cs"
click node_dependency_map "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/ScopeDependencyMap.cs"
click node_root_scope "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/RootScope.cs"
click node_scope "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Scope.cs"
click node_factories "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Factories/InstanceFactory.cs"
click node_injection_cache "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Internal/InjectionTargetsCache.cs"
click node_cycle_check "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Diagnostics/CircularDependencyDetector.cs"
click node_broadcaster "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Events/Broadcaster.cs"
click node_event_cache "https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Events/Internal/EventListenerMethodCache.cs"
click node_logger "https://github.com/stasync/keel-dotnet/blob/main/utils/Debug/Logger.cs"
click node_log_worker "https://github.com/stasync/keel-dotnet/blob/main/utils/Debug/LogWorker.cs"
click node_worker "https://github.com/stasync/keel-dotnet/blob/main/utils/Threading/Worker.cs"
click node_launch_args "https://github.com/stasync/keel-dotnet/blob/main/utils/LaunchArguments.cs"
click node_encryption "https://github.com/stasync/keel-dotnet/blob/main/utils/Security/EncryptionUtility.cs"
click node_domain_utils "https://github.com/stasync/keel-dotnet/blob/main/utils/DomainUtils.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_reliable_client,node_reliable_server,node_protocol,node_transport,node_serialization,node_reader,node_simulators,node_transfer_layers toneBlue
class node_binder,node_dependency_map,node_root_scope,node_scope,node_factories,node_injection_cache,node_cycle_check,node_broadcaster,node_event_cache toneAmber
class node_logger,node_log_worker,node_worker,node_launch_args,node_encryption,node_domain_utils toneMint
class node_app,node_udp_peer toneIndigo
```

## Components

### UDP networking

- [Reliable client](https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/ReliableUdpClient.cs): `networking/Udp/ReliableUdpClient.cs`
- [Reliable server](https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/ReliableUdpServer.cs): `networking/Udp/ReliableUdpServer.cs`
- [Delivery protocol](https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/UdpProtocol.cs): `networking/Udp/LowLevel/UdpProtocol.cs`
- [UDP transport](https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/UdpTransport.cs): `networking/Udp/LowLevel/UdpTransport.cs`
- [Message serialization](https://github.com/stasync/keel-dotnet/blob/main/networking/NetWriter.cs): `networking/NetWriter.cs`
- [Message reading](https://github.com/stasync/keel-dotnet/blob/main/networking/NetReader.cs): `networking/NetReader.cs`
- [Packet simulators](https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/IncomingPacketSimulator.cs): `networking/Udp/LowLevel/IncomingPacketSimulator.cs`
- [Transfer layers](https://github.com/stasync/keel-dotnet/blob/main/networking/Udp/LowLevel/DataTransferLayer.cs): `networking/Udp/LowLevel/DataTransferLayer.cs`

### Dependency injection

- [Scope binder](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/ScopeBinder.cs): `dependency_injection/ScopeBinder.cs`
- [Dependency map](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/ScopeDependencyMap.cs): `dependency_injection/ScopeDependencyMap.cs`
- [Root scope](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/RootScope.cs): `dependency_injection/RootScope.cs`
- [Scopes and resolution](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Scope.cs): `dependency_injection/Scope.cs`
- [Instance factories](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Factories/InstanceFactory.cs): `dependency_injection/Factories/InstanceFactory.cs`
- [Injection targets](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Internal/InjectionTargetsCache.cs): `dependency_injection/Internal/InjectionTargetsCache.cs`
- [Cycle detection](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Diagnostics/CircularDependencyDetector.cs): `dependency_injection/Diagnostics/CircularDependencyDetector.cs`
- [Event broadcaster](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Events/Broadcaster.cs): `dependency_injection/Events/Broadcaster.cs`
- [Listener discovery](https://github.com/stasync/keel-dotnet/blob/main/dependency_injection/Events/Internal/EventListenerMethodCache.cs): `dependency_injection/Events/Internal/EventListenerMethodCache.cs`

### Utilities

- [Logging](https://github.com/stasync/keel-dotnet/blob/main/utils/Debug/Logger.cs): `utils/Debug/Logger.cs`
- [Queued log worker](https://github.com/stasync/keel-dotnet/blob/main/utils/Debug/LogWorker.cs): `utils/Debug/LogWorker.cs`
- [Background workers](https://github.com/stasync/keel-dotnet/blob/main/utils/Threading/Worker.cs): `utils/Threading/Worker.cs`
- [Launch arguments](https://github.com/stasync/keel-dotnet/blob/main/utils/LaunchArguments.cs): `utils/LaunchArguments.cs`
- [Encryption utilities](https://github.com/stasync/keel-dotnet/blob/main/utils/Security/EncryptionUtility.cs): `utils/Security/EncryptionUtility.cs`
- [Domain helpers](https://github.com/stasync/keel-dotnet/blob/main/utils/DomainUtils.cs): `utils/DomainUtils.cs`

### Other components

- **Application**
- **UDP peer**

## Connections

- Application → Reliable client: connects and updates
- Application → Reliable server: updates and handles
- Reliable client → Delivery protocol: delegates delivery (evidence: `networking/Udp/ReliableUdpClient.cs`)
- Reliable server → Delivery protocol: uses protocol
- Delivery protocol → UDP transport: sends datagrams (evidence: `networking/Udp/LowLevel/UdpProtocol.cs`)
- Delivery protocol → Packet simulators: registers simulators (evidence: `networking/Udp/LowLevel/UdpProtocol.cs`)
- Delivery protocol → Transfer layers: registers layers (evidence: `networking/Udp/LowLevel/UdpProtocol.cs`)
- UDP peer → UDP transport: exchanges datagrams
- Application → Message serialization: packs messages
- Message serialization → Message reading: paired decoding (evidence: `networking/NetReader.cs`)
- Application → Message reading: reads messages
- Application → Scope binder: configures bindings
- Scope binder → Dependency map: builds map (evidence: `dependency_injection/ScopeBinder.cs`)
- Application → Root scope: creates scope
- Root scope → Scopes and resolution: initializes scope (evidence: `dependency_injection/RootScope.cs`)
- Scopes and resolution → Dependency map: resolves from (evidence: `dependency_injection/Scope.cs`)
- Scopes and resolution → Instance factories: produces instances
- Scopes and resolution → Injection targets: finds injection targets (evidence: `dependency_injection/Scope.cs`)
- Scopes and resolution → Cycle detection: validates dependencies (evidence: `dependency_injection/Scope.cs`)
- Scopes and resolution → Event broadcaster: supports event service
- Event broadcaster → Listener discovery: discovers listeners (evidence: `dependency_injection/Events/Broadcaster.cs`)
- Application → Event broadcaster: broadcasts events
- Queued log worker → Background workers: runs on (evidence: `utils/Debug/LogWorker.cs`)
- Queued log worker → Logging: logs output
- Application → Logging: writes logs (evidence: `utils/Debug/Logger.cs`)
- Application → Launch arguments: reads settings
- Application → Encryption utilities: uses encryption
- Application → Background workers: runs background work
- Logging → Domain helpers: utility dependency
