# jp8g/ecstatic architecture

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

- Interactive diagram: https://gitdiagram.com/jp8g/ecstatic
- Repository: https://github.com/jp8g/ecstatic

## Overview

1. **Project type and scope**
   - Ecstatic is a small C library that implements an ECS (Entity-Component-System) foundation.
   - The repository is intentionally minimal: one public header, one implementation file, and CMake-based build metadata.

2. **Primary architectural boundary**
   - The main boundary is between **consumer code** and the **library internals**.
   - Consumers include `include/ecstatic.h` and link against the compiled library; the ECS logic is hidden in `src/ecstatic.c`.

3. **Public API surface**
   - `include/ecstatic.h` is the only visible API entry point.
   - This is the contract for creating entities, attaching/removing components, and interacting with ECS state at runtime.
   - Because the library is “low level,” the API is likely intentionally thin and close to the underlying data model.

4. **Implementation core**
   - `src/ecstatic.c` contains the full runtime implementation.
   - The architecture appears centralized rather than split across many modules, which suggests a compact core with minimal indirection.
   - For diagramming, treat this file as the “engine” that owns ECS state and operations.

5. **ECS domain model**
   - The repository is centered on the standard ECS concepts:
     - **Entities** as lightweight identifiers
     - **Components** as typed data attached to entities
     - **Systems/processing** as logic that operates over ECS state
   - The README explicitly notes that **Views and Queries are not yet supported**, so there is no higher-level iteration/filtering subsystem in this version.

6. **Current data access pattern**
   - Since Views/Queries are absent, external code likely interacts with the ECS through direct entity/component operations rather than declarative queries.
   - That means the architecture is still in the “core storage and mutation” phase, not the “query and iteration” phase.

7. **Build and packaging**
   - `CMakeLists.txt` is the only build orchestrator.
   - This indicates the library is meant to be compiled as a reusable C artifact, likely consumed by other C or C-compatible projects.

8. **Repository structure**
   - `include/` = public interface
   - `src/` = internal implementation
   - top-level files = build, licensing, and documentation
   - This separation is conventional for a small library and makes the dependency direction clear: public API depends on implementation, not the other way around.

9. **Runtime dependency model**
   - There are no visible external runtime services, databases, or network dependencies.
   - The architecture is self-contained and in-process, which is typical for a performance-oriented ECS library.

10. **Performance and design intent**
   - The README emphasizes “lightweight, low level, efficient, and flexible,” which suggests the design prioritizes:
     - low abstraction overhead
     - tight control over memory/layout
     - direct use by engine or simulation code
   - This likely affects the internal architecture more than feature breadth.

11. **Version/state of the system**
   - The project is at `v0.1.0`, so it should be treated as an early core implementation.
   - The key missing architectural layer is query/view abstraction, which will likely become a distinct subsystem later.

12. **What an architecture diagram should show**
   - A good diagram would show:
     - Application/consumer code on the left
     - `ecstatic.h` as the public API boundary
     - `ecstatic.c` as the internal ECS runtime
     - entities/components/state managed inside the runtime
   - It should also explicitly note that query/view traversal is not yet present in this version.

Main entry points: [`src/ecstatic.c`](https://github.com/jp8g/ecstatic/blob/main/src/ecstatic.c) (ecstatic.c), [`CMakeLists.txt`](https://github.com/jp8g/ecstatic/blob/main/CMakeLists.txt) (CMakeLists), [`include/ecstatic.h`](https://github.com/jp8g/ecstatic/blob/main/include/ecstatic.h) (ecstatic.h), [`README.md`](https://github.com/jp8g/ecstatic/blob/main/README.md) (README)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_public["Public Interface"]
  node_node_consumer["Consumer Code<br/>client"]
  node_node_api["ecstatic.h<br/>public header<br/>[ecstatic.h]"]
end

subgraph group_group_core["ECS Core"]
  node_node_core["ecstatic.c<br/>runtime engine<br/>[ecstatic.c]"]
  node_node_entities(("Entities<br/>ecs ids"))
  node_node_components[("Components<br/>ecs data")]
  node_node_systems{{"Systems<br/>ecs logic"}}
  node_node_state[("ECS State<br/>storage")]
  node_node_noquery["No Queries<br/>missing feature"]
end

subgraph group_group_build["Build & Metadata"]
  node_node_build["CMakeLists<br/>build config<br/>[CMakeLists.txt]"]
  node_node_readme["README<br/>docs<br/>[README.md]"]
  node_node_license["License<br/>legal"]
end

node_node_consumer -->|"includes"| node_node_api
node_node_api -->|"calls"| node_node_core
node_node_core -->|"owns"| node_node_state
node_node_core -->|"manages"| node_node_entities
node_node_core -->|"manages"| node_node_components
node_node_core -->|"supports"| node_node_systems
node_node_core -.->|"lacks"| node_node_noquery
node_node_build -->|"packages"| node_node_api
node_node_build -->|"compiles"| node_node_core
node_node_readme -.->|"notes"| node_node_noquery
node_node_license -.->|"governs"| node_node_build

click node_node_api "https://github.com/jp8g/ecstatic/blob/main/include/ecstatic.h"
click node_node_build "https://github.com/jp8g/ecstatic/blob/main/CMakeLists.txt"
click node_node_readme "https://github.com/jp8g/ecstatic/blob/main/README.md"
click node_node_license "https://github.com/jp8g/ecstatic/tree/main/LICENSE"
click node_node_core "https://github.com/jp8g/ecstatic/blob/main/src/ecstatic.c"

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_node_consumer,node_node_api toneBlue
class node_node_core,node_node_entities,node_node_components,node_node_systems,node_node_state,node_node_noquery toneAmber
class node_node_build,node_node_readme,node_node_license toneMint
```

## Components

### Public Interface

What consumers include and link against.

- **Consumer Code**: client · Application or engine code using the ECS library.
- [ecstatic.h](https://github.com/jp8g/ecstatic/blob/main/include/ecstatic.h): public header · Single public API entry point for entity and component operations. · `include/ecstatic.h`

### ECS Core

Internal runtime that owns ECS state and operations.

- [ecstatic.c](https://github.com/jp8g/ecstatic/blob/main/src/ecstatic.c): runtime engine · Central ECS implementation and state management. · `src/ecstatic.c`
- **Entities**: ecs ids · Lightweight identifiers managed by the runtime.
- **Components**: ecs data · Typed data attached to entities.
- **Systems**: ecs logic · Processing logic operating over ECS state.
- **ECS State**: storage · Internal storage and mutation machinery hidden behind the API.
- **No Queries**: missing feature · Views and queries are not yet supported in this version.

### Build & Metadata

Top-level project files for packaging and documentation.

- [CMakeLists](https://github.com/jp8g/ecstatic/blob/main/CMakeLists.txt): build config · Build orchestration for producing the reusable C library. · `CMakeLists.txt`
- [README](https://github.com/jp8g/ecstatic/blob/main/README.md): docs · Project overview and design notes, including current feature limits. · `README.md`
- [License](https://github.com/jp8g/ecstatic/tree/main/LICENSE): legal · Repository licensing terms. · `LICENSE`

## Connections

- Consumer Code → ecstatic.h: includes · Consumers use the public header as the contract.
- ecstatic.h → ecstatic.c: calls · Declared operations are implemented by the internal runtime.
- ecstatic.c → ECS State: owns · The core owns the ECS runtime state.
- ecstatic.c → Entities: manages · Entity identifiers are created and tracked by the runtime.
- ecstatic.c → Components: manages · Component attachment and removal are core responsibilities.
- ecstatic.c → Systems: supports · Systems operate on ECS state through the runtime.
- ecstatic.c → No Queries: lacks · This version does not provide query or view traversal.
- CMakeLists → ecstatic.h: packages · Build metadata compiles the public interface into a library artifact.
- CMakeLists → ecstatic.c: compiles · Build metadata includes the internal implementation unit.
- README → No Queries: notes · Documentation calls out the absence of query/view support.
- License → CMakeLists: governs · Licensing applies to the built artifact and source distribution.
