Skip to content

Design and packages ​

Kambium Kit supplies reusable integration infrastructure. An application chooses its engines, configures services and owns its product policy. An engine owns the behavior of one integration kind. Keep those responsibilities explicit so an engine can run in another host without importing that host's application.

Ownership boundaries ​

LayerOwnsTypical application files
ApplicationInstalled engine catalog, infrastructure settings, routes, deployment, branding and access policyindex.ts, dashboard/, build and host configuration
EngineConnection declarations, task handlers, provider processing, lifecycle validation and its configuration pageengines/<kind>/ or an installed engine package
CoreContext construction, provider services, task execution, shared lifecycle coordination, authentication and workspacesSupplied by the Kit
Dashboard and frontend foundationsConfigured stores, shell, account/workspace controls and reusable engine UIComposed by the application
CLIApp generation, local service lifecycle and process toolingInvoked through generated npm scripts

Application setup reads environment values and passes configuration to createServer. Engine factories receive their credentials and options from that host. A reusable engine should not discover the host's secret manager, environment or installed-engine catalog for itself.

Choose an entry point ​

New generated applications use @kambium/kit, which pins a coordinated combination of core, shared contracts, shared components and dashboard. The CLI is installed separately and pins the kit version used for generation.

ImportIntended use
@kambium/kitEngine definitions, portable contracts and error classes; browser-safe root
@kambium/kit/shared/engine-runtimeBrowser-safe engine capability declarations
@kambium/kit/shared/typesShared data and task payload contracts
@kambium/kit/servercreateServer and server configuration; Node only
@kambium/kit/buildServer build tooling; Node only
@kambium/kit/frontendFrontend stores and engine component contracts
@kambium/kit/frontend/uiEngine page, setup and activity components
@kambium/kit/dashboardDashboard shell, sidebar, settings and engine routes

Kit forwards the owning modules; it does not initialize services or create another store instance. Backend-only applications can use core directly. When mixing kit and direct package imports, keep their selected versions aligned to preserve module identity and compatible peers. See the kit contract.

Keep runtime declarations public ​

An engine's runtime metadata describes its kind and connection capabilities. The backend definition supplies executable behavior, OAuth credentials and processing policy. The dashboard imports runtime metadata without pulling server code or secrets into the browser. See Engine definitions.

Reuse operation services ​

A provider hook or engine task receives an EngineContext for one matched engine instance. Pass that context or its existing services to helpers. Its lazy provider services reuse the operation's PowerService. Constructing another service in each helper can split token state, retries or in-flight coordination.

Long-lived workers, caches and connection infrastructure belong to their configured server runtime. Per-operation identity, authorization and logs stay scoped to that operation. Stateful behavior can belong in core; its scope and shutdown must be defined. See core ownership and server lifetimes.

Treat persistence as a contract ​

Engine kinds and task operation names are application-owned strings. Adding one does not require changing a shared enum in the Kit. Existing database/API names such as sync, sync_id and SyncRecord identify engine instances; preserve those names when using their contracts.

Supabase Postgres stores engine instances and tasks. It also backs task claims and distributed locks across replicas. Redis holds caches and temporary state. Engines own recovery for any state they add. See Scaling and Database access and recovery. The schema import metadata records files, while Supabase migration history records database application. Startup of a hosted app never applies migrations.

Use explicit callback inputs and report failed work where it occurs. Task recovery can replay work, so successful side effects need deliberate idempotency; see Task execution. A code rollback does not reverse stored data or SQL changes; see Update your application.