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

@stevejtrettel/shader-sandbox

v0.1.3

Published

Local Shadertoy-compatible GLSL shader development environment with live editing

Readme

Shader Sandbox

A lightweight, Shadertoy-compatible GLSL shader development environment. Copy shaders directly from Shadertoy and run them locally with live editing.

Features

  • Shadertoy Compatibility - Copy/paste shaders directly from Shadertoy
  • Full Shadertoy Uniforms - iTime, iResolution, iFrame, iMouse, iTimeDelta, iChannel0-3
  • Multi-Buffer Rendering - BufferA-D passes with correct ping-pong semantics
  • Texture Support - Load images with configurable filtering and wrapping
  • Keyboard Input - Full keyboard state via Shadertoy-compatible texture
  • Live Code Editing - Edit shaders in the browser with instant recompilation
  • Multiple Layouts - Fullscreen, split-view, or tabbed code display
  • Playback Controls - Play/pause, reset, and screenshot capture

Quick Start

# Create a new shader project
npx @stevejtrettel/shader-sandbox create my-shaders

# Enter the project
cd my-shaders

# Run an example shader
shader dev example-gradient

Open http://localhost:3000 to see your shader running.

CLI Commands

shader create <name>     # Create a new shader project
shader dev <name>        # Run shader with live reload
shader build <name>      # Build shader for production
shader new <name>        # Create a new shader
shader list              # List all shaders
shader init              # Initialize shaders in current directory

Project Structure

After running shader create my-shaders:

my-shaders/
├── shaders/
│   ├── example-gradient/
│   │   ├── image.glsl       # Main shader code
│   │   └── config.json      # Optional configuration
│   └── example-buffer/
│       ├── image.glsl       # Final output
│       ├── bufferA.glsl     # Feedback buffer
│       └── config.json
├── main.ts                  # Entry point
├── vite.config.js           # Vite configuration
└── package.json

Creating Shaders

Simple Shader

Create a new shader with just an image pass:

shader new my-shader
shader dev my-shader

Edit shaders/my-shader/image.glsl:

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec3 col = 0.5 + 0.5 * cos(iTime + uv.xyx + vec3(0, 2, 4));
    fragColor = vec4(col, 1.0);
}

Copy from Shadertoy

  1. Find a shader on Shadertoy
  2. Copy the code from the "Image" tab
  3. Paste into shaders/my-shader/image.glsl
  4. Run shader dev my-shader

Most single-pass shaders work immediately. For multi-buffer shaders, you'll need to create the buffer files and config.

Multi-Buffer Shaders

For feedback effects (trails, fluid, etc.), create a buffer:

shaders/my-effect/bufferA.glsl:

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec4 prev = texture(iChannel0, uv) * 0.98;  // Previous frame with fade

    // Draw at mouse position
    vec2 mouse = iMouse.xy / iResolution.xy;
    float d = length(uv - mouse);
    float spot = smoothstep(0.05, 0.0, d);

    fragColor = prev + vec4(spot);
}

shaders/my-effect/image.glsl:

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    fragColor = texture(iChannel0, uv);
}

shaders/my-effect/config.json:

{
  "BufferA": {
    "iChannel0": "BufferA"
  },
  "Image": {
    "iChannel0": "BufferA"
  }
}

Using Textures

Place an image in your shader folder and reference it in config:

shaders/my-shader/config.json:

{
  "Image": {
    "iChannel0": "photo.jpg"
  }
}

shaders/my-shader/image.glsl:

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec4 img = texture(iChannel0, uv);
    fragColor = img;
}

Texture options:

{
  "Image": {
    "iChannel0": {
      "texture": "photo.jpg",
      "filter": "linear",
      "wrap": "repeat"
    }
  }
}
  • filter: "linear" (smooth) or "nearest" (pixelated)
  • wrap: "repeat" (tile) or "clamp" (stretch edges)

Layouts

Control how the shader is displayed in config.json:

{
  "layout": "split"
}

| Layout | Description | |--------|-------------| | fullscreen | Canvas fills the viewport | | default | Centered canvas with controls | | tabbed | Tabs to switch between shader and code | | split | Side-by-side shader and code editor |

Keyboard Shortcuts

| Key | Action | |-----|--------| | S | Save screenshot (PNG) | | Space | Play/Pause | | R | Reset to frame 0 |

Shadertoy Uniforms

All standard Shadertoy uniforms are supported:

| Uniform | Type | Description | |---------|------|-------------| | iResolution | vec3 | Viewport resolution (width, height, 1) | | iTime | float | Elapsed time in seconds | | iTimeDelta | float | Time since last frame | | iFrame | int | Frame counter | | iMouse | vec4 | Mouse position and click state | | iChannel0-3 | sampler2D | Input textures/buffers | | iChannelResolution[4] | vec3[] | Resolution of each channel | | iDate | vec4 | Year, month, day, time in seconds |

Building for Production

shader build my-shader

Output is in dist/ - a single HTML file with embedded JavaScript that can be hosted anywhere.

License

MIT