Examples

The examples/ folder holds runnable Sixb projects. Clone one, run it with Bun, and read it end to end. Each is a standard Sixb project: sixb.config.ts calls createSixb(), while convention folders such as ontology/, actions/, and connectors/ are discovered at startup.

ExampleWhat it showsStorage / broker
northlineCanonical commercial service-operations app: three typed source clients, SQL pipelines, projections, actions, workflows, and an optional context-aware operations assistantSQLite + DuckLake + local sandbox + in-memory broker
authAuthentication strategies, groups, membership policies, and scoped rolesSQLite + in-memory broker
panasonic-acReal-device integration: scheduled snapshots, device and telemetry projections, and control actionsPostgres + NATS
roku-tvDevice discovery, telemetry twins, and remote-control actionsSQLite + in-memory broker

Run the reference example from the repository root:

BASH
bun --filter @sixb/example-northline dev

Or from its folder:

BASH
cd examples/northline
bun run dev

northline — the operations reference

Northline Mechanical is a fictional commercial HVAC and building-services operator. Northline Operations connects customer and contract records, field-service work, and building-controls data around a central ServiceCase.

The golden journey is:

TXT
alarm -> coverage -> dispatch -> diagnosis -> quote -> repair -> recovery -> closure
FolderDemonstrates
ontology/Eleven focused object types including Equipment, ServiceCase, WorkOrder, ServiceVisit, and Quote — see Ontology
lib/sources/, connectors/Validated, atomic file-backed source clients behind three typed connectors — see Connectors
datasets/, syncs/, schedules/Source-shaped business, field-service, and controls ingestion — see Datasets and Syncs
pipelines/DuckDB SQL for reading normalization, equipment-health derivation, and alarm context assembly — see Pipelines
projections/Object, link, and physical telemetry materialization — see Projections
actions/Contract-aware lifecycle commands with idempotent source writeback — see Actions
rules/Dispatch, SLA, assignment, and recovery attention state — see Rules
workflows/Deterministic dispatch and repair-quote reviews with human interventions — see Workflows
agents/An optional Vercel AI Gateway operations assistant backed by a local development sandbox or hosted smolvm — see Agents
app/Northline Operations: a compact desktop shell, mobile technician route, and contextual agent panel — see Apps
tests/Fixed-clock scenario, source persistence, and business identity checks — see Testing

Its sixb.config.ts uses local-first providers and needs no external services:

TS
import { mkdirSync } from "node:fs"
import { LocalBlobStorage } from "@sixb/blob-local"
import { createSixb, InMemoryBroker, InMemoryQueues } from "@sixb/core"
import { DuckLakeStorage } from "@sixb/ducklake"
import { LocalSandboxFactory } from "@sixb/sandboxes-local"
import { SmolvmSandboxFactory } from "@sixb/sandboxes-smolvm"
import { SqliteStorage } from "@sixb/sqlite"

const localLakePath = ".sixb/lake"
mkdirSync(localLakePath, { recursive: true })

export const sixb = createSixb({
  id: "northline",
  broker: new InMemoryBroker(),
  storage: new SqliteStorage({ path: ".sixb" }),
  lakeStorage: new DuckLakeStorage({
    catalog: { type: "duckdb", path: `${localLakePath}/catalog.ducklake` },
    dataPath: `${localLakePath}/data`,
  }),
  blobStorage: new LocalBlobStorage({ basePath: ".sixb" }),
  queues: new InMemoryQueues(),
  sandboxes:
    process.env.SIXB_SANDBOX_PROVIDER === "smolvm"
      ? new SmolvmSandboxFactory({ image: process.env.SIXB_AGENT_IMAGE, timeout: 30_000 })
      : new LocalSandboxFactory({ timeout: 30_000 }),
})

First-run data follows the same path as later refreshes. bun run dev initializes source files, starts the runtime, requests ordered syncs after readiness, and waits for the required projections. The core example needs no credentials; set AI_GATEWAY_API_KEY only to use the embedded Operations Assistant. Use the explicit replay commands when exploring integration behavior:

BASH
bun run demo:reset
bun run demo:sync
bun run demo:alarm
bun run demo:approve-quote

Read the example README for the complete walkthrough and recommended code-reading order.

auth — authentication and access control

A small app focused entirely on Authentication and Authorization. Auth state persists to local SQLite, so you stay signed in across restarts. Pick the strategy with the SIXB_AUTH_MODE environment variable.

ModePackageSetup
magic-link (default)@sixb/auth-magic-linkZero setup; the sign-in link prints to the terminal
oidc@sixb/auth-oidcSet SIXB_GOOGLE_CLIENT_ID and SIXB_GOOGLE_CLIENT_SECRET

The strategy is selected when you build the runtime:

TS
const runtime = await createSixb({
  id: "auth-example",
  // ...storage, broker, queues
  auth:
    authMode === "oidc"
      ? oidc({
          id: "google-workspace",
          issuer: "https://accounts.google.com",
          clientId: requiredEnv("SIXB_GOOGLE_CLIENT_ID"),
          clientSecret: requiredEnv("SIXB_GOOGLE_CLIENT_SECRET"),
          allowedDomains,
          bootstrapUsers,
          bootstrapGroups: [securityAdmins],
          sendInvitation: sendAuthInvitation,
        })
      : magicLink({
          allowedDomains,
          bootstrapUsers,
          bootstrapGroups: [securityAdmins],
          sendMagicLink: sendMagicLinkEmail,
        }),
})

Beyond sign-in, the security/ folder shows the full access-control model:

FileDemonstrates
security/groups/The security-admins and team-members groups
security/policies/Security admins can invite, assign groups, suspend, and reactivate users
security/roles/Scoped grants for application, objects, datasets, actions, and workflows

Because grants are scoped, the same UI shows different objects, datasets, and actions depending on who is signed in. See Authorization for how grants and roles are defined.

Next

Search docs

Search the documentation