Appearance
Packages
IdleKit is split into focused packages with strict, one-way boundaries (see the architecture overview). Use what you need; each one is independently importable.
| Package | Role |
|---|---|
@idlekitjs/core | Headless engine: loop, state, events, saves, numbers, RNG |
@idlekitjs/dom | DOM renderer and declarative bindings |
@idlekitjs/browser | Browser bridges (page lifecycle, rAF frames, screen) |
@idlekitjs/economy | Pure economic resources, costs, rewards and transactions |
@idlekitjs/mechanics | Gameplay primitives (producers, crafting, boosts, ...) |
@idlekitjs/plugins | Engine policies (autosave, offline progress) |
@idlekitjs/storage | Persistence backends (memory, localStorage) |
@idlekitjs/types | Shared contracts, zero logic |
@idlekitjs/utils | Pure, platform-agnostic helpers |
Typical stacks
A browser game usually composes several of them:
ts
import { createEngine, SaveManager } from "@idlekitjs/core";
import { Renderer, bindText } from "@idlekitjs/dom";
import { createRafScheduler } from "@idlekitjs/browser/raf-scheduler";
import { createEconomy } from "@idlekitjs/economy";
import { producers } from "@idlekitjs/mechanics/producers";
import { autosave } from "@idlekitjs/plugins/autosave";
import { LocalStorageAdapter } from "@idlekitjs/storage/local-storage";@idlekitjs/types and @idlekitjs/utils are usually indirect dependencies in game code, but they are public packages for integrations and shared helpers.
A headless simulation or test needs only core, plus whichever economy or mechanics pieces it exercises:
ts
import { createEngine } from "@idlekitjs/core";
import { createEconomy } from "@idlekitjs/economy";
import { crafting } from "@idlekitjs/mechanics/crafting";A React/Vue game drops @idlekitjs/dom and reads engine.state from its own components.
Import conventions
Every import goes through a public entry point — the package barrel or a documented subpath (@idlekitjs/mechanics/crafting, @idlekitjs/mechanics/producers/economy, @idlekitjs/storage/local-storage, ...). Prefer subpaths for mechanics, plugins and storage backends: they keep bundles lean and make dependencies explicit. Internal module files are not public API — see module conventions.