Just-in-time software.
Data and logic together. Runs anywhere, travels anywhere, builds itself as it goes.
It goes where JSON goes.
Embed it in TypeScript, Python, or Rust like JSON. It just has logic in it.
TypeScript
const doc = await StofDoc.new(pricing); await doc.call('price', 5000); // 80 doc.stringify('yaml'); // still data
Python
doc = Doc(); doc.parse(pricing) doc.call('price', 5000) # 80.0
Every user gets their own.
Every account gets its own doc, with its own data, settings, and custom logic. A model writes the UI once, and it shows that account's real numbers.
what a model wrote, using acme's data
#[tag('ui-meter')] usage: { #[attr] fn label() -> str { `${root.user.name}'s API calls` } #[attr] fn value() -> int { root.user.meter.current() } }
what acme sees after doc.stringify('html', 'usage')
<ui-meter label="Acme's API calls" value="1200"></ui-meter>
Run what you didn't write.
Seal what you trust. Cage what you don't. Press Run, and watch it try.
sandbox.stofPlayground ↗
secret: 'sk-live-123'
#[main]
fn main() {
// code you didn't write, parsed with nothing run
const code = new {};
parse(r#"
fn peek() -> unknown { root.secret }
fn spin() { while (true) {} }
"#, code, 'stof', 'untrusted');
// caged: it sees only itself, for 50ms a call
seal(code, reads = [], time = 50ms);
pln(code.peek());
try { code.spin(); } catch { pln('stopped at 50ms'); }
}Output
Send logic, not just data.
Pack a doc up, functions and all. It runs the same on the other side.
here: data, functions, and all
const blob = blobify('bstf', self.acme); await Http::fetch(edge, 'put', blob);
there: a fresh sandbox, the same answer
const acme = await StofDoc.new(blob, 'bstf'); await acme.call('price', 5000); // 80
Stof runs every customer's pricing at Limitr, in production, on every call.