Getting started
What is Tiny Engine?
tiny-engine-core is a small JavaScript runtime for building declarative UI on top of plain HTML. It gives you Capsule classes and functions, a lifecycle-aware engine, a reducer store, devtools snapshots, and plugins.
From a CDN
Include tiny-engine-core via unpkg:
<script src="https://unpkg.com/tiny-engine-core"></script>Why another micro-framework?
Most modern frameworks ship a lot of runtime even when you don't need it. tiny-engine-core sits in the niche of just enough: when you need a counter, a tab strip, a dropdown, a modal - but you don't want to ship React, Vue, or even Alpine.
It works in a script tag, in an ESM bundle, or alongside any framework. Mount it inside a React component and let tiny-engine handle a small widget without re-rendering your tree.
Hello, capsule
The smallest useful program is a counter. Here's what it looks like:
<button ui-counter ref="root">
Clicked <span ref="label">0</span> times
</button>
<script type="module">
import { UI, Capsule } from "https://unpkg.com/tiny-engine-core";
const Counter = (el, api) => {
let count = 0;
api.on(el, "click", () => {
count++;
api.refs.label.textContent = count;
});
return {};
UI.register("counter", Counter);
UI.init();
</script>Concepts at a glance
Capsules
Self-contained components scoped to a DOM element. Class or function - both supported.
Lifecycle
Mount, observe, and unmount with predictable hooks. Auto-init on DOM ready.
Prefix system
Brand your data attributes - data-app-toggle, data-shop-toggle, anything goes.
Pluggable store
CapsuleStore ships with reducer actions, middleware, subscriptions, and devtools snapshots.
DX, Devtools & Plugins
New in 1.6.0: UI.scan/UI.destroy, hydration-safe sync, batched observer work, and perf metrics.
Browser support
tiny-engine-core targets evergreen browsers - anything that ships ES2020 and MutationObserver. That covers Chrome, Edge, Firefox, Safari, and modern WebView.