Octane is a fast, JavaScript UI framework — the successor to Inferno, the React-like library built to stay close to the speed of hand-written DOM code. Octane keeps that goal and modernizes everything around it: you write with the React API you already know, but a compiler removes the virtual DOM, Suspense waterfalls, rules-of-hooks bookkeeping, and hand-maintained dependency arrays before your app ships.
If you know React, you already know Octane. useState, useEffect, memo,
context, portals, Suspense, transitions — same API, same mental model, checked
the boring way against a large behavioral test suite. React-derived coverage is
tracked case-by-case in the generated
React parity coverage report, rather than
inferred from the size of the whole suite. Your React knowledge just works.
Speed was never going to be enough on its own, though. The reason to reach for Octane is the day-to-day feel:
- Write the JSX you already write. Standard
.tsx/.jsxruns out of the box — paste a component from the React docs and it works, hooks and all. - Or opt into
.tsrxfor more. TSRX is the spiritual successor to JSX: the same mental model, plus template directives (@if,@for,@switch,@try) that compile to keyed fast paths, and an@{ … }shorthand that lets setup sit right next to the output. Mix both dialects in one app and import freely across the boundary — you choose per component. - Write the closure, not its dependency list. Omit the array from
useEffect,useLayoutEffect,useInsertionEffect,useMemo,useCallback, oruseImperativeHandleand the compiler derives it from lexical captures, including knowledge of stable setters, dispatchers, refs, state getters, and effect events. It is the no-bookkeeping dependency DX associated with signal frameworks, while keeping the hooks model you already know. Explicit arrays remain authoritative; passnullwhen you intentionally want every render. Built-in hook calls retain this inference inside custom hooks, including compiler-processed plain.ts/.jsmodules. A separate, narrower rule also infers omitted dependency arguments at calls to locally declared custom wrappers in fully compiled.tsrx/.tsxmodules when they transparently forward a callback and final dependency parameter to one of these hooks. - No rules of hooks. Hooks are tracked by call site, not call order, so a
hook can live inside an
ifor after an early return — the usual React footguns simply aren't there. The one rule that remains is enforced for you: a hook in a plain JS loop is a compile error (every iteration would share one call-site slot) — loop with the keyed@fordirective instead, where each item gets its own hook state. - The platform, not a reimplementation of it. Real delegated DOM events,
controlled form components on native events (React's
value/checkedsemantics —onInputper edit, nativeonChangeon commit), and refs-as-props (ref={cb},ref={obj}, evenref={[a, b]}) — no synthetic layer second-guessing the browser. - No virtual DOM. Components re-render like React, but a compiled render path and a LIS-based keyed reconciler keep the runtime overhead minimal.
Created by Dominic Gannaway, who also created Inferno and has worked on React, Lexical, Ripple, and Svelte.
Octane is currently in alpha development.
The core suite contains 3,900+ distinct behavioral tests across conformance,
differential, hydration, runtime, compiler, and SSR coverage. The octane-prod
project reruns the normal suite against the production compiler path, so those
executions are valuable mode coverage but are not counted again as unique tests.
This is an Octane suite count, not a claim that every test was ported from React;
the exact pinned snapshot and source-attributed React counts come from the
coverage ledger and report.
- The full React hook API —
useState,useEffect,useMemo,useRef,useId,useTransition,useDeferredValue,use, and the rest — with the same effect ordering and Suspense semantics, plus compiler-inferred dependency lists when you omit them. In production builds,useMemo/useCallbackcompile to inline caches: a dependency hit allocates nothing — no factory closure, no deps array. - Promises in render are safe — no
cache()wrapper: creations feedinguse()are memoized at their declarations, including local.thenchains (const p = fetchUser(id); const t = p.then(…); use(t)). Independent requests start together, one suspension per stratum, and descendant fetch trees prefetch while an ancestor is still suspended. - Fully async — transitions, deferred values, and
<Activity>. - Streaming SSR and byte-stable hydration — out-of-order Suspense flushing over Node or web streams, or buffered/static rendering when you want it.
- Errors handled two ways — the
<ErrorBoundary>component, or@try/@catchin TSRX. class/classNamecomposes clsx-style everywhere — strings, arrays, objects, and nesting, at every apply site.- Refs as props, including array composition (
ref={[a, b]}) — noforwardRef. Works with spreads, SSR, and hydration. - Controlled form components on native events —
value/checkedfollow React's controlled semantics exactly;defaultValue/defaultCheckedopt out. The per-edit handler is the nativeonInput;onChangekeeps its browser commit meaning rather than React's synthetic text-input meaning.
Octane is deliberately narrow where React has grown wide: no class components, no Server Components, no synthetic event system. Those are choices, not gaps — see Differences from React.
Use onInput when text state should update with each edit. Octane reports
OCTANE_NATIVE_TEXT_ONCHANGE when a text-entry <input> or <textarea> appears
to use React's per-edit onChange convention. Statically known JSX is reported by
the compiler; unresolved spreads and dynamic input types are checked in development
after their final props are applied. The warning does not rewrite the event:
onChange remains the native commit event.
<input value={query} onInput={(event) => setQuery(event.currentTarget.value)} />Native commit-on-blur behavior is valid. Mark that intent explicitly so tools and development diagnostics do not recommend a per-edit handler:
<input
defaultValue={savedDraft}
onChange={(event) => save(event.currentTarget.value)}
suppressNativeChangeWarning
/>The suppression is a JS-only host hint: it is not serialized, changes no event behavior, and should not be used on component callbacks, selects, checkboxes, or radios. Those cases are already outside the text-entry warning.
Octane's published packages require Node.js 22 or newer.
pnpm add octane @octanejs/vite-pluginOr let the CLI wire it up, including the TypeScript settings .tsrx needs:
pnpm dlx @octanejs/cli initFor any Vite app, add Octane's Vite integration:
// vite.config.ts
import { defineConfig } from 'vite';
import { octane } from '@octanejs/vite-plugin';
export default defineConfig({
plugins: [octane()],
});Without octane.config.ts, the plugin compiles a normal client-only SPA and
preserves Vite's standard HTML handling. Add an Octane config with routes to
activate routing, streaming SSR, hydration, and client/server production builds.
Octane also supports Rspack and Rsbuild 2.x. Use the low-level Rspack plugin when you own the application shell and entries yourself:
pnpm add -D @rspack/core @octanejs/rspack-plugin// rspack.config.mjs
import { OctaneRspackPlugin } from '@octanejs/rspack-plugin';
export default {
entry: './src/main.tsrx',
plugins: [new OctaneRspackPlugin()],
};Use the Rsbuild plugin for the full Octane app layer: routing, streaming dev SSR, hydration entries, client/server production environments, preview, and deployment adapters.
pnpm add @octanejs/rsbuild-plugin
pnpm add -D @rsbuild/core// rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
import { pluginOctane } from '@octanejs/rsbuild-plugin';
export default defineConfig({
plugins: [pluginOctane()],
});The same @octanejs/vite-plugin setup above provides these app-level features
for Vite. See the
build tools guide for SPA, SSR,
client/server target, HMR, and config examples.
Pass profile: true to the Vite, Rspack, or Rsbuild integration to create a
client profiling build with component timing, render counts and causes,
schedule-to-render delay, Chrome Performance tracks, and a bounded console API.
Normal production builds omit the compiler metadata and tree-shake the recorder
unless application code imports octane/profiling directly. See the
profiling guide.
Production client compilation automatically reuses conservative same-module pure component regions and keyed lists by inferred lexical dependencies, using React-Compiler-style strict-identity snapshots and the normal context-aware Block/keyed-list machinery. There is nothing to configure and no flag to learn: the proof fails closed, so HMR, dev, profiling, and server builds use normal reconciliation, and effects, refs, mutable ambient reads, custom comparators, and Suspense/transition boundaries keep their authored every-render behavior. Caching render-used imported calculations and their descriptor output is a later phase that ships together with per-key descriptor reuse.
// main.ts
import { createRoot } from 'octane';
import { App } from './App.tsrx';
const root = createRoot(document.getElementById('root')!);
root.render(App, { title: 'Hello world!' });Octane's SSR entry points mirror React's, so this maps onto what you already do.
octane/server is the request-time renderer (React's react-dom/server) — pick
buffered (renderToString) or streaming (renderToPipeableStream /
renderToReadableStream); octane/static is the static-generation renderer
(react-dom/static). Buffered renders hand back { html, css } — hoisted
<title>/<meta>/<link> fold into html (as in React 19), and css is the
deduped scoped-<style> tags, which the client's injectStyle matches on
hydration so styles cross the boundary exactly once.
// entry-server.ts
import { renderToString } from 'octane/server'; // sync; fallbacks for suspended boundaries
import { prerender } from 'octane/static'; // async; awaits all Suspense data
import { App } from './App.tsrx';
export async function renderApp() {
const { html, css } = await prerender(App); // { html, css }
return { html, css };
}| API | Module | Await | Suspense boundary that suspends |
|---|---|---|---|
renderToString(el, props?, opts?) |
octane/server |
no (sync) | renders its @pending fallback |
renderToStaticMarkup(el, props?, opts?) |
octane/server |
no (sync) | fallback; no hydration markers/seeds |
renderToPipeableStream(el, props?, opts?) |
octane/server |
streams | shell ships the fallback; boundary streams in when it settles |
renderToReadableStream(el, props?, opts?) |
octane/server |
streams | shell ships the fallback; boundary streams in when it settles |
prerender(el, props?, opts?) |
octane/static |
yes | awaits data, renders the success arm |
The buffered/static renderers accept a RenderOptions (CSP nonce, a root-local
identifierPrefix, an AbortSignal, and a per-render timeoutMs). See
docs/ssr.md for the full server guide (Suspense on the server,
head hoisting, module server RPC) and the SSR roadmap.
Use <Hydrate> for server-rendered content that should stay visible but does
not need to become interactive immediately. when chooses the activation
strategy, split controls compiler extraction (on by default), and prefetch
can prepare the generated child chunk or other resources ahead of activation.
import { Hydrate } from 'octane';
import { visible } from 'octane/hydration';
export function ProductPage() @{
<Hydrate when={visible({ rootMargin: '400px' })}>
<Reviews />
</Hydrate>
}
The initial server DOM is adopted in place and remains inert until the strategy opens the boundary. See docs/deferred-hydration.md for strategies, code splitting, prefetching, fallbacks, and nesting behavior.
This is the fast-first-paint story, and it works the way React's does.
renderToPipeableStream (Node streams) and renderToReadableStream (web streams)
flush a shell immediately — the full page, with @pending fallbacks standing
in for anything still suspended — so the browser paints without waiting on your
slowest data. Each Suspense boundary then streams in out of order the moment
its data settles, as a hidden segment plus a tiny inline swap script. When the
client hydrates, hydrateRoot adopts the swapped-in DOM byte-for-byte, per-boundary
use() seeds included — no re-render, no flash.
// entry-server.ts (Node)
import { renderToPipeableStream } from 'octane/server';
import { App } from './App.tsrx';
export function renderApp(res) {
const { pipe } = renderToPipeableStream(App, undefined, {
onShellReady() {
res.statusCode = 200;
res.setHeader('content-type', 'text/html');
pipe(res); // shell flushes now; boundaries stream in behind it
},
onShellError(err) {
res.statusCode = 500;
res.end('<!doctype html>Server error');
},
});
}renderToReadableStream returns a Promise<ReadableStream<Uint8Array>> that
resolves once the shell is ready (rejects on a shell error). It is pull-driven,
honors consumer cancellation, and carries an allReady promise that settles
when every boundary chunk has been accepted under backpressure; consume the
stream concurrently rather than awaiting allReady before reading. The Node
stream honors write(false)/drain and cancels on destination error or close.
Both accept a StreamOptions (RenderOptions plus onShellReady(),
onShellError(err), and onAllReady()). The Vite and Rsbuild metaframework
plugins render through renderToReadableStream by default.
// entry-client.ts
import { hydrateRoot } from 'octane';
import { App } from './App.tsrx';
hydrateRoot(document.getElementById('app')!, App);A component is any function you use at a <Foo/> site — there's no separate
"component" declaration. A function renders whatever it returns: a JSX root, a
primitive (coerced to text), null, or an array. @{ … } is simply shorthand
for returning JSX — function f() @{ … } desugars to function f() { … return <jsx> } — so hooks and locals can sit next to the output (the @{ … } scope ends
with one output node, a JSX element or a fragment). Both forms compile
identically, and any function can use either.
import { useState } from 'octane';
export function Counter() @{
const [count, setCount] = useState(0);
<button onClick={() => setCount(count + 1)}>
{'Count: ' + count}
</button>
}The same component written with an explicit return is identical — and a
function is free to return a non-JSX value, which is coerced like any renderable:
export function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount(count + 1)}>{'Count: ' + count}</button>;
}
function Label(props) {
if (props.hidden) return null; // renders nothing
return props.text; // a string renders as text
}import { useState, useEffect } from 'octane';
export function Timer() @{
const [seconds, setSeconds] = useState(0);
useEffect(() => {
const id = setInterval(() => setSeconds((s) => s + 1), 1000);
return () => clearInterval(id);
});
<p>{'Elapsed: ' + seconds}</p>
}Dependency arrays are optional in Octane. When one is omitted from
useEffect, useLayoutEffect, useInsertionEffect, useMemo, useCallback,
or useImperativeHandle, the compiler derives it from the callback's reactive
captures. It understands member reads and stable hook results such as state
setters, reducer dispatchers, refs, and state getters. It also omits
useEffectEvent results because Effect Events are non-reactive captures, even
though React-compatible wrappers have a fresh identity on each render.
This applies to built-in hook calls inside compiler-processed custom hooks,
including custom hooks written in plain .ts or .js modules:
import { useEffect, useMemo } from 'octane';
export function useLoggedValue(value: string, log: (value: string) => void) {
const formatted = useMemo(() => value.toUpperCase());
useEffect(() => {
log(formatted);
});
return formatted;
}The memo's inferred dependency is value; the effect's inferred dependencies
are formatted and log. Changes propagate through the custom hook without
requiring its caller to pass a dependency array.
Explicit arrays keep their React meaning and are never rewritten. Pass null
for the uncommon every-render form:
useEffect(() => sync(room.id)); // inferred from the closure
useEffect(() => initialize(), []); // explicitly mount/reconnect only
useEffect(() => sync(room.id), [room.id]); // explicit dependencies
useEffect(() => measure(), null); // explicitly after every commitInferring a missing dependency argument at a call to a custom wrapper is a
separate case. In a fully compiled .tsrx/.tsx module, a locally declared
wrapper qualifies when it transparently forwards a callback and its final
dependency parameter:
function useTrackedEffect(callback, dependencies) {
useEffect(callback, dependencies);
}
useTrackedEffect(() => sync(room.id)); // inferred from the closureThis proof is deliberately local and conservative. The surgical pass for plain
.ts/.js modules still infers direct built-in hook calls, but it does not
infer dependency arguments at calls to custom wrappers. Imported or method-style
wrappers and wrappers that transform or inspect their callback or dependency
parameter also require an explicit dependency argument.
useState and useReducer also expose an optional third tuple member: a stable getter for
the hook's latest state. It is useful in async callbacks and other long-lived
closures where capturing the render's state value would go stale:
export function SaveButton() @{
const [draft, setDraft, getDraft] = useState('');
const saveLater = async () => {
await waitForConnection();
await save(getDraft()); // the latest draft, not the render that started this callback
};
<button onClick={saveLater}>{'Save ' + draft}</button>
}The compiler emits a getter-enabled hook only when the third tuple member can
be observed. Ordinary [state, setState] and [state, dispatch] destructures
keep the existing two-item runtime path and allocate no getter. Escaped or
ambiguous tuples conservatively receive the complete three-item shape. The
getter reads the latest scheduled hook value, which may be newer than the
currently committed DOM during a pending render.
Unlike React, a hook can sit behind a guard or after an early return:
import { useState, useEffect } from 'octane';
export function Panel(props) @{
const [n, setN] = useState(0);
// An early return before a hook is fine in octane. Each hook call site has a
// stable compiler-assigned slot, so render order can't desync the hooks.
if (props.hidden) return;
useEffect(() => {
console.log('n changed:', n);
});
<button onClick={() => setN(n + 1)}>{'count: ' + n}</button>
}Rendered control flow uses directive-prefixed blocks: @if, @for, @switch,
and @try. Plain JavaScript control flow stays in setup code.
Directive arms keep setup and output separate: a bare expression statement such as
console.log(value); or value; is setup and does not render. To render a computed
value, make the output explicit with a fragment: <>{value}</>.
export function Feed(props) @{
<ul>
@for (const item of props.items; key item.id) {
<li>{item.title as string}</li>
} @empty {
<li>Nothing to show</li>
}
</ul>
}export function Greeting(props) @{
@if (props.name) {
<p>{'Hello, ' + props.name}</p>
} @else {
<p>Hello, stranger</p>
}
}An authored <script> body is static, raw script text. Braces are literal source,
so blocks and object literals work normally; Octane does not treat {...} inside
the body as a TSRX interpolation:
export function Bootstrap() @{
<script>
window.appConfig = { locale: 'en-GB' };
</script>
}For a dynamic whole-script value, use the standard raw-content prop. Serialize structured values explicitly:
export function Rules(props) @{
<script
type="speculationrules"
dangerouslySetInnerHTML={{ __html: JSON.stringify(props.rules) }}
/>
}<script>{JSON.stringify(props.rules) as string}</script> is static script source,
not an interpolation; the cast does not change the raw-text grammar.
dangerouslySetInnerHTML supplies the complete body and cannot be combined with
child content. Client mounts and updates write it through textContent; server
rendering neutralizes case-insensitive opening and closing script tokens without
HTML-escaping ordinary JavaScript or JSON characters. This prevents the value from
creating sibling markup, but it does not validate or sanitize executable
JavaScript—only inject executable source you trust.
class (and its alias className) accepts more than a string. Octane composes the
value the same way the clsx / classnames libraries do — from strings, numbers,
arrays, objects, and any nesting of those — so you can build a class list inline
without a helper. Falsy parts (false, 0, null, undefined, '') drop out;
object keys are kept when their value is truthy.
export function Button(props) @{
<button
class={[
'btn',
props.size, // 'btn lg'
{ active: props.active, disabled: props.disabled },
props.extra, // string | array | object | falsy
]}
>
{props.label as string}
</button>
}Composition is native to the runtime (no dependency) and works everywhere a class
does: dynamic bindings, {...spread} props, SVG elements, scoped-<style> components
(the scope hash is appended after your classes), and server rendering (the SSR output
and client render compose byte-identically, so hydration never mismatches).
Unlike React — which coerces
className={['a', 'b']}to the string"a,b"— this is a deliberate Octane convenience. A plain string still takes the fast path.
The full docs live at octanejs.dev, a site built with Octane itself. Good places to start:
- Quick start — install, mount, and
the
.tsrxessentials. - Build tools — configure Vite, Rspack, or Rsbuild for SPA compilation and full-stack SSR.
- TSRX vs TSX/JSX — when to reach for
each dialect and exactly what TSRX unlocks: compiled
@forcollections, template control flow, and text holes. - Differences from React — the deliberate divergences, and why everything else matching React is the point.
- Bindings — the
@octanejs/*ports of the React ecosystem.
This is a pnpm monorepo containing the core runtime+compiler, the metaframework
plugin (and its Vercel and Cloudflare adapters), the CLI, an MCP server, private evaluation tooling, and
the framework bindings. The current workspace package inventory and counts are
generated from the workspace manifests in
docs/packages.md:
octaneis the runtime and the compiler together. It covers rendering, the hook API, the server (SSR) and client (hydration) entry points, and the compiler itself, exposed atoctane/compilerwith bundler adapters atoctane/compiler/viteandoctane/compiler/bundler.@octanejs/app-corecontains the bundler-neutral app config, routing, SSR, hydration code generation, and production handler used by the metaframework integrations.@octanejs/rspack-pluginis the low-level Rspack compiler integration;@octanejs/rsbuild-pluginis the full Rsbuild metaframework integration.@octanejs/vite-pluginis the recommended integration for every Vite app: compiler integration for SPAs, plus dev SSR, routing, hydration, and production server builds when app routes are configured;@octanejs/adapter-verceldeploys its build output to Vercel, while@octanejs/adapter-cloudflareemits a streaming module Worker for Cloudflare Workers Static Assets.@octanejs/tanstack-startis the public Octane TanStack Start integration. It owns the Octane-specific Start runtime, file-route generation, server-function compilation, streaming SSR, hydration, and Vite development and production integration, using@octanejs/tanstack-routeras its router binding.@octanejs/cliis theoctanecommand line:initwires Octane into an existing project,doctorfinds and repairs the misconfigurations that break Octane quietly,addinstalls a binding and reports its divergences,explaindecodes a runtime error code, andmcp addregisters the MCP server with Claude Code, Codex, Cursor, or VS Code.@octanejs/mcp-serverexposes octane docs and compile tooling to AI agents over MCP.@octanejs/evalsis the private workspace package for standalone Octane application prompts, starter workspaces, behavioral graders, public reference implementations, and reproducible evaluation tooling. It measures framework use rather than monorepo repair. Active held-out material stays outside the repository.- The
@octanejs/*framework bindings — each an octane port of a React library:zustand,jotai,ai,query,store,form,apollo-client,motion,stylex,router,remix-router,table,virtual,lexical,tiptap,floating-ui,radix,hook-form,base-ui,sonner,recharts,visx,three,lucide,redux,redux-toolkit,testing-library,i18next, andmdx. Parity varies by package — some are behaviorally complete, others are explicitly partial or alpha.docs/bindings-status.mdis the generated per-package status table (upstream version, supported surface, known divergences, SSR/hydration, last evidence check), sourced from each package'sstatus.jsonand checked in CI.
Octane uses pnpm for package management and workspace scripts.
pnpm install # install workspace dependencies
pnpm test # run the test suite
pnpm typecheck # type-check packages, website, and examples
pnpm format # format with Prettierpnpm test runs the projects declared in the root vitest.config.js through a
single Vitest invocation rather than calling each package's test script. Test
console output is silent by default for every project, including failures. Pass
--silent=false through the root script when debugging, or use
--silent=passed-only to print output only for failing tests:
pnpm test -- --silent=false
pnpm test -- --silent=passed-onlyCommand-line options override the root Vitest config.
The playground under playground/octane covers state, keyed
lists, conditional rendering, @switch, dynamic components, and suspense:
pnpm --filter octane-playground devThe applications under examples/ are runnable demonstrations
and Playwright-backed regression fixtures. Validate their manifests, tooling
contracts, strict TypeScript support code, and production builds with
pnpm examples:check; run their browser journeys with pnpm examples:e2e.
MIT