🚀Stof: Data that carries its own logic

Send functions + data over APIs, write configs that validate themselves, build data pipelines where transformations travel with the data, store logic + data in a database, etc.

Treats everything uniformly - fields, functions, PDFs, images, binaries, etc. - as data that can be combined in a single portable document.

Stof is the Standard Transformation and Organization Format.

👋 New to Stof?

  1. Read the 5-minute Quick Start

Benefits

  • Write data + logic once, use it everywhere (JS, Rust, Python, anywhere your app lives)

  • Format-agnostic I/O (works with JSON, YAML, TOML, PDF, binaries, etc.)

  • Sandboxed logic + execution in your data (as data)

  • Send functions over APIs

  • Store data + logic in your database

  • Doesn't need a large ecosystem to work

Use-Cases

  • Smart configs with validation and logic

  • Data interchange with sandboxed execution

  • 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

Who is using Stof?

Stof is being used by many organizations already:

Company
Description
Contributor Status

Formata

Formata is the Customer Intelligence Infrastructure for RevOps teams.

Contributor and a committed maintainer

Your logo here

Reach out on Discord

Check out the GitHub repo

Examples

Here's what Stof looks like in practice. Notice how functions, data, and even unit conversions live together in one document.

Stof documents can be executed locally with the CLI, embedded within the language of your choice, or on your browser via the online playground.

Data Format + Logic

Stof is a data format, similar to JSON, YAML, TOML, etc., with functions.

Data Transformation

Manipulate the document using the functional data it contains.

Try this example in the playground.

Workflows & Pipelines

Stof is a lightweight document format where workflows are portable, executable data. See an example here.

Self-Validating Data

Beyond simple functions, Stof supports comprehensive schemas for validations and transformations.

Prompt Management

Primitive types designed for modern needs & workflows (prompts, unit types, const fields, etc.).

Foundations for Tooling

Stof provides a foundation for portable challenge/response logic, programmatic sharing and invocation of APIs, and more.

Embedded

Stof is written in Rust and can be embedded today in TypeScript/JavaScript (via WebAssembly), or within your Rust project.

Rust

TypeScript

The package is hosted on JSR for you to use in the JS environment of your choice.

Why Now?

In the current technology landscape, every program is distributed, utilizing multiple systems in parallel to deliver value. In distributed systems, everything is about moving either data to computation or computation to data.

Stof proposes: Why not move them together as a unified entity?

Stof explores:

  • Practical code mobility at scale with modern type systems

  • Unifying data transformation with code distribution

  • Security models for distributed computation-as-data

  • Performance characteristics of serializable computation vs traditional RPC/message-passing

  • Formal semantics for "code as data" in distributed systems

  • Edge computing, data pipelines, and collaborative systems

The Serializable Computation Problem

Code mobility involves either strong mobility (moving code, data, and execution state) or weak mobility (moving just code and data). This has been a challenge for decades. Stof's "Everything as Data" approach, including functions and types that can be serialized and sent over APIs, directly addresses this.

Actor Model + Data-Oriented Programming

What if you could send not just messages, but executable transformations as data between actors? This bridges:

  • The actor model's isolation and message-passing

  • Data-oriented programming's focus on data transformation pipelines

  • Code mobility's ability to move compuation to data

Edge Computing & Data Locality

Rather than fixing the interface to a resource, a minimal interface can be defined and code implementing higher-level interfaces placed alongside it as required, allowing application-specific interaction patterns.

Imagine: An IoT sensor network where you push Stof transformation functions to edge devices. The functions are data, so they can be:

  • Versioned and rolled back

  • Inspected for resource usage before execution

  • Composed and optimized at runtime

  • Migrated between nodes based on data locality

Distributed Data Pipelines

Self-describing data with embedded transformations reduces the complexity of distributed data pipelines compared to current orchestration-heavy approaches.

  • Transformations travel with the data

  • Self-validating data that includes its own processing logic

  • Dynamic pipeline reconfiguration without redeployment

Secure Multi-Party Computation

Sandboxing restricts mobile code to a controlled environment with limited system resource access. Stof's sandbox + serializable functions enable:

  • Controlled computation on sensitive data

  • Verifiable transformations (the code is inspectable data)

  • Dynamic permission models (capabilities as data)

Collaborative Editing & CRDTs

Conflict-free Replicated Data Types (CRDTs) struggle with complex business logic. Stof's operations as first-class data enable richer collaborative systems than current CRDT approaches.

  • Merged and reordered data

  • Validated before application

  • Composed with other operations & structures

Feedback & Community

We welcome contributors and feedback! The community is growing, and this is a new project with a lot of potential.

Last updated

Was this helpful?