npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

eagle-ecs

v0.1.0

Published

A lightweight Entity-Component-System library for JavaScript

Readme

EagleECS

A lightweight Entity-Component-System (ECS) library for JavaScript.

EagleECS is designed to provide a small, straightforward ECS foundation for games, simulations, and other data-oriented applications.

Features

  • Lightweight JavaScript ECS
  • Integer entity IDs
  • Entity IDs are never reused
  • Data-oriented component storage
  • AND-based component queries
  • Reusable query views
  • Queries resolve their contents at iteration time
  • System-based world updates
  • Systems execute in registration order
  • Systems can modify the world during updates
  • Zero runtime dependencies

Installation

npm install eagle-ecs

Quick Start

import { World, defineComponent } from "eagle-ecs";

const world = new World();

const Position = defineComponent();
const Velocity = defineComponent();

const entity = world.createEntity();

world.addComponent(entity, Position, {
    x: 0,
    y: 0
});

world.addComponent(entity, Velocity, {
    x: 10,
    y: 5
});

world.addSystem({
    update(world, dt) {
        for (const entity of world.query(Position, Velocity)) {
            const position = world.getComponent(entity, Position);
            const velocity = world.getComponent(entity, Velocity);

            position.x += velocity.x * dt;
            position.y += velocity.y * dt;
        }
    }
});

world.update(1 / 60);

Core API

World

Creates an ECS world containing entities, components, queries, and systems.

const world = new World();

Entities

Create an entity:

const entity = world.createEntity();

Entities use increasing integer IDs.

1, 2, 3, 4, ...

Destroyed IDs are never reused.

world.destroyEntity(entity);

world.isAlive(entity);
// false

Components

Define a component type:

const Position = defineComponent();

Add component data:

world.addComponent(entity, Position, {
    x: 10,
    y: 20
});

Retrieve component data:

const position = world.getComponent(entity, Position);

Check for a component:

world.hasComponent(entity, Position);

Remove a component:

world.removeComponent(entity, Position);

When an entity is destroyed, all of its components are removed automatically.

Queries

Query entities by component type:

for (const entity of world.query(Position)) {
    // ...
}

Multiple components use AND semantics:

for (const entity of world.query(Position, Velocity)) {
    // Entity has both Position and Velocity
}

Queries return entity IDs, not component data.

A query can be reused:

const movingEntities = world.query(Position, Velocity);

for (const entity of movingEntities) {
    // ...
}

for (const entity of movingEntities) {
    // Query is evaluated again
}

Query contents are resolved when iteration begins, allowing changes made before iteration to be reflected.

Systems

A system is an object with an update() method:

const movementSystem = {
    update(world, dt) {
        for (const entity of world.query(Position, Velocity)) {
            const position = world.getComponent(entity, Position);
            const velocity = world.getComponent(entity, Velocity);

            position.x += velocity.x * dt;
            position.y += velocity.y * dt;
        }
    }
};

Register it:

world.addSystem(movementSystem);

Systems execute in registration order:

world.addSystem(inputSystem);
world.addSystem(movementSystem);
world.addSystem(renderSystem);

world.update(dt);

The system receives:

update(world, dt)
       │     │
       │     └── delta time in seconds
       └──────── current ECS world

Systems may create and destroy entities and add, remove, query, or modify components during an update.

Remove a system:

world.removeSystem(movementSystem);

Design Philosophy

EagleECS intentionally starts small.

The core model is:

World
 ├── Entities
 ├── Components
 ├── Queries
 └── Systems

Entities identify objects.

Components contain data.

Queries find entities with specific component combinations.

Systems operate on that data.

The goal is to keep these responsibilities separate and the runtime small enough to be useful in lightweight JavaScript projects.

Current Scope

EagleECS 0.1.0 focuses on the fundamental ECS model.

It does not currently attempt to provide:

  • Archetype storage
  • Deferred structural commands
  • Multithreaded execution
  • Worker-based systems
  • Serialization
  • Scheduling graphs
  • Rendering
  • Physics
  • Asset management
  • A game loop
  • An engine framework

These can be considered independently as the library evolves.

Development

Clone the repository and install dependencies:

npm install

Run the test suite:

npm test

The project uses Node.js's built-in test runner.

License

MIT