Skip to content

Decl

Describe structured data, generate values from the description, and validate documents against it. A JSON superset with a strong static type system, constraints with first-class diagnostics, references, physical quantities, generics, and modules. Pure, deterministic, terminating.

Describe

Types, defaults, derived members, and constraints live in one flat schema. No domain keywords — graphs, configs, and hardware are all just records, references, and rules.

Generate

Comprehensions and derivations turn a description into canonical JSON, byte-identical on every run and every implementation — and, with @render, into YAML, indented JSON, or text from a template, one file per element.

Validate

Bind external documents to the same types. Every failure is a diagnostic with a path, a code, and a root cause — never a cascade.

services.decl
// describe: types carry the value rules
type Service = {
name: /[a-z][a-z0-9-]*/
port?: 1024..65535 = 8080
replicas?: 1..64 = 1
timeout?: quantity<Time> = 250ms
endpoint = `${name}:${port}` // derived, never supplied
assert grpc_ports: name != "grpc" || port >= 9000
else warn `grpc convention is 9000+`
}
// generate: values from the description
export output demo: Service[] = [
{ name: "gateway" }
{ name: "auth", port: 9001, replicas: 2 }
]
// validate: bind external documents to the same schema
input deployed: Service[]
decl evaluate services.decl
{
"demo": [
{
"name": "gateway",
"port": 8080,
"replicas": 1,
"timeout": {
"value": 0.25,
"unit": "s"
},
"endpoint": "gateway:8080"
},
{
"name": "auth",
"port": 9001,
"replicas": 2,
"timeout": {
"value": 0.25,
"unit": "s"
},
"endpoint": "auth:9001"
}
]
}

The same Service type that generated demo validates deployed documents from the outside world:

Terminal window
decl validate services.decl --input deployed=prod.json
Terminal window
npm install -g decl-lang

The TypeScript reference implementation: decl and the decl-lsp language server (Node.js ≥ 22).

The same language server, formatter, and evaluator in every implementation; the editor extensions and the REPL are clients of them.

Terminal window
decl check services.decl # the static checks, and nothing else
decl fmt --check services.decl # the canonical form
decl repl services.decl # a session over the module: expressions, :type, :trace, undo
decl-lsp --stdio # what VS Code, Zed, Neovim, Helix, and Emacs talk to

© 2026 Luuvish. Decl is open source under the MIT License.

Type: Literata and IBM Plex, under the SIL Open Font License. Built with Astro Starlight.