Stof: Data + Logic
One document, runs anywhere. Send functions over the wire. Documents that validate themselves.
Why Stof?
1. Interop & interchange data across any boundary
import { stofAsync } from '@formata/stof';
const doc = await stofAsync`
#[type]
Server: {
port: 8080
host: 'localhost'
secure: false
MiB memory: 500GiB
fn url() -> str {
let url = self.secure ? 'https://' : 'http://';
url += self.host + ':' + self.port;
url
}
}`;
// Parse STOF, JSON, YAML, binary, etc. into the same document
doc.parse(`Server "prod": {
"host": "prod.example.com",
"port": 443,
"secure": true,
"memory": "2GB"
}`);
console.log(await doc.call('prod.url')); // https://prod.example.com:443
console.log(doc.get('prod.memory')); // ~1907 MiB (auto-converted from GB)2. Runtime self-assembly
3. Data that validates and computes itself
Use Everywhere
TypeScript / JavaScript
Rust
Python
Get Involved
Last updated