Plugin authoring
Build and serve an external Astrofox display or effect plugin.
An external plugin is a small directory containing an
astrofox.plugin.json manifest plus a fragment shader or JavaScript module.
Astrofox supports three combinations:
| Type | Runtime | Purpose |
|---|---|---|
| Display | Shader | Generative 2D fragment-shader layer |
| Effect | Shader | Post-processing pass over the current scene |
| Display | Worker | Sandboxed JavaScript canvas or Three.js layer |
Effect plugins support the shader runtime only. A worker effect is rejected.
Start with an example#
The Astrofox repository includes complete examples under
examples/plugins:
| Example | Shows |
|---|---|
bass-glow | Shader effect with property uniforms |
plasma | Shader display with FFT data |
pulse-bars | 2D canvas drawing in a sandboxed worker |
audio-orb | Three.js through the host-provided library and renderer |
cubes | Three.js instancing with host-driven camera controls |
Copy the closest example, change its namespaced ID, label, and implementation, then run it locally.
Minimal shader display#
Create this structure:
Astrofox automatically adds position, rotation, scale, opacity, and reactor support to external displays. Displays without a camera also get the stage transform overlay. Camera-enabled worker displays use camera control instead.
Develop locally#
Clone the Astrofox repository and run pnpm install once.
Run pnpm dev:plugins from the Astrofox repository. It serves every
example plugin with CORS enabled on an available local port and prints the
manifest URLs.
In Astrofox, select Manage plugins in the action rail and install the
printed http://localhost:…/astrofox.plugin.json URL.
Edit the plugin files, then use Reload in Manage Plugins. Localhost plugins are marked as development installs.
Publish#
Host the manifest and all referenced files on the same HTTPS-accessible origin. Relative file references resolve from the manifest URL. The server must allow Astrofox to fetch the files with CORS.
Increase the manifest version when you publish changes. Installed releases
are cached and integrity-pinned, so users choose when to update.
Keep plugin URLs stable and version the manifest semantically. Projects retain the plugin source URL and version, which makes missing dependencies understandable later.
Continue with Plugin runtimes or use the manifest reference.
