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

@orbitalfoundation/spatial

v0.1.0

Published

Space as a concept: place entities by pose, detect proximity, query regions. A spatial-hash index usable standalone, plus a bus listener that indexes pose-bearing entity traffic and answers spatial queries.

Readme

@orbitalfoundation/spatial

Space as a concept: place entities by pose, detect proximity, query regions. Two halves, deliberately separable:

  • The toolmakeSpatialHash(): a pure uniform-grid index over 3D bounding spheres (place / remove / near / within / nearest). No bus, no components, no dependencies — import just this into any sim that needs proximity (cloudreef-style spatial hashing, done once, tested).
  • The concept — one reserved bus key and a passive indexer. Any event carrying an id and a pose component is indexed automatically (pose: null removes), so on a world bus agents simply publish themselves and the index stays current. Installed as bus.spatial for direct calls.
{ spatial: { query:   { op: 'near', position: [x,y,z], radius }
           |          { op: 'within', min, max }
           |          { op: 'nearest', position, k } } }
{ spatial: { command: { op: 'place', id, pose } | { op: 'remove', id } | { op: 'clear' } } }

The pose component

The physical truth of a thing (see orbital-ontology):

{ "pose": { "position": [12, 0, -3], "rotation": [0, 0, 0, 1], "extent": 2.5 } }

extent is a bounding radius, or a [w, h, d] box (indexed by its bounding sphere). Positions are in the world's own local frame — earth-anchored placement is the separate geo component. And pose is not presentation: rendering (orbital-volume) reads pose; spatial queries never touch how a thing looks. The old habit of stuffing position into the volume component conflated those two concerns; pose is the divorce.

Do-nots

  • Don't query space through the renderer — that coupling is what this package exists to end.
  • Don't put per-tick pose churn on a shared/control bus — a world's spatial traffic belongs on that world's bus (the coarse-unit principle).
  • Don't reach for a database: in-world proximity is in-memory by design. A durable spatial adapter (e.g. mongo 2dsphere over filespace geo entities, for map views) is a future orbital-store entry behind its own contract.

Use

import { makeSpatialHash, attach } from '@orbitalfoundation/spatial';

// standalone tool
const grid = makeSpatialHash({ cellSize: 10 });
grid.place('fish-1', [3, 0, 0], { radius: 0.5 });
grid.near([0, 0, 0], 5);                 // → sorted hits with distances

// as a bus citizen
const spatial = attach(bus, { cellSize: 10 });
await bus.resolve({ id: 'fish-1', pose: { position: [3, 0, 0] } }); // passively indexed
await bus.resolve({ spatial: { query: { op: 'nearest', position: [0, 0, 0], k: 3 } } });
npm test   # 14 cases: boundaries, moves, radii, k-nearest fallback, 10k-agent scale