How It Works
Every Almadar application is composed of Orbital Units. An Entity holds your data, Traits define behavior as state machines, and Pages bind them to routes. Watch the architecture assemble itself.
Orbital Unit = Entity + Traits + Pages
Core Concepts
Three building blocks compose every Almadar application
Entities define your data model. Fields are typed, can have defaults, and support three persistence modes: runtime (in-memory), persistent (database), and singleton.
{
"name": "Task",
"persistence": "runtime",
"fields": [
{ "name": "title", "type": "string" },
{ "name": "done", "type": "boolean", "default": false }
]
}Traits model behavior as state machines with states, events, guards, and effects. Effects can set entity fields, emit events, call services, or render UI patterns.
Pages bind Orbitals to routes. They define the URL, the layout, and which Orbitals (groups of Entity + Traits) are mounted. Pages are generated as React route components.
First Schema in 60 Seconds
Install the CLI, create your first schema, and compile it to a running application.
npx @almadar/cli new my-app{
"name": "HelloWorld",
"orbitals": [{
"name": "Greeter",
"entity": {
"name": "Greeting",
"fields": [
{ "name": "message", "type": "string" },
{ "name": "count", "type": "number", "default": 0 }
]
},
"traits": [{
"name": "Clickable",
"stateMachine": {
"states": [
{ "name": "idle", "isInitial": true },
{ "name": "greeted" }
],
"transitions": [{
"from": "idle",
"event": "CLICK",
"to": "greeted",
"effects": [
["set", "@entity.message", "Hello, World!"],
["set", "@entity.count", ["+", "@entity.count", 1]],
["render-ui", "main", {
"type": "stats-card",
"title": "@entity.message",
"value": "@entity.count"
}]
]
}]
}
}]
}]
}Standard Library Modules
213+ built-in operators across 9 modules — all available as s-expressions in guards and effects