STXT - Semantic Text
Built for humans. Reliable for machines.

Use cases — Configuration files

Configuration files often start out simple… and end up turning into a fragile mix of:

STXT is especially designed for this friction point: human-readable, structured, and validatable configuration without turning into a programming language.

What kind of configurations

Common examples where STXT fits well:

Common problems with other formats

In practice, teams run into:

STXT aims for a different balance:

Example 1 — Server configuration

Human-readable, hand-editable, and structured configuration.

Server Config (@com.acme.server):
	Name: api-gateway
	Environment: production

	Network:
		Host: 0.0.0.0
		Port: 8080
		Public url: https://api.acme.com

	Threads:
		Min: 8
		Max: 64

	Timeouts:
		Read ms: 5000
		Write ms: 5000

	Logging:
		Level: INFO
		Format: json

	Features:
		Feature:
			Name: experimental-cache
			Enabled: false
		Feature:
			Name: audit-logging
			Enabled: true

	Description >>
		Main configuration of the API gateway.
		This file is versioned in Git and deployed along
		with the application.

		Critical changes must go through review.

What STXT adds here

Example 2 — Per-environment configuration

Same format, different environments, without duplicating structure.

Application Config (@com.acme.app):
	App name: Billing

	Environments:
		Environment:
			Name: dev
			Database:
				Url: jdbc:postgresql://localhost/dev
				Max connections: 5
			Debug: true

		Environment:
			Name: staging
			Database:
				Url: jdbc:postgresql://staging/db
				Max connections: 10
			Debug: false

		Environment:
			Name: prod
			Database:
				Url: jdbc:postgresql://prod/db
				Max connections: 30
			Debug: false

Advantages over “copy and paste”

Example 3 — Feature flags

A classic case where data and explanatory text coexist.

Feature Flags (@com.acme.features):
	Feature:
		Key: new-checkout
		Enabled: false
		Owner: Payments
		Description >>
			New checkout flow.
			Enable progressively per environment.

	Feature:
		Key: rate-limit-v2
		Enabled: true
		Owner: Platform
		Description >>
			New rate limiting system.
			Replaces the previous version based on filters.

Validation with @stxt.template

In configuration it’s very common to want to:

Template (@stxt.template): com.acme.server
	Description: API server configuration
	Structure >>
		Server Config:
			Name: (1)
			Environment: (1) ENUM [dev, staging, production]

			Network: (1)
				Host: (1)
				Port: (1) INTEGER
				Public url: (?)

			Threads: (?)
				Min: (1) NATURAL
				Max: (1) NATURAL

			Timeouts: (?)
				Read ms: (?) NATURAL
				Write ms: (?) NATURAL

			Logging: (?)
				Level: (1) ENUM [DEBUG, INFO, WARN, ERROR]
				Format: (?) ENUM [text, json]

			Features: (?)
				Feature: (*)
					Name: (1)
					Enabled: (1) BOOLEAN

			Description: (?) TEXT

This template:

Validation with @stxt.schema

When configuration becomes a contract between systems:

a schema provides full and explicit control.

In practice:

Conceptual comparison

STXT for configuration sits between:

STXT:

It only describes structure + data + text.

Usage recommendations

Summary

Configuration files are a natural use case for STXT: