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

@jmaddoni/planet-forge

v0.0.1

Published

A procedural 3D planet generation library for React and Three.js

Readme

Planet Forge 🪐

A procedural planet generation library for React and Three.js.

Installation

npm install planet-forge

Usage

import { Canvas } from '@react-three/fiber';
import { Planet } from 'planet-forge';

function Scene() {
  return (
    <Canvas>
      <Planet 
        type="rocky" 
        radius={2} 
        seed={12345} 
        resolution={64} 
      />
    </Canvas>
  );
}

Architecture

Planet Forge uses a Factory Pattern combined with Strategy Pattern for planet generation.

Core Components

  • PlanetFactory: The main entry point. It takes a type and configuration (seed, radius) and returns the appropriate Generator instance.
  • BasePlanetGenerator: Abstract base class that defines the interface for all planet generators. It handles common tasks like mesh generation and material setup.
  • Specific Generators (e.g., RockyPlanetGenerator, GasGiantGenerator): Implement the specific noise functions, color palettes, and shader logic for each biome.

Flow

  1. The <Planet /> component receives props.
  2. It calls PlanetFactory.create(type, seed, ...) to get a generator.
  3. The generator creates the geometry (often a sphere with displacement) and a specialized shader material.
  4. The Planet component renders a Three.js <mesh> with these assets.

Extending the Library

To add a new planet type (e.g., LavaWorld), follow these steps:

1. Create a New Generator

Create a new file in src/generators/lava-generator.ts extending BasePlanetGenerator.

import { BasePlanetGenerator } from './base-generator';

export class LavaPlanetGenerator extends BasePlanetGenerator {
  // 1. Define specific fragment shader with lava logic
  protected getFragmentShaderInvokation(): string {
    return `
      // Custom noise logic for lava
      float noise = cnoise(vPosition * 2.0);
      vec3 lavaColor = mix(vec3(0.1, 0.0, 0.0), vec3(1.0, 0.2, 0.0), noise);
      return vec4(lavaColor, 1.0);
    `;
  }

  // 2. Override geometry generation if needed (e.g., more jagged)
  generateGeometry() {
    // ... custom logic or call super
    return super.generateGeometry();
  }
}

2. Register in Factory

Update src/factory.planet.ts:

  1. Add new type to PlanetType.
  2. Import your new generator.
  3. Add a case in PlanetFactory.create.
// src/types/planet.types.ts
export type PlanetType = 'rocky' | ... | 'lava';

// src/factory.planet.ts
static create(type: PlanetType, ...): BasePlanetGenerator {
  switch (type) {
    // ...
    case 'lava':
      return new LavaPlanetGenerator(seed, radius, resolution);
  }
}

3. Add to Type Registry

Update getAllTypes and getTypeName in PlanetFactory for UI integration.

static getTypeName(type: PlanetType): string {
    // ...
    lava: 'Mundo de Lavá',
}