Klorad SDK · 0.2
Build digital twins on an Earth anchored world model.
A scene anchored on a real place, objects that mirror physical things, readings ordered by when they happened, and Actions that only the right people can take. In TypeScript, with React bindings and a three.js renderer, for the developers of Klorad customers and partners and the agents they work with.
import { createScene } from "@klorad/api/world";
import { connectSource, fixtureSource } from "@klorad/api/integration";
// Space: every scene is anchored on Earth.
const scene = createScene({ coordinateSystem: { origin: { lat: 40.62637, lon: 22.94838 } } });
// Physical correspondence: a Digital Shadow bound to a sensor.
scene.add({
id: "entrance",
name: "Entrance counter",
position: { east: 16, north: -10 },
correspondence: "shadow",
binding: { source: "gateway", entity: "entrance-01" },
});
// Integration: readings flow one way, from the source into the shadow.
connectSource(scene, fixtureSource({
id: "gateway",
channels: [{ entity: "entrance-01", quantity: "occupancy", unit: "people", value: (t) => 20 + (t % 7) }],
}));
// Time: the current state is the reading observed last, not the one that arrived last.
const label = document.getElementById("occupancy")!;
scene.subscribe(() => (label.textContent = `${scene.latest("entrance", "occupancy")?.value ?? "?"} people inside`));Where to go
QuickstartFrom an empty folder to a rendered, data fed twin.ConceptsThe model behind the API: three layers and four pillars.GuidesTask by task: connect an API, style by readings, add Actions, give a team a World.ReferenceEvery package, every export, what it takes and what it returns.SandboxEach capability running live, built only on the public packages.The thesis modelWhy the API looks the way it does, class by class.
Packages
@klorad/apiThe world model: scenes, objects, observations, interaction. Integration under /integration.@klorad/reactReact bindings: declare objects, read state with hooks.@klorad/engine-threeDraws a scene with three.js and follows its events.@klorad/accessWorlds, entitlement and the audit log.@klorad/notifyRules over scene events raise alerts, scoped to Worlds.