Orb is a general-purpose language for reactive applications built on a restricted execution model. Every program is a state machine bound to typed data, composed with other machines over declared events. The compiler checks the whole graph before anything runs, then emits the same program as TypeScript, Python, or Rust — UI included.
curl -fsSL https://orb.almadar.io/install.sh | sh
A task manager in one file: the entity, its state machine, and the page. Every transition carries its own effects, so the compiler can see the whole circuit and generate the frontend, backend, and database from it.
app std-todo "1.0.0"
"Todo list with Add (modal) and Remove (confirmation) flows, closed-circuit fetch + persist"
orbital TodoOrbital {
uses Confirmation from "std/behaviors/std-confirmation"
uses Modal from "std/behaviors/std-modal"
type TodoLoaded = Event { data : [Todo] } "Fired when the Todo collection finishes loading"
type TodoLoadFailed = Event { error : string, code : string } "Fired when the Todo collection fails to load"
entity Todo [persistent: todos] {
id : string!
name : string!
description : string
status : "active" | "inactive" | "pending" = active
createdAt : string
pendingId : string = ""
}
trait TodoBrowse -> Todo [interaction, collection] {
initial: loading
state loading {
INIT -> loading
(fetch Todo {
emit: { failure: TodoLoadFailed, success: TodoLoaded }
})
(render-ui main {
align: center
children: [{ type: spinner }, {
color: muted
content: "Loading todos…"
type: typography
variant: caption
}]
className: py-12
direction: vertical
gap: md
type: stack
})
TodoLoaded -> browsing
(render-ui main {
children: [{
children: [{
children: [{ name: list-checks, type: icon }, {
content: Todos
type: typography
variant: h2
}]
direction: horizontal
gap: md
type: stack
}, {
action: ADD_TODO
icon: plus
label: "Add Todo"
type: button
variant: primary
}]
direction: horizontal
gap: md
justify: between
type: stack
}, { type: divider }, {
entity: ?data
fields: [{
icon: check-square
label: Name
name: name
variant: h4
}, {
label: Description
name: description
variant: caption
}, {
label: Status
name: status
variant: badge
}]
itemActions: [{
event: REMOVE_TODO
label: Remove
variant: danger
}]
type: data-grid
}]
className: "max-w-5xl mx-auto w-full"
direction: vertical
gap: lg
type: stack
})
TodoLoadFailed -> error
(render-ui main {
align: center
children: [{
color: destructive
name: alert-triangle
type: icon
}, {
content: "Failed to load todos"
type: typography
variant: h3
}, {
color: muted
content: ?error
type: typography
variant: body
}, {
action: INIT
icon: rotate-ccw
label: Retry
type: button
variant: primary
}]
className: py-12
direction: vertical
gap: md
type: stack
})
}
state browsing {
INIT -> loading
(fetch Todo {
emit: { failure: TodoLoadFailed, success: TodoLoaded }
})
(render-ui main { type: spinner })
}
state error {
INIT -> loading
(fetch Todo {
emit: { failure: TodoLoadFailed, success: TodoLoaded }
})
(render-ui main { type: spinner })
}
emits {
TodoLoaded
TodoLoadFailed
ADD_TODO -> external {
id : string
row : Todo
}
REMOVE_TODO -> external {
id : string!
name : string
}
}
listens {
TodoLoadFailed {
error : string
code : string
}
TodoPersistor.TODO_ADDED -> INIT
TodoPersistor.TODO_REMOVED -> INIT
}
}
;; Add: configured via `config`, no effects overrides.
trait TodoAdd = Modal.traits.ModalRecordModal -> Todo {
events {
OPEN: ADD_TODO
SAVE: TODO_ADDED
}
config {
icon: plus-circle
title: "Add Todo"
fields: (name description status)
mode: create
}
listens {
TodoBrowse.ADD_TODO -> ADD_TODO
}
}
;; Remove: confirmation dialog.
trait TodoRemove = Confirmation.traits.ConfirmActionConfirmation -> Todo {
events {
REQUEST: REMOVE_TODO
CONFIRM: TODO_REMOVED
}
config {
icon: alert-triangle
title: "Remove Todo"
alertMessage: "Are you sure you want to remove this todo? This cannot be undone."
confirmLabel: Remove
}
listens {
TodoBrowse.REMOVE_TODO -> REMOVE_TODO
}
}
;; Coordinator: side-effects for Add / Remove. Listens to the bound atoms'
;; emits and runs the actual persist calls.
trait TodoPersistor -> Todo [lifecycle, instance] {
initial: idle
state idle {
INIT -> idle
DO_ADD -> idle
(persist create Todo ?data)
(emit TODO_ADDED { id: ?data.id })
DO_REMOVE -> idle
(persist delete Todo ?id)
(emit TODO_REMOVED { id: ?id })
}
emits {
TODO_ADDED -> external {
id : string!
}
TODO_REMOVED -> external {
id : string!
}
}
listens {
DO_ADD {
data : Todo
}
DO_REMOVE {
id : string!
}
TodoAdd.TODO_ADDED -> DO_ADD
TodoRemove.TODO_REMOVED -> DO_REMOVE
}
}
page "/todos" as TodoPage -> TodoBrowse, TodoAdd, TodoRemove, TodoPersistor
}No SHIP under pending means a pending order cannot ship. Not an if in four places, not a disabled button. The compiler walks the graph and refuses a modal with no exit, a state nobody can reach, or an event nobody handles.
An Orb program can only say eight kinds of effect, so a new target is a mapping, not a rewrite. The same machine compiles to TypeScript, Python, or Rust, and the browser and server copies can never disagree about a rule.
The structures are declared and the feedback is exact: the compiler names the field, the line, and the fix. A model writes, validates, and repairs. It does not have to be right the first time, and neither do you.
Behaviors are state machines you import. A list page, a wizard, a calendar, a kanban board: bind one to your entity, configure its knobs, rename its events. The topology stays fixed and the compiler checks every wire. Commerce, healthcare, education, games, and more.