tiny-engine lets you build 2D browser games using JSX syntax backed by a completely custom runtime. There is no React, no virtual DOM, and no DOM rendering at all — JSX compiles directly to a canvas-based scene graph using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sanchedev/tiny-engine/llms.txt
Use this file to discover all available pages before exploring further.
tiny-engine/jsx-runtime. If you already know hooks-style APIs (useSignal, useEffect, useComputed), you already know most of tiny-engine.
Quickstart
Install the package, configure TypeScript, and render your first scene in
under five minutes.
Nodes
Every visual and logical element in a scene is a node:
transform,
sprite, clickable, collider, timer, and more.Reactivity
Signals and computed values propagate changes directly to canvas properties
without any diffing pass.
JSX Runtime
Learn how
tiny-engine/jsx-runtime turns JSX expressions into node trees
at construction time.How it works
When TypeScript compiles your JSX, it callstiny-engine/jsx-runtime instead of React.createElement. The runtime builds a plain description tree (Tiny.Node) that renderToNodes (exported from tiny-engine/jsx) walks to construct real node instances — classes like Transform, Sprite, and Clickable.
Each node has its own start, update, and draw lifecycle. The top-level Game class drives a requestAnimationFrame loop that clears the canvas, calls update on the active scene’s root node, runs the collision system, and then calls draw top-down through the node tree. There is no reconciler; once a node is constructed it stays in the tree until explicitly destroyed.
Reactivity is layered on top via signals. When you write:
SignalGetter on the node’s brightness property. Each frame, reading that property re-evaluates the function and updates the canvas draw call automatically — no re-render, no diffing.
Project structure
tiny-engine is apnpm monorepo with two packages:
| Package | Description | Build |
|---|---|---|
tiny-engine | Core engine library | pnpm engine:build |
demo | Plants vs Zombies-style example game | pnpm demo:build |
demo package is a fully playable game that demonstrates assets, collision, animation, scenes, and scripts. It is the best reference for real-world usage patterns.
Sub-path exports
The package is split into focused entry points so you only import what you need:| Entry point | What it contains |
|---|---|
tiny-engine | Core nodes, collision system, asset loading (loadTexture), math utilities (Vector2), and Game/Scene classes |
tiny-engine/hooks | useSignal, useComputed, useEffect, useEvent, useRefNode, useRef, useMount, useScript, useSpawn, useChild, useGame, useContext, createContext, NodeReference |
tiny-engine/jsx | createGame, renderToNodes, and the JSX components Game, Scene, List, Fragment |
tiny-engine/scripts | TinyScript abstract class for separating game logic from the component tree |
tiny-engine/jsx-runtime | The custom JSX transform consumed by TypeScript — you never import this directly |
tiny-engine is built with The package ships with strict TypeScript types throughout. All node option
interfaces, signal generics, and event callbacks are fully typed — no
verbatimModuleSyntax enabled. When importing
types, use import type syntax:any
escape hatches in the public API.