ECSTS – an entity-component-system for TypeScript
ECSTS is an entity-component-system library for TypeScript and JavaScript. It separates data (components) from behaviour (systems) and deliberately contains no game-specific logic.
- Status
- Published on npm (version 0.5.1, March 2022), pre-1.0 API
- Period
- since 2019
- Technologies
- TypeScript
- JavaScript
What the project does
An entity-component-system (ECS) structures an application so that entities merely carry components, while systems implement the behaviour for every entity that owns certain components. ECSTS provides the building blocks: Component, Entity, System and an Engine that ties systems and entities together.
The package is published on npm as @trixt0r/ecs. Its README describes it as a library for any use case. The example in the repository is a small rectangle simulation with position, size and velocity as components and systems for movement, gravity, collision and rendering.
Goals and constraints
According to the README, the library should work without game-specific logic, and according to its npm description it should run in any JavaScript environment. Accordingly, the changelog lists ES5 as the compile target from version 0.2.2. Type declarations ship with the package.
My role
I created the repository in May 2019 and published the first version on npm at the end of May 2019. The repository lives in my GitHub account; the README welcomes issues and pull requests. ECSTS is also listed as a dependency of my editor project Y.A.M.E.
Key design decisions
- Components are plain types: Component is an interface without required members. The README recommends classes because systems look components up by type.
- No built-in ID generation: AbstractEntity is abstract and the ID comes from the application. The library does not impose an ID scheme.
- Aspects instead of manual filters: since version 0.1.0, Aspect (with all, one and exclude) replaces the earlier Filter. A system describes which components it needs and receives the matching entities. From 0.2.0, aspects also dispatch events when entities and components are added or removed.
- Less boilerplate for systems: AbstractEntitySystem accepts the required component types in its constructor and handles the aspect setup.
- Synchronous or asynchronous: process may be async. engine.run can execute systems successively (SUCCESSIVE) or in parallel (PARALLEL).
- Observable: entities, systems and the engine are dispatchers on which listeners can be registered.
- Lookup by ID: the EntityCollection introduced in 0.5.0 allows calls such as engine.entities.get(1).
Tradeoffs and limitations
- Version 0.x: the API has changed between versions, for example in 0.1.0, when Filter became Aspect and Engine.getFilter was removed. Anyone using ECSTS should pin the version and read the changelog.
- Deliberately minimal: rendering, physics, input and asset management are not part of the library and must come from the application.
- Older toolchain: the development dependencies include TypeScript 3.9 and Jest 27. The project has not been maintained further since 2022.
Technologies and why
- TypeScript: types and declaration files (build/index.d.ts) are part of the package, so systems and components can be written with type checking.
- Jest: every core module (Aspect, Collection, Component, Dispatcher, Engine, Entity, EntityCollection, System) has a spec file. The changelog mentions 100% code coverage since 0.4.4.
- ESLint and Prettier: configuration for consistent code is part of the repository.
- npm: distribution as @trixt0r/ecs; 25 versions since May 2019.
Current status
The current npm version is 0.5.1, published on 19 March 2022. The last commit on the default branch is from the same day. The project is published and usable but not actively developed at the moment. I do not quote usage numbers here.
Links and sources
This page is based on the README, changelog, package.json, file structure and commit history of the public repository, plus the npm registry (as of 7 November 2026). I did not re-read the source code in detail for it.