How jp8g/ecstatic works
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: ecstatic.c ecstatic.c · CMakeLists.txt CMakeLists · ecstatic.h ecstatic.h · README.md README
Components 11
Public Interface
What consumers include and link against.
- Consumer Code · Application or engine code using the ECS library.
- ecstatic.h · 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 · Central ECS implementation and state management.
src/ecstatic.c - Entities · Lightweight identifiers managed by the runtime.
- Components · Typed data attached to entities.
- Systems · Processing logic operating over ECS state.
- ECS State · Internal storage and mutation machinery hidden behind the API.
- No Queries · Views and queries are not yet supported in this version.
Build & Metadata
Top-level project files for packaging and documentation.
- CMakeLists · Build orchestration for producing the reusable C library.
CMakeLists.txt - README · Project overview and design notes, including current feature limits.
README.md - License · Repository licensing terms.
LICENSE
Connections 11
- 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.