Architecture
Envy is organized into a small set of focused layers.
1. Core ECS
The ECS core lives in src/core.
src/core/component/contains component definitions and base classessrc/core/system/contains the system contractsrc/core/world/contains the runtime world
The main types are:
World, which stores entities, components, and systemsEntity, which exposes component operations directlyComponent, which is the base class for ECS data objectsSystem, which defines update logic executed on each step
2. Three.js integration
The Three.js layer lives in src/three.
src/three/components.tscontains shared render-side componentssrc/three/systems/contains the Three.js-specific systemssrc/three/world/contains the single-scene bootstrap helpersrc/three/scenes/contains the multi-scene managersrc/three/canvas/contains the renderer canvas manager
The main types are:
TransformComponent, which stores position, rotation, and scaleObject3DComponent, which wraps a Three.jsObject3DTransformSyncSystem, which queriesTransformComponentandObject3DComponentSceneAttachmentSystem, which attaches and detachesObject3DinstancesThreeSceneManager, which manages multiple independent scenesThreeCanvasManager, which controls canvas size, ratio, and centering
Execution flow
- Create a
Worldor aThreeSceneManager - Create an entity
- Instantiate components and attach them with
entity.addComponent(...) - Register the systems you need
- Let systems query the world with
world.query(...) - Call
step(deltaTime)orupdate(deltaTime)
Philosophy
The library favors a small and explicit API.
- no hidden magic
- no unnecessary abstraction layers
- a data model that is easy to test
- systems that are easy to compose
The goal is to keep the framework modular so you can reshape behavior by adding or moving components instead of rewriting whole objects.
In practice, that means you should be able to move an object's behavior with just a few line changes, while keeping the code simple, maintainable, and reusable.