<p align="center"><img src="./content/stof.png" height="150"></p>
<p align="center">
<a href="https://docs.stof.dev"><img src="https://img.shields.io/badge/docs-docs.stof.dev-purple?logo=gitbook&logoColor=white"></a><span style="margin: 0px 4px;"></span>
<a href="https://github.com/dev-formata-io/stof"><img src="https://img.shields.io/github/stars/dev-formata-io/stof"></a>
</p>
<p align="center">
<a href="https://github.com/dev-formata-io/stof/actions"><img src="https://img.shields.io/github/actions/workflow/status/dev-formata-io/stof/rust.yml"></a>
<a href="https://crates.io/crates/stof"><img src="https://img.shields.io/crates/d/stof?label=Stof%20downloads&color=aqua"></a>
<a href="https://crates.io/crates/stof-cli"><img src="https://img.shields.io/crates/d/stof-cli?label=CLI%20downloads&color=darkgray"></a>
<a href="https://crates.io/crates/stof"><img src="https://img.shields.io/crates/l/stof?color=maroon"></a>
<a href="https://github.com/dev-formata-io/stof/commits"><img src="https://img.shields.io/github/commit-activity/m/dev-formata-io/stof"></a>
</p>
----
<br/>
**A smart, declarative runtime for data workflows**
- [Docs](https://docs.stof.dev)
- [GitHub](https://github.com/dev-formata-io/stof)
- [Discord](https://discord.gg/Up5kxdeXZt)
- [Install](https://docs.stof.dev/book/installation)
## What is Stof?
Stof works **with** other data formats to bridge the gap between static data and programmable documents. It is a lightweight, embeddable, and portable data logic format & platform for AI, infra-as-code, and config-heavy workflows. It's built to support:
- Data-Mesh, Integration, & Orchestration **glue-layer**
- Universal LLM & AI workflows, tools, & **intersystem data**
- Smart configs with logic, types, units, schemas, & **self-validation**
- Asynchronous **validation & transformation**
> Think of Stof as a foundation for building robust and declarative data flows, config systems, or backend models.
## When to use Stof?
Modern software (especially AI/ML, infra, cloud, CI/CD, and workflows) increasingly relies on structured data that needs to be:
- Human-readable
- Machine-validatable
- Extendable with logic
- Executable safely
- Translatable between formats
- Transported between systems
- Versioned and inspectable
But the tools we have for this are *primitive and fragmented*:
- JSON/YAML/TOML carry structure, but rely on other tools for behavior, units, schemas, or validations.
- External tools create complexity between systems and often require additional configuration & maintenence.
- Configs drift and break across environments.
- Runtime logic is scattered across codebases, devops scripts, and data definitions.
> Stof unifies **structure + validation + behavior** into one **coherent, inspectable, portable artifact**.
*Note: if you're doing simple config loading or small and static data modeling, learning Stof might feel like overkill. You can replicate most of what Stof does using JSON + code + libraries; it just takes more effort and lacks formality, organization, single-file simplicity, unification, etc. (also a big pain for cross-boundary systems, like APIs, teams, and services).*
## Example/Tour
> Located in `examples/readme` for you to try yourself.
``` rust
import "old_crusty_config.toml" as OldCrusty; import "norse.png" as self.NorseImage;
{
"json-like": "json objects & fields can be parsed by Stof natively",
str "just stof": "it's all Stof, so use types, etc."
}
field: 42 str typed: "types!" const bool cool: true;
MiB unit-types: OldCrusty.server.RAM; cm height: 6ft + 1in;
fn hello_world() -> str {
"hello, world"
}
Api: {
import "api"; str config-name: ?self.modular_apis(OldCrusty); }
#[my_attribute]
#[attribute_with_val(42days)]
#[metadata_map({"config": true})]
#[metadata_obj(new { stof_object: true })]
#[validation((value: unknown): bool => true)]
metadata_field: "we have attributes"
async fn doing_something_concurrently() {
pln("Hello, Stof!");
const handle = async 42;
assert_eq(await handle, 42);
const result = await async {
let a = 5;
let b = 5;
return a + b;
};
assert_eq(result, 10);
}
#[type]
Config: {
fn description() -> str {
self.description ?? "no description"
}
}
#[main]
fn main() {
self.doing_something_concurrently();
const yaml = stringify("yaml", self);
log_info(yaml);
}
```
``` bash
> cd examples/readme
> stof run readme.stof
Hello, Stof!
```
## Installation
Add Stof to your `Cargo.toml`:
```toml
[dependencies]
stof = "0.8.*"
```
See [installation docs](https://docs.stof.dev/book/installation) for CLI instructions and more information.
## Documentation
- [Hello, World](https://docs.stof.dev/book/hello-world)
- [Roadmap](https://docs.stof.dev/roadmap)
- [Install](https://docs.stof.dev/book/installation)
- [GitHub](https://github.com/dev-formata-io/stof)
## Status
Stof is currently in **early development**, we welcome feedback and contributions. The core is stable for experimentation, and is actively being used in production at [Formata](https://formata.io).
New features are being added weekly, so hop into the Discord and get involved!
## License
Apache 2.0. See LICENSE for details.
## Feedback & Community
- Open issues or discussions on [GitHub](https://github.com/dev-formata-io/stof)
- Chat with us on [Discord](https://discord.gg/Up5kxdeXZt)
- Star the project to support future development!
> Reach out to info@stof.dev to contact us directly