New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ecspresso

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecspresso

A minimal Entity-Component-System library for typescript and javascript.

latest
Source
npmnpm
Version
0.12.4
Version published
Maintainers
1
Created
Source

ECSpresso

(pronounced "ex-presso")

A type-safe, modular, and extensible Entity Component System (ECS) framework for TypeScript and JavaScript.

Features

  • Type-Safe: Full TypeScript support with component, event, and resource type inference
  • Modular: Plugin-based architecture for organizing features
  • Developer-Friendly: Clean, fluent API with method chaining
  • Event-Driven: Integrated event system for decoupled communication
  • Resource Management: Global state management with lazy loading
  • Asset Management: Eager/lazy asset loading with groups and progress tracking
  • Screen Management: Game state/screen transitions with overlay support
  • Entity Hierarchy: Parent-child relationships with traversal and cascade deletion
  • Query System: Powerful entity filtering with helper type utilities
  • System Phases: Named execution phases with fixed-timestep simulation
  • Change Detection: Per-system monotonic sequence change tracking with changed query filters
  • Reactive Queries: Enter/exit callbacks when entities match or unmatch queries
  • Command Buffer: Deferred structural changes for safe entity/component operations during systems

Installation

npm install ecspresso

Quick Start

import ECSpresso from 'ecspresso';

// 1. Define your component types
interface Components {
  position: { x: number; y: number };
  velocity: { x: number; y: number };
  health: { value: number };
}

// 2. Create a world using the builder — types are inferred automatically
const world = ECSpresso.create()
  .withComponentTypes<Components>()
  .build();

// 3. Add a movement system
world.addSystem('movement')
  .addQuery('moving', { with: ['position', 'velocity'] })
  .setProcess((queries, deltaTime) => {
    for (const entity of queries.moving) {
      entity.components.position.x += entity.components.velocity.x * deltaTime;
      entity.components.position.y += entity.components.velocity.y * deltaTime;
    }
  });

// 4. Create entities
const player = world.spawn({
  position: { x: 0, y: 0 },
  velocity: { x: 10, y: 5 },
  health: { value: 100 }
});

// 5. Run the game loop
world.update(1/60);

Documentation

  • Getting Started
  • Core Concepts — entities, components, systems, resources
  • Systems — phases, priority, groups, lifecycle
  • Queries — type utilities, reactive queries
  • Events — pub/sub, built-in events
  • Entity Hierarchy — parent-child, traversal, cascade deletion
  • Change Detection — marking, sequence timing
  • Command Buffer — deferred structural changes
  • Plugins — definePlugin, pluginFactory, required components
  • Asset Management — loading, groups, progress
  • Screen Management — transitions, scoped systems, overlays
  • Built-in Plugins — input, timers, physics, rendering
  • Type Safety — type threading, error handling
  • Performance — optimization tips

License

MIT

Keywords

game

FAQs

Package last updated on 01 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts