Docs

Get started

Scaffold a Sixb project, run it, and define your first object type. By the end you will have a running runtime, a live object in the built-in UI, and a feel for how the pieces fit together.

Sixb is Bun-only. Install Bun first.

Scaffold a project

create-sixb writes a starter project from the basic template: an ontology, a function, an action, and a custom app.

BASH
bun create-sixb my-app
cd my-app
bun install

The template gives you:

PathWhat it is
sixb.config.tsRuntime entry — calls createSixb() with local providers
ontology/counter.tsA Counter object type
functions/tick.tsA function that increments the counter every second
actions/reset.tsAn action that resets the counter
app/page.tsxA custom app page that reads the counter live

Start the dev server

BASH
bun sixb dev

sixb dev loads sixb.config.ts, starts the runtime (functions, syncs, and workers co-hosted), and serves three things:

ServiceURLPurpose
Atlas UIhttp://localhost:3000Built-in UI to browse objects, telemetry, and events
Custom apphttp://localhost:3001Your app/ pages (served only when app/ has routes)
APIhttp://localhost:3002HTTP/WebSocket API and OpenAPI docs

Open http://localhost:3000 and you will see the Counter object. The tick function writes telemetry to it once per second, so its value climbs live.

Define an object type

Object types live in ontology/ and are auto-discovered — add a file and sixb dev picks it up on the next save. Import ontology builders from @sixb/core/ontology.

TSontology/customer.ts
import { defineObjectType, prop, stringEnum } from "@sixb/core/ontology"

export const Customer = defineObjectType({
  id: "Customer",
  name: "Customer",
  description: "A company customer.",
  properties: [
    prop("id", "string", { required: true, primary: true }),
    prop("name", "string", { required: true }),
    prop("email", "string"),
    prop("company", "string"),
    prop("tier", stringEnum(["bronze", "silver", "gold", "platinum"])),
  ],
})

Every object type needs exactly one primary: true property as its key. See object types and properties for the full options.

Write some data

sixb.objects(Type) is the typed API for all object reads, writes, telemetry, links, and actions. Seed a Customer from a function and the runtime writes it on the next tick. The primary id goes inside properties — there is no separate key field.

TSfunctions/seed.ts
import { defineFunction } from "@sixb/core"
import { Customer } from "../ontology/customer"

export const seedCustomer = defineFunction("seed-customer")
  .interval(5000)
  .run(async ({ sixb }) => {
    await sixb.objects(Customer).upsert({
      properties: {
        id: "cust-001",
        name: "Dana Smith",
        email: "dana@globex.test",
        company: "Globex",
        tier: "gold",
      },
    })
  })

Save it under functions/ and refresh Atlas to see cust-001. From here you can query it, link it to an Employee, append telemetry, or render it in your app.

Next steps

Search docs

Search the documentation