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

@awesome-ecs/abstract

v0.34.0

Published

A comprehensive Entity-Component-System (ECS) Architecture implementation. Abstract components.

Downloads

898

Readme

Awesome ECS - Abstract Package

Overview

The Abstract package defines all core interfaces and abstractions for the Entity-Component-System (ECS) framework. It provides the foundational contracts that all other packages implement, including:

  • Components: Data-storage contracts
  • Entities: Materialized view contracts for components and proxy references
  • Pipelines: Middleware-based execution chains
  • Systems: Modular logic execution patterns
  • Utilities: Serialization, events, and scheduling

This package has zero external dependencies and serves as the contract layer for the entire ECS framework.

Core Concepts

Components (src/components/)

Components are data-only containers. They should never contain business logic.

import { IComponent } from "@awesome-ecs/abstract";

export class HealthComponent implements IComponent {
  readonly componentType = ComponentType.health;
  readonly isSerializable = true;  // Include in snapshots
  
  current: number = 100;
  max: number = 100;
}

Key interfaces:

  • IComponent: Base component interface with componentType and isSerializable
  • IdentityComponent: Mandatory component tracking entity UID and model

Entities (src/entities/)

Entities are immutable contracts over identity, components, and explicit typed proxy fields.

import { EntityProxy, IEntityWith } from '@awesome-ecs/abstract/entities';

export interface GridEntity extends IEntityWith<GridModel> {
  readonly coordinates: CoordinatesComponent;
  readonly sceneProxy: EntityProxy<SceneEntity>;
}

Key files:

  • entity.ts: Base IEntity interface and EntityTypeUid types
  • entity-proxies.ts: EntityProxy for loose-coupling relationships
  • entity-snapshot.ts: IEntitySnapshot for serialization
  • entity-runtime-scheduler.ts: IEntityUpdate, the lean IEntityRuntimeScheduler runtime contract, and IEntityRuntimeSchedulerInspector for tooling/debug surfaces that need mailbox and schedule snapshots
  • entity-repository.ts: IEntityRepository for entity lookups
  • entity-events.ts: IEntityEvents for reactive patterns

Pipelines (src/pipelines/)

Pipelines execute middleware chains with two phases:

  1. dispatch(context): Main execution phase
  2. cleanup(context): Resource cleanup phase
export interface IPipeline<TContext extends IPipelineContext> {
  use(middleware: IMiddleware<TContext>): this;
  dispatch(context: Partial<TContext>): void | Promise<void>;
  cleanup(context: Partial<TContext>): void | Promise<void>;
}

Key files:

  • pipeline.ts: Core IPipeline interface
  • middleware.ts: IMiddleware contract (action + optional cleanup)
  • middleware-runner.ts: Middleware execution engine
  • pipeline-context.ts: Context passed to middleware
  • pipeline-runner.ts: Pipeline execution orchestration

Systems (src/systems/)

Systems are modular logic units that operate on entities. They implement the middleware pattern.

Pipeline-based systems:

  • system-middleware.ts: ISystemMiddleware<TEntity> - middleware for a specific entity type
  • system-context.ts: Context passed to system middleware (entity, events, repository, etc.)

Module-based organization:

  • systems-module.ts: ISystemsModule<TEntity> - groups related systems targeting an entity type
  • systems-module-builder.ts: ISystemsModuleBuilder<TEntity> - fluent builder for pipeline registration
  • systems-module-repository.ts: Module lifecycle and registration

Runtime execution:

  • systems-runtime.ts: ISystemsRuntime - core tick-based execution loop
  • systems-runtime-context.ts: Context for runtime execution
  • systems-runtime-middleware.ts: Middleware for runtime operations

Utilities (src/utils/)

  • types.ts: Common types (Immutable, BooleanProps, Readonly)
  • json-serializer.ts: JSON serialization contracts
  • logger.ts: Logging interface
  • performance-timer.ts: Performance measurement

Key Design Principles

  1. Components are data-only - no behavior, just properties
  2. Entities are immutable - modifications through systems only
  3. Relationships are backed by proxies - proxy fields expose typed lookup refs; systems resolve proxy handles or full entities explicitly when needed
  4. Systems are middleware - pluggable into pipelines
  5. Pipelines are composable - middleware chains with dispatch + cleanup

What's NOT in Abstract

  • Concrete entity implementations (→ @awesome-ecs/core)
  • System module base classes (→ @awesome-ecs/core)
  • Component factories (→ @awesome-ecs/core)
  • Multi-threading (→ @awesome-ecs/workers)
  • AI patterns (→ @awesome-ecs/ai)