Skip to content

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.

PackageRole
@idlekitjs/coreHeadless engine: loop, state, events, saves, numbers, RNG
@idlekitjs/domDOM renderer and declarative bindings
@idlekitjs/browserBrowser bridges (page lifecycle, rAF frames, screen)
@idlekitjs/economyPure economic resources, costs, rewards and transactions
@idlekitjs/mechanicsGameplay primitives (producers, crafting, boosts, ...)
@idlekitjs/pluginsEngine policies (autosave, offline progress)
@idlekitjs/storagePersistence backends (memory, localStorage)
@idlekitjs/typesShared contracts, zero logic
@idlekitjs/utilsPure, 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.