Stof vs. Configuration Languages
Stof vs. Jsonnet/CUE/Dhall
TL;DR
Jsonnet, CUE, and Dhall are configuration languages that add templating, logic, and type safety to config generation
Stof goes further: configs that don't just generate data, but execute logic at runtime
Key difference: Jsonnet/CUE/Dhall compile to static JSON/YAML. Stof documents remain executable.
Comparison
All four let you:
Write configs with variables and functions
Reduce duplication with reusable components
Add type safety to configuration
Generate JSON/YAML output
Primary use
Config templating
Config validation & generation
Typed config generation
Executable data
Output
Static JSON/YAML
Static JSON/YAML
Static JSON/YAML
data + logic + any format
Runtime
❌ Compile-time only
❌ Compile-time only
❌ Compile-time only
✅ Sandboxed & embeddable execution
Functions
✅ Template functions
🟡 Constraints (not functions)
✅ Pure functions
✅ Full functions
Type system
🟡 Dynamic
✅ Structural types
✅ Strong static types
✅ Full type system
Validation
🟡 Via assertions
✅ Core feature
✅ Via types
✅ Full functional validation + schemas
API Portability
❌ Must compile first
❌ Must compile first
❌ Must compile first
✅ Send document + logic
I/O operations
❌ No
❌ No
❌ No
✅ Sandboxed
Maturity
✅ Mature (Google)
✅ Growing (CNCF)
🟡 Smaller
🟡 Growing
The Core Philosophical Difference
Jsonnet, CUE, Dhall:
"Write smart code that generates dumb data."
Compile your config logic down to static JSON/YAML that your application consumes.
Stof:
"Write data that stays smart."
The data carries its logic and can execute at runtime, wherever it goes.
When to Use Each
When Compilation is Better
Jsonnet/CUE/Dhall when:
You want immutable, auditable configs
Compiled JSON can't change at runtime
Perfect for GitOps workflows
You need zero runtime overhead
Static JSON parsing is as fast as it gets
Critical for high-performance systems
You don't trust the config source
No execution = no risk
Safe for untrusted third-party configs (though Stof has sandboxing for this)
Your tool ecosystem requires static configs
kubectl, terraform, etc. expect JSON/YAML
(Though Stof can output these too)
When Runtime Execution is Better
Stof wins when:
Configs need to adapt to runtime conditions
Check if a service is available
Adjust settings based on system resources
Compute values from current environment
You need to send logic over APIs
Client sends data + transformation to server
Server executes safely in sandbox
Enables distributed workflows
Validation requires external checks
Test database connectivity
Verify API keys are valid
Check file permissions
You want one source of truth
Data, validation, and transformation in one document
No separate "compile" and "runtime" versions
Use Jsonnet if
You need to generate Kubernetes manifests with heavy templating
You want a mature, Google-backed tool
Your configs are complex but ultimately static
You're already in the Kubernetes ecosystem
Sweet spot: Kubernetes config generation, Grafana dashboards
Use CUE if
You need strong schema validation at compile time
You want data definition and validation in one language
You're okay with a steeper learning curve for powerful constraints
You're building config-heavy cloud-native apps
Sweet spot: API schemas, Kubernetes operators, config validation
Use Dhall if
You want total type safety (like Haskell for configs)
You need guaranteed termination (no infinite loops)
You prefer functional programming paradigms
You're okay with a smaller ecosystem
Sweet spot: Infrastructure as code with maximum safety guarantees
Use Stof if
Your data needs to validate and transform at runtime
You want to send executable logic over APIs
You need dynamic behavior based on runtime context
You're building data pipelines, AI workflows, or smart configs
You want one format that works everywhere (embedded, CLI, browser)
Sweet spot: Self-modifying configs, data pipelines, distributed systems, AI agent workflows
Last updated
Was this helpful?