Standard Transformation and Organization Format
Executable Data for Distributed Systems, AI/ML workflows, Smart Configs, & Pipelines.
Overview
A unified data-logic format that works seamlessly with other formats to bridge the gap between static data and programmable documents.
Based on an "Everything as Data" approach, in which fields, functions, PDFs, images, binaries, or any other type of data are neatly combined, while keeping single-document simplicity and portability.
This provides many benefits:
- Write data once, use it everywhere, in any format
- Sandboxed logic + execution in your data (as data)
- Send functions over APIs
- Doesn't need a large ecosystem to work
- Format-agnostic (works with JSON, YAML, TOML, PDF, binaries, etc.)
Example Use-Cases
- Smart configs with validation and logic
- Prompts as human readable & maintainable data + code
- AI/LLM workflows and model configs
- Data pipelines with built-in processing
- Integration glue between systems
- Self-describing datasets
- ... basically anywhere data meets logic
Sample Stof
Check out the online playground for examples you can play with yourself.
// A field on the doc "root" node.
field: 42
// JSON-like data & function organization
stats:
/// The CLI (and other envs) use the #[main] attribute for which fns to call on run.
/**
* A function that removes itself from this document when executed.
*/
CLI
See installation docs for CLI instructions and more information.
Embedded Stof
Stof is written in Rust, and is meant to be used wherever you work.
Python & other language bindings are planned. Join the Discord to get involved.
Rust
[]
= "0.8.*"
use Graph;
JavaScript/TypeScript
Stof is compiled to WebAssembly for embedding in JS, and a JSR package is provided.
import { StofDoc } from '@formata/stof';
const doc = await StofDoc.new();
doc.lib('Std', 'pln', (... vars: unknown[]) => console.log(...vars));
doc.lib('Example', 'nested', async (): Promise<Map<string, string>> => {
const res = new Map();
res.set('msg', 'hello, there');
res.set('nested', await (async (): Promise<string> => 'this is a nested async JS fn (like fetch)')());
return res;
}, true);
doc.parse(`
field: 42
fn main() -> int {
const res = await Example.nested();
pln(res);
self.field
}
`);
const field = await doc.call('main');
console.log(field);
/*
Map(2) {
"msg" => "hello, there",
"nested" => "this is a nested async JS fn (like fetch)"
}
42
*/
License
Apache 2.0. See LICENSE for details.
Feedback & Community
- Open issues or discussions on GitHub
- Chat with us on Discord
- Star the project to support future development!
Reach out to info@stof.dev to contact us directly