# quantumdevteam/stellarengine architecture

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

- Interactive diagram: https://gitdiagram.com/quantumdevteam/stellarengine
- Repository: https://github.com/quantumdevteam/stellarengine

## Overview

1. **Repository shape**
   StellarEngine is a monorepo split into three main product areas: **Kernel**, **Engine**, and **SDK**. The design is intentionally hypermodular: the same engine capabilities can be reused in runtime, tools, installers, and editor-like contexts rather than being locked into a single app shape.

2. **Kernel = shared contract layer**
   `Kernel/src/Stellar.Kernel` defines the stable-facing abstractions and interfaces. It contains core contracts for **data containers, registries, identifiers, labels, quantization, contexts, failures, file system access, logging, events, and task scheduling**. This is the lowest common dependency for the rest of the repository.

3. **Engine = concrete runtime implementations**
   `Engine/src/Modules` contains the actual managed implementations of those concepts. `Stellar.Core` is the main foundational runtime module and provides concrete data structures, global environment support, failure dispatching, registries, and entry-point behavior. Other managed modules build outward from there: file system, logging, event system, task system, time system, stage, network, physics, graphics, UI, assets, and audio.

4. **Dependency direction**
   The dependency boundary is clear: **Kernel defines the APIs, Engine implements them**. This lets tools and future products depend on the contract layer without needing the full engine runtime, while engine modules can swap or extend implementations as the system evolves.

5. **Cross-cutting runtime subsystems**
   Several systems are shared across the engine surface:
   - **LoggingSystem** for logging formats, logger metadata, and runtime config.
   - **Failures** for typed failure levels, dispatching, catches, and handlers.
   - **EventSystem** for event buses, queues, handlers, and event context.
   - **TaskSystem** for scheduling and threading abstractions.
   - **Data/Context/Registry** for modular state and metadata storage.
   These are the coordination backbone for higher-level modules.

6. **File and asset boundaries**
   File access is modeled as a domain/provider abstraction in both Kernel and Engine. `Stellar.FileSystem` provides concrete providers such as assembly-backed and file-system-backed access. Asset-related configuration appears in the Kernel configuration area, suggesting project assets are a first-class pipeline concern rather than an ad hoc feature.

7. **Native engine layer**
   The repository also includes native code under `Engine/src/Native` and `Engine/src/NativeInterop`. This is where platform-specific runtime pieces live, especially for **graphics (DX12/OGL), windowing, and physics**. The `NativeInterop` projects are the bridge between managed C# modules and native libraries, so the architecture has a managed core with native acceleration/support at the edges.

8. **SDK = authoring, packaging, and project tooling**
   `SDK/src` is the developer tooling layer. It contains:
   - **Stellar.CLI** for commands like info, versions, project creation, docs generation, template listing, and SDK installation.
   - **Stellar.Sdk** MSBuild targets and props that integrate Stellar-specific project behavior into .NET builds.
   - **Stellar.Sdk.Tasks** for project/config parsing and generation.
   - **Stellar.ProjectAnalyzer** Roslyn analyzers that validate Stellar project patterns at compile time.
   - **Stellar.Tools** for configuration object models used by tooling.

9. **Project configuration and code generation flow**
   Tooling centers around Stellar project metadata and configuration files. The analyzer and MSBuild tasks read project configuration, validate entry-point usage, and generate build/runtime artifacts such as config or executable metadata. This means project structure is not purely convention-based; it is actively interpreted by the SDK toolchain.

10. **Build, packaging, and distribution**
    Packaging scripts exist for the Engine, Kernel, SDK, CLI, and tools, and the repo includes a custom data/template area plus a workload manifest template. That indicates distribution is split across multiple packages rather than one monolithic release. `version.props`, the `.stellar.project` files, and the package scripts form the release/build boundary.

11. **Runtime entry-point model**
    Both Kernel and Engine contain explicit entry-point and stop-context types. This suggests application startup is a controlled framework concern: modules participate through a Stellar entry-point contract rather than through arbitrary `Main`-style wiring. The analyzer in the SDK likely reinforces this model.

12. **Overall diagram perspective**
    A good architecture diagram should show three tiers of responsibility:
    - **Kernel**: interfaces/contracts and shared models.
    - **Engine**: runtime implementations and native-backed modules.
    - **SDK**: build-time, packaging, validation, and project-authoring tools.
    The main data flow is from project configuration and build tooling into generated/runtime engine behavior, while runtime module communication flows through logging, failures, events, task scheduling, and registries.

Main entry points: [`Kernel/src/Stellar.Kernel`](https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel) (Contracts), [`Engine/src/Modules/Stellar.Core`](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.Core) (Core), [`Engine/src/Modules`](https://github.com/quantumdevteam/stellarengine/tree/master/Engine/src/Modules) (Feature Modules), [`SDK/src/Stellar.CLI`](https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/Stellar.CLI) (CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kernel["Kernel"]
  node_kernel_contracts["Contracts<br/>api layer<br/>[Stellar.Kernel]"]
  node_kernel_config["Project Config<br/>config model<br/>[Configuration]"]
  node_kernel_entry["Entry Point<br/>startup contract<br/>[EntryPoint]"]
  node_kernel_runtime["Runtime APIs<br/>core interfaces<br/>[Stellar.Kernel]"]
end

subgraph group_engine["Engine"]
  node_engine_core["Core<br/>runtime base<br/>[Stellar.Core]"]
  node_engine_fs["File System<br/>provider runtime<br/>[Stellar.FileSystem]"]
  node_engine_logging["Logging<br/>runtime system"]
  node_engine_failures["Failures<br/>runtime system<br/>[Failures]"]
  node_engine_events["Events<br/>runtime bus"]
  node_engine_tasks["Tasks<br/>scheduler<br/>[Stellar.TaskSystem]"]
  node_engine_data["Data & Registry<br/>state backbone<br/>[Data]"]
  node_engine_native_graphics["Native Graphics<br/>native backend"]
  node_engine_native_physics["Native Physics<br/>native backend"]
  node_engine_mid["Feature Modules<br/>managed subsystems"]
end

subgraph group_sdk["SDK"]
  node_sdk_cli["CLI<br/>developer tool<br/>[Stellar.CLI]"]
  node_sdk_msbuild["MSBuild SDK<br/>build integration<br/>[Stellar.Sdk]"]
  node_sdk_tasks["Build Tasks<br/>generator tasks<br/>[Stellar.Sdk.Tasks]"]
  node_sdk_analyzer["Project Analyzer<br/>roslyn analyzer"]
  node_sdk_tools["Tools Models<br/>tooling model<br/>[Stellar.Tools]"]
  node_data_template["Templates<br/>packaging assets"]
end

node_kernel_contracts -->|"defines"| node_kernel_runtime
node_kernel_contracts -->|"includes"| node_kernel_config
node_kernel_contracts -->|"includes"| node_kernel_entry
node_engine_core -->|"owns"| node_engine_data
node_engine_core -->|"dispatches"| node_engine_failures
node_engine_core -->|"coordinates"| node_engine_events
node_engine_core -->|"schedules"| node_engine_tasks
node_engine_core -->|"uses"| node_engine_fs
node_engine_core -->|"uses"| node_engine_logging
node_engine_mid -->|"builds on"| node_engine_core
node_engine_mid -->|"bridges"| node_engine_native_graphics
node_engine_mid -->|"bridges"| node_engine_native_physics
node_engine_fs -->|"implements"| node_kernel_contracts
node_engine_logging -->|"implements"| node_kernel_contracts
node_engine_failures -->|"implements"| node_kernel_contracts
node_engine_events -->|"implements"| node_kernel_contracts
node_engine_tasks -->|"implements"| node_kernel_contracts
node_engine_data -->|"implements"| node_kernel_contracts
node_engine_native_graphics -.->|"loads"| node_engine_fs
node_engine_native_physics -.->|"supports"| node_engine_core
node_sdk_msbuild -->|"targets"| node_kernel_contracts
node_sdk_tasks -->|"parses"| node_sdk_tools
node_sdk_tasks -->|"reads"| node_kernel_config
node_sdk_analyzer -->|"validates"| node_kernel_entry
node_sdk_analyzer -->|"validates"| node_kernel_config
node_sdk_cli -->|"invokes"| node_sdk_tasks
node_sdk_cli -->|"supports"| node_sdk_msbuild
node_sdk_msbuild -->|"packages"| node_data_template
node_sdk_cli -->|"scaffolds"| node_data_template

click node_kernel_contracts "https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel"
click node_kernel_config "https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel/Configuration"
click node_kernel_entry "https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel/EntryPoint"
click node_kernel_runtime "https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel"
click node_engine_core "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.Core"
click node_engine_fs "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.FileSystem"
click node_engine_logging "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.LoggingSystem"
click node_engine_failures "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.Core/Failures"
click node_engine_events "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.EventSystem"
click node_engine_tasks "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.TaskSystem"
click node_engine_data "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.Core/Data"
click node_engine_native_graphics "https://github.com/quantumdevteam/stellarengine/tree/master/Engine/src/Native"
click node_engine_native_physics "https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Native/Stellar.Native.Physics"
click node_engine_mid "https://github.com/quantumdevteam/stellarengine/tree/master/Engine/src/Modules"
click node_sdk_cli "https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/Stellar.CLI"
click node_sdk_msbuild "https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/MSBuild/Stellar.Sdk"
click node_sdk_tasks "https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/MSBuild/Stellar.Sdk.Tasks"
click node_sdk_analyzer "https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/Roslyn/Stellar.ProjectAnalyzer"
click node_sdk_tools "https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/Stellar.Tools"
click node_data_template "https://github.com/quantumdevteam/stellarengine/tree/master/Data/Template/SDK"

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_kernel_contracts,node_kernel_config,node_kernel_entry,node_kernel_runtime toneBlue
class node_engine_core,node_engine_fs,node_engine_logging,node_engine_failures,node_engine_events,node_engine_tasks,node_engine_data,node_engine_native_graphics,node_engine_native_physics,node_engine_mid toneAmber
class node_sdk_cli,node_sdk_msbuild,node_sdk_tasks,node_sdk_analyzer,node_sdk_tools,node_data_template toneMint
```

## Components

### Kernel

Shared contracts, core models, and stable APIs.

- [Contracts](https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel): api layer · Stable abstractions for data, context, registry, entry-point, failure, logging, files, events, and tasks. · `Kernel/src/Stellar.Kernel`
- [Project Config](https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel/Configuration): config model · Project and runtime configuration contracts, including assets and localization metadata. · `Kernel/src/Stellar.Kernel/Configuration`
- [Entry Point](https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel/EntryPoint): startup contract · Application startup and stop-context abstractions for controlled module launch. · `Kernel/src/Stellar.Kernel/EntryPoint`
- [Runtime APIs](https://github.com/quantumdevteam/stellarengine/blob/master/Kernel/src/Stellar.Kernel): core interfaces · Interfaces for data containers, registries, identifiers, labels, quantization, logging, failures, files, events, and tasks. · `Kernel/src/Stellar.Kernel`

### Engine

Managed runtime modules plus native-backed subsystems.

- [Core](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.Core): runtime base · Foundational managed runtime with data structures, environment support, failure dispatching, registries, and entry-point behavior. · `Engine/src/Modules/Stellar.Core`
- [File System](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.FileSystem): provider runtime · Concrete file access and provider implementations, including assembly-backed and filesystem-backed access. · `Engine/src/Modules/Stellar.FileSystem`
- [Logging](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.LoggingSystem): runtime system · Logger formats, metadata, runtime config, and logging build/runtime integration. · `Engine/src/Modules/Stellar.LoggingSystem`
- [Failures](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.Core/Failures): runtime system · Typed failures, levels, dispatching, catches, and handlers. · `Engine/src/Modules/Stellar.Core/Failures`
- [Events](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.EventSystem): runtime bus · Event bus, queues, handlers, and event context infrastructure. · `Engine/src/Modules/Stellar.EventSystem`
- [Tasks](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.TaskSystem): scheduler · Task scheduling and threading abstractions for coordinated execution. · `Engine/src/Modules/Stellar.TaskSystem`
- [Data & Registry](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Modules/Stellar.Core/Data): state backbone · Concrete data containers, contexts, identifiers, labels, and registries used across the runtime. · `Engine/src/Modules/Stellar.Core/Data`
- [Native Graphics](https://github.com/quantumdevteam/stellarengine/tree/master/Engine/src/Native): native backend · Native graphics kernels and API implementations for DX12, OpenGL, and window support. · `Engine/src/Native`
- [Native Physics](https://github.com/quantumdevteam/stellarengine/blob/master/Engine/src/Native/Stellar.Native.Physics): native backend · Native physics runtime and wrapper projects for platform-specific acceleration. · `Engine/src/Native/Stellar.Native.Physics`
- [Feature Modules](https://github.com/quantumdevteam/stellarengine/tree/master/Engine/src/Modules): managed subsystems · Higher-level managed modules such as stage, network, physics, graphics, UI, assets, audio, and time. · `Engine/src/Modules`

### SDK

Build-time tooling, analyzers, and authoring support.

- [CLI](https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/Stellar.CLI): developer tool · Commands for project creation, documentation, versions, info, and SDK installation. · `SDK/src/Stellar.CLI`
- [MSBuild SDK](https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/MSBuild/Stellar.Sdk): build integration · Props, targets, workload setup, and build integration for Stellar projects. · `SDK/src/MSBuild/Stellar.Sdk`
- [Build Tasks](https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/MSBuild/Stellar.Sdk.Tasks): generator tasks · Project parsing, config generation, executable generation, and MSBuild helper tasks. · `SDK/src/MSBuild/Stellar.Sdk.Tasks`
- [Project Analyzer](https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/Roslyn/Stellar.ProjectAnalyzer): roslyn analyzer · Compile-time validation of Stellar project patterns and entry-point usage. · `SDK/src/Roslyn/Stellar.ProjectAnalyzer`
- [Tools Models](https://github.com/quantumdevteam/stellarengine/blob/master/SDK/src/Stellar.Tools): tooling model · Configuration objects and environment models consumed by SDK tooling. · `SDK/src/Stellar.Tools`
- [Templates](https://github.com/quantumdevteam/stellarengine/tree/master/Data/Template/SDK): packaging assets · Template workload manifest and distribution data used by SDK and tooling packaging. · `Data/Template/SDK`

## Connections

- Contracts → Runtime APIs: defines · Kernel surfaces stable runtime interfaces for all subsystems.
- Contracts → Project Config: includes · Configuration contracts live alongside the core API boundary.
- Contracts → Entry Point: includes · Entry-point and stop-context contracts define controlled startup.
- Core → Data & Registry: owns · Core provides the concrete data and registry backbone.
- Core → Failures: dispatches · Core includes failure dispatching and handler orchestration.
- Core → Events: coordinates · Event handling is part of the runtime coordination layer.
- Core → Tasks: schedules · Task scheduling is exposed as a first-class runtime service.
- Core → File System: uses · Core depends on file access abstractions and providers.
- Core → Logging: uses · Core and modules rely on shared logging infrastructure.
- Feature Modules → Core: builds on · Feature modules extend the foundational runtime.
- Feature Modules → Native Graphics: bridges · Graphics-related features connect to native rendering backends.
- Feature Modules → Native Physics: bridges · Physics features connect to native physics backends.
- File System → Contracts: implements · Managed file system providers implement Kernel file contracts.
- Logging → Contracts: implements · Logging runtime fulfills Kernel logging contracts.
- Failures → Contracts: implements · Failure types and dispatching implement the shared failure API.
- Events → Contracts: implements · Event buses, handlers, and contexts implement event contracts.
- Tasks → Contracts: implements · Task scheduler and thread abstractions implement task contracts.
- Data & Registry → Contracts: implements · Data containers, context, registry, identifier, and label structures implement shared contracts.
- Native Graphics → File System: loads · Native graphics pieces are packaged and consumed through engine runtime boundaries.
- Native Physics → Core: supports · Native physics supports the managed runtime layer.
- MSBuild SDK → Contracts: targets · Build integration consumes the Kernel contract layer.
- Build Tasks → Tools Models: parses · Tasks operate on tooling configuration models.
- Build Tasks → Project Config: reads · Build tasks interpret Stellar project configuration.
- Project Analyzer → Entry Point: validates · Analyzer enforces Stellar entry-point conventions.
- Project Analyzer → Project Config: validates · Analyzer checks project configuration shape and usage.
- CLI → Build Tasks: invokes · CLI commands reuse project generation and parsing logic.
- CLI → MSBuild SDK: supports · CLI supports SDK installation and project workflow.
- MSBuild SDK → Templates: packages · MSBuild integration uses template and workload assets for distribution.
- CLI → Templates: scaffolds · Project creation and docs commands rely on template data.
