Three Execution Models, One Truth: How We Solved the 'Write Once, Run Anywhere' Problem

The same .orb file runs in the browser, on the server, and compiles to native code. Here's how.
Java promised "write once, run anywhere." We deliver "write once, run everywhere appropriately."
The Promise and Failure of WORA
In 1995, Java promised: "Write once, run anywhere."
The reality: "Write once, debug everywhere."
The problem? Different environments need different tradeoffs:
- IDE/Development — Need fast iteration, interpreted
- Production Web — Need performance, compiled
- Desktop/Mobile — Need native, bundled
One size doesn't fit all.
Almadar's Solution: Three Execution Models
From a single .orb schema, Almadar supports three execution models:
.orb Schema
│
├─────────────────┬─────────────────┐
│ │ │
▼ ▼ ▼
TypeScript Rust Runtime Generated Code
Runtime (Native) (Compiled)
(Interpreted) (Production)
Each optimized for its environment.
Model 1: TypeScript Runtime
Best for: Development, IDE, rapid iteration
# Start development server with live reload
almadar dev task-app.orb
# Opens browser at localhost:3000
# Schema changes auto-reload
Characteristics:
- ⚡ Fast startup
- 🔄 Hot reload
- 🐛 Debuggable
- 🌐 Browser/Node compatible
Use Cases:
- Builder IDE preview
- Development environment
- Testing and debugging
- Educational demos
Model 2: Rust Runtime
Best for: Native apps, CLI tools, high performance
# Compile to native Rust binary
almadar compile task-app.orb --shell rust -o native/
# Build and run the native app
cd native && cargo build --release && ./target/release/task-app
The Almadar compiler generates a complete Rust project with Axum for the backend and egui for the UI. The resulting binary is a standalone native application — no runtime dependencies, no Node.js.
Characteristics:
- 🚀 Native performance
- 📦 Small binaries
- 🔒 Memory safe
- 🖥️ Cross-platform
Use Cases:
- Desktop applications
- CLI tools
- Embedded systems
- Game clients
Model 3: Generated Code
Best for: Production deployment, custom integration
# Generate TypeScript
orbital compile app.orb --shell typescript -o output/
# Generate Python
orbital compile app.orb --shell python -o output/
# Generate Rust
orbital compile app.orb --shell rust -o output/
Characteristics:
- 🎯 Optimized for target
- 🔧 Fully customizable
- 📚 Readable output
- 🏭 Production-ready
Use Cases:
- Production web apps
- Microservices
- Mobile apps (via React Native)
- Custom integrations
The OIR: Orbital Intermediate Representation
How does one schema become three executables?
The secret is OIR — Orbital Intermediate Representation:
.orb Schema
│
▼
Parse → Validate → Enrich → Inline → Resolve
│
▼
┌─────────────────────────────────────┐
│ OIR (Orbital IR) │
│ - Resolved entities │
│ - Normalized traits │
│ - Flattened pages │
│ - Validated state machines │
└─────────── ──────────────────────────┘
│
├──────────────┬──────────────┐
▼ ▼ ▼
TS Runtime Rust Runtime Code Generator
OIR is the Rosetta Stone — a common format all targets understand.
Example: Task App Across All Models
The Schema
{
"name": "TaskApp",
"orbitals": [{
"name": "TaskManagement",
"entity": {
"name": "Task",
"fields": [
{ "name": "title", "type": "string" },
{ "name": "status", "type": "enum", "values": ["todo", "done"] }
]
},
"traits": [{
"name": "TaskBrowser",
"linkedEntity": "Task",
"stateMachine": {
"states": [{ "name": "browsing", "isInitial": true }],
"transitions": [{
"from": "browsing",
"to": "browsing",
"event": "INIT",
"effects": [
["render-ui", "main", { "type": "entity-table", "entity": "Task" }]
]
}]
}
}],
"pages": [{ "name": "TasksPage", "path": "/tasks" }]
}]
}
Model 1: TypeScript Runtime
# Start development server — schema interpreted directly
almadar dev task-app.orb
# State machine runs in memory
# UI renders via React components
# Events handled by EventBus
