Para / ParaBun

Para

A JavaScript ecosystem in three pieces. Pick whichever ones you need; they don't depend on each other.

The three pieces

Para Lib

Cross-runtime npm packages: signals, parallel, pipeline, arena, simd, csv, arrow, rtp, mcp. Pure JS / Wasm, no platform bindings. Runs on Node, Bun, Deno, browsers, Cloudflare Workers — anywhere V8 or JSC runs.

Distributed today as parabun-browser-shims; individual @para/* packages on the roadmap. Module docs →

Para Lang

Optional .pts / .pjs syntax over the libs: pure / memo functions, signal / effect / ~> / -> reactive bindings, defer / arena blocks, |> pipelines, ..! / ..& error operators, integer ranges. Compiles to standard JavaScript that imports from Para Lib. The output runs anywhere — the language is build-time only.

Compiler today is bundled inside the Para Runtime; standalone @para/transpile in development. Language reference →

Para Runtime (ParaBun)

A fork of Bun that bundles Para Lib + Para Lang and adds native-only modules: para:gpu (libcuda + Metal FFI), para:camera (V4L2), para:audio (ALSA + codecs + DSP), para:image (codecs + resize / blur / sharpen), para:gpio / para:i2c / para:spi (Linux peripheral I/O), para:llm (Llama 3, Qwen2, BERT, Whisper, OpenAI-compatible HTTP), and the higher-level composers (speech, vision, assistant).

Native modules require ParaBun — there's no Node or browser equivalent for direct CUDA dispatch or kernel chardev access. parabun.script.dev →

Syntax (Para Lang)

Signals and effects

A signal declaration creates a reactive cell. Bare reads inside a tracked context (an effect, a derived, a when block, or another signal's RHS) compile to .get(). Bare writes compile to .set(). A signal whose initializer reads other signals is auto-promoted to a derived value.

signal count = 0;
signal doubled = count * 2;       // derived; recomputes when count changes

effect { console.log(doubled); }  // runs once now, again on each change

count++;                          // count.set(count.get() + 1)

Edge-triggered handlers

A when block fires its body once on each false→true transition of the predicate. when not fires on the true→false transition. The predicate is tracked the same way an effect body is.

signal score = 0;

when score >= 100 { unlockAchievement("century"); }
when not online   { showOfflineBanner(); }

Reactive bindings

A ~> B desugars to effect(() => { B = A; }), an assignment that stays in sync. A -> fn desugars to effect(() => { fn(A); }), a call binding. Both are shorthand for the common single-statement effect.

signal name = "world";
name ~> document.title;          // title tracks name
name -> console.log;             // logs on every change

Ranges and pipelines

a..b is an exclusive integer range; a..=b is inclusive. The pipeline operator |> threads a value through a sequence of unary calls.

for (const i of 0..n) work(i);
const evens = 0..=20 |> filter(i => i % 2 === 0);

const out = pixels |> map(p => p * 1.2) |> clamp(0, 255);

Error operators

..! is .catch. ..& is .finally. They chain naturally with await to flatten a try/catch block.

const data = await fetch(url).then(r => r.json())
  ..! err => defaults
  ..& ()  => spinner.hide();

Compilation

Para files (.pts) are parsed by ParaBun's transpiler. (Mainline Bun doesn't recognize the syntax — the parser additions are part of the ParaBun fork.) The output is standard JavaScript with a handful of imports from para:* module specifiers.

On ParaBun, those specifiers resolve to built-in modules. On any other host (browser, Node, Bun, Deno, Cloudflare Workers, …) alias them to parabun-browser-shims in your bundler.

// vite.config.ts
import { defineConfig } from "vite";

export default defineConfig({
  resolve: {
    alias: [{ find: /^para:(.*)$/, replacement: "parabun-browser-shims/$1" }],
  },
});

The same one-line alias works for esbuild, webpack, and rollup. See the install guide for the variants.

$npm install parabun-browser-shims
$parabun build src/main.pts --outdir dist/

ParaBun is required for the build step today (it owns the .pts parser). A standalone npm-installable transpiler (@para/transpile) is on the roadmap.

Examples

Three worked projects, one per host environment. Each is a complete project with file layout, source, and build commands.