A high-performance, multithreaded Entity Component System (ECS) framework for TypeScript.
- Multithreaded: Execute systems in parallel across worker threads with automatic entity partitioning
- Change Tracking: Query for entities that were added, removed, or changed since last frame
- Powerful Queries: Filter entities by component presence with
with,without, andanyoperators - Entity References: Reference other entities with automatic validation
- Zero dependencies - Lightweight core with no external runtime dependencies
| Package | Description |
|---|---|
| @woven-ecs/core | Core ECS framework with components, systems, queries, and multi-threading |
| @woven-ecs/canvas-store | Persistence, undo/redo, and real-time collaboration for design and whiteboard applications |
| @woven-ecs/canvas-store-server | Server for real-time collaboration with @woven-ecs/canvas-store clients |
npm install @woven-ecs/coreimport {
addComponent,
createEntity,
defineComponent,
defineQuery,
defineSystem,
field,
World,
} from '@woven-ecs/core';
// Define components with typed fields
const Position = defineComponent({
x: field.float32(),
y: field.float32(),
});
const Velocity = defineComponent({
x: field.float32(),
y: field.float32(),
});
// Define a query to find entities with both components
const movingEntities = defineQuery((q) =>
q.with(Position, Velocity)
);
// Define a system to process matching entities
const movementSystem = defineSystem((ctx) => {
for (const eid of movingEntities.current(ctx)) {
const pos = Position.write(ctx, eid);
const vel = Velocity.read(ctx, eid);
pos.x += vel.x;
pos.y += vel.y;
}
});
// Create the world
const world = new World([Position, Velocity]);
// Create an entity with Position and Velocity components
world.execute((ctx) => {
const entity = createEntity(ctx);
addComponent(ctx, entity, Position, { x: 0, y: 0 });
addComponent(ctx, entity, Velocity, { x: 1, y: 1 });
})
// Game loop
function loop() {
world.execute(movementSystem);
requestAnimationFrame(loop);
}
loop();| Example | Description |
|---|---|
| React Binding | Integrating woven-ecs with React using useSyncExternalStore. |
| Three.js + Workers | Multithreaded particle physics with Three.js rendering. |
The @woven-ecs/canvas-store and @woven-ecs/canvas-store-server packages extend Woven-ECS with everything you need to build multiplayer editor applications like infinite canvases or other creative design tools.
- Real-time Sync — WebSocket-based multiplayer with conflict resolution. Multiple users can edit the same document simultaneously.
- Local-First — Your app works offline by default. Data lives on the client and syncs to the server when connected.
- Undo/Redo — Full history tracking with configurable depth. Support for undo/redo across multiple users with proper conflict resolution.
- Persistence — Automatic IndexedDB storage for offline support. Changes are saved locally and synced when back online.
- Migrations — Version your component schemas with automatic migrations. Evolve your data model without breaking existing documents.
- Configurable — Configure sync behavior per component: persist to server, sync ephemerally, store locally, or skip entirely.
git clone https://github.com/WillH0lt/woven-ecs.git
cd woven-ecs
pnpm install
pnpm build
pnpm testMIT License.
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and ideas
