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

@cedric-pouilleux/stellexjs

v0.5.1

Published

Deterministic, playable celestial body generator for Three.js and Vue 3.

Readme

@cedric-pouilleux/stellexjs

Docs · Playground · API · npm · GitHub · Issues

Procedural celestial body — geometry, physics, simulation and rendering for Three.js and Vue 3.

Generates rocky planets, gas giants, metallic worlds and stars on a hexasphere, with deterministic noise-based terrain, surface-liquid shells, atmosphere, clouds, rings and a Three.js render pipeline. All generation is seedable so client and server produce identical worlds from the same inputs.

Install

npm install @cedric-pouilleux/stellexjs three simplex-noise
# Optional (only for the Vue / TresJS surface):
npm install vue @tresjs/core

Peer dependencies:

| Package | Required by | | --------------- | ---------------------- | | simplex-noise | sim, core, default | | three | core, default | | vue | default (index) | | @tresjs/core | default (index) |

Entry points

The package exposes three entry points of increasing scope:

import { initBodySimulation, generateHexasphere } from '@cedric-pouilleux/stellexjs/sim'
import { useBody, BodyMaterial }                  from '@cedric-pouilleux/stellexjs/core'
import { Body, BodyRings, ShadowUpdater }         from '@cedric-pouilleux/stellexjs'
  • @cedric-pouilleux/stellexjs/sim — pure data & physics layer. No Three.js or Vue dependency, runtime or types; runs in workers, Node or any environment that can execute ES modules. Use for servers, CLIs, or deterministic tests.
  • @cedric-pouilleux/stellexjs/core — adds the Three.js render layer (shaders, meshes, materials, raycasting). No Vue dependency — drop into a vanilla Three.js scene.
  • @cedric-pouilleux/stellexjs — full Vue/TresJS component surface (<Body>, <BodyController>, <BodyRings>, <BodyWarmup>, <ShadowUpdater>, <TileCenterProjector>).

Quick start (headless)

import {
  generateHexasphere,
  initBodySimulation,
} from '@cedric-pouilleux/stellexjs/sim'

const { tiles } = generateHexasphere(3, 8) // radius, subdivisions
const sim = initBodySimulation(tiles, {
  type:                'planetary',
  surfaceLook:         'terrain',
  name:                'kepler-22b',
  radius:              3,
  rotationSpeed:       0.005,
  axialTilt:           0.41,
  atmosphereThickness: 0.6,
})

for (const [tileId, state] of sim.tileStates) {
  console.log(tileId, state.elevation)
}

Quick start (Three.js)

import * as THREE from 'three'
import { useBody, DEFAULT_TILE_SIZE } from '@cedric-pouilleux/stellexjs/core'

const body = useBody(
  {
    type: 'planetary', surfaceLook: 'terrain',
    name: 'earth', radius: 3,
    rotationSpeed: 0.01, axialTilt: 0.41,
    atmosphereThickness: 0.7,
  },
  DEFAULT_TILE_SIZE,
)
scene.add(body.group)

// Pre-compile every shader before the first render — keeps the main
// thread responsive while the GPU driver links programs in the
// background (uses `KHR_parallel_shader_compile` when available).
await body.warmup(renderer, camera, {
  onProgress: ({ phase, progress, label }) => {
    // Drive a loading bar — `phase` is a stable code, `label` an
    // English fallback, `progress` ∈ [0, 1].
  },
})

// in animation loop:
body.tick(delta)

On Vue/TresJS scenes, mount <BodyWarmup :body="body" @ready="…" /> inside <TresCanvas> instead — it resolves the renderer / camera from the canvas context and emits the same progress events.

Resources live off-lib

The lib carries no resource vocabulary whatsoever. It returns a "raw" planet — geometry, per-tile elevation, sea level, palette — and exposes paint hooks so consumers can project their own game semantics on top:

const body = useBody(config, tileSize)

// Caller owns the distribution strategy, the catalogue and the paint.
const distribution = myGenerateDistribution(body.sim)
myPaintBody(body, distribution)       // calls body.tiles.sol.applyOverlay
                                      // + body.tiles.paintSmoothSphere

Relevant body.tiles primitives (planet branch — narrow on body.kind === 'planet'):

  • body.tiles.sol.tileBaseVisual(tileId) — pre-blend palette snapshot (colour + PBR + submerged flag). Lets consumers run their own resource-aware blend off-lib.
  • body.tiles.sol.applyOverlay(Map<tileId, RGB>) — stamps per-tile RGB into the interactive layered mesh (live mutation-friendly). Same shape on body.tiles.atmo.applyOverlay for the atmo board.
  • body.tiles.paintSmoothSphere(Map<tileId, RGB>) — one-shot paint of the distant view (frozen at generation).
  • body.tiles.sol.updateTileSolHeight(Map<tileId, height>) — per-tile elevation mutation.

The playground ships a reference implementation (catalogue, cluster-based distribution, paint pipeline) under playground/src/lib/paint/ — a useful template for game integrations.

Body structure (core / atmosphere split)

The ratio between the solid core and the gas envelope is driven by the physics, not by an ad-hoc visual knob. Pass gasMassFraction ∈ [0, 1] (the fraction of the body's total mass carried by gas) and the lib derives the core radius from the solid + gas density references:

| gasMassFraction | Resolved body | coreRadiusRatio | | ----------------- | --------------------------- | ----------------- | | 0 | Fully solid world | 1.0 | | ~0.05 | Earth-like | ~0.97 | | ~0.3 | Sub-Neptune | ~0.70 | | ~0.7 | Neptune / Uranus | ~0.25 | | ~0.93 | Jupiter | ~0.20 | | 1 | Pure gas (no core, no sol) | 0.0 |

Resolution order when building a body:

  1. explicit coreRadiusRatio on the config — user opt-in override
  2. derivation from gasMassFraction
  3. DEFAULT_CORE_RADIUS_RATIO (0.55) — used when both knobs are omitted

Pure-gas bodies (gasMassFraction: 1 or coreRadiusRatio: 0) are a first-class case: buildCoreMesh skips the sphere allocation, the sol band collapses (no relief), and the atmo shell occupies the whole visible sphere.

Surface liquid — planetary only

liquidState (and the related liquidColor / liquidCoverage) lives on PlanetConfig — the discriminated-union branch of BodyConfig. The fields are simply absent from the StarConfig branch, so the type-checker rejects them at the construction site rather than letting them be silently ignored at runtime. The single enforcement point is hasSurfaceLiquid(config), exported from /sim for consumers that need to read the same invariant.

Determinism

Every generation step is seeded from BodyConfig.name — no raw Math.random(). Two clients with the same config produce identical tiles, elevations, resource maps and visual variation.

Documentation

The full doc site lives at https://cedric-pouilleux.github.io/stellex-js/ — the guides below are the recommended entry points by use case.

Get started

Wire it into your stack

Tune the look

Wire game logic on top

For an interactive playground (sliders for every shader knob), open https://cedric-pouilleux.github.io/stellex-js/playground/.

Public API stability

The public surface of each entry point (/sim, /core, default) is snapshotted in api/reports/ via @microsoft/api-extractor. Any change to the exported types or signatures shows up as a diff on the corresponding *.api.md file.

  • npm run api:check — fails when dist/*.d.ts drifts from the committed snapshots (run in CI).
  • npm run api:update — regenerates the snapshots; commit the diff alongside the intentional change.

License

This project is licensed under the StellexJS Non-Commercial License (HC-NCL). See LICENSE for details.