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

@nanoforge-dev/ecs

v2.0.0

Published

NanoForge Engine - ECS

Readme

About

@nanoforge-dev/ecs is NanoForge's built-in entity-component-system library, backed by a WebAssembly registry (compiled from C++). It ships two subpath entry points — @nanoforge-dev/ecs/client and @nanoforge-dev/ecs/server — each loading its own WASM build (browser-targeted vs Node-targeted) behind the same EcsLibrary API, so a client bundle never pulls in the server build or vice versa. The root entry point, @nanoforge-dev/ecs, only exposes the shared types (Registry, Component, System, Entity, SparseArray, Context, EcsContextApi) and pulls in no WASM binary, so it's safe to import from code that targets both client and server.

Installation

Node.js 26 or newer is required.

npm install @nanoforge-dev/ecs
yarn add @nanoforge-dev/ecs
pnpm add @nanoforge-dev/ecs
bun add @nanoforge-dev/ecs

Example usage

Register EcsLibrary from the entry point matching your app:

// Client app
import { EcsLibrary } from "@nanoforge-dev/ecs/client";

app.use(new EcsLibrary());
// Server app
import { EcsLibrary } from "@nanoforge-dev/ecs/server";

app.use(new EcsLibrary());

Shared types like Registry, Component, and System are available from the root entry point, regardless of which platform you're targeting:

import type { Component, Context, Registry, System } from "@nanoforge-dev/ecs";

const Position: Component = { name: "Position" };

const gravity: System = (registry: Registry, ctx: Context) => {
  // ...
};

Once registered, Context.ecs.registry gives every other library access to the entity/component registry:

public override async __run(ctx: Context): Promise<void> {
  const entity = ctx.ecs.registry.spawnEntity();
  ctx.ecs.registry.addComponent(entity, new Position(0, 0));
}

Register systems to run on every tick:

ctx.ecs.registry.addSystem((registry) => {
  for (const { __RESERVED_entityId, Position } of registry.getZipper([
    { name: "__RESERVED_entityId" },
    { name: "Position" },
  ])) {
    // Move things around.
  }
});

When registered alongside @nanoforge-dev/editor's EditorLibrary, EcsLibrary also listens for a "hot-reload" command from the editor and applies incoming components via registry.addComponent — useful for live-editing entity state from an external editor host.

Links

Contributing

Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the documentation.
See the contribution guide if you'd like to submit a PR.

Help

If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in discussions.