Full examples

Last updated: 2026-10-14A complete static config and the same project as a live !active config.

Full examples

Mirrored from the format repository — docs/spec/SPECIFICATION_EN.md, SYNX 3.7.4. Changes are made there.

4.1 Plain File (no !active)

A simple static config. No magic — just data.

synx
# TotalWario game config (static)

app_name TotalWario
version 2.0.0

server
  host 0.0.0.0
  port 8080
  ssl_enabled false

gameplay
  base_hp 100
  boss_hp 500
  max_players 16
  greeting Prepare to fight.

map_rotation
  - Arena of Doom
  - Crystal Caverns
  - Wario Stadium

rules |
  1. No cheating.
  2. Respect the Syndicate.
  3. Have fun!

credits
  lead_dev KaiserBerg
  studio APERTURESyndicate
  year 2026

Result (Synx.parse()):

json
{
  "app_name": "TotalWario",
  "version": "2.0.0",
  "server": {
    "host": "0.0.0.0",
    "port": 8080,
    "ssl_enabled": false
  },
  "gameplay": {
    "base_hp": 100,
    "boss_hp": 500,
    "max_players": 16,
    "greeting": "Prepare to fight."
  },
  "map_rotation": [
    "Arena of Doom",
    "Crystal Caverns",
    "Wario Stadium"
  ],
  "rules": "1. No cheating.\n2. Respect the Syndicate.\n3. Have fun!",
  "credits": {
    "lead_dev": "KaiserBerg",
    "studio": "APERTURESyndicate",
    "year": 2026
  }
}

4.2 File with !active — Live Config

The same config, but with dynamic functions and validation.

synx
!active
# Live config for TotalWario

app_name[required, min:3, max:30] TotalWario
version[readonly] 2.0.0

server
  // Port from environment variable, fallback to 8080
  port:env:default:8080 PORT
  host 0.0.0.0
  ssl_enabled false

gameplay
  base_hp 100
  // Engine calculates: 100 * 5 = 500
  boss_hp:calc base_hp * 5
  max_players[type:int, min:2, max:64] 16
  difficulty[enum:easy|normal|hard|nightmare] normal

  // A random phrase on every parse
  greeting:random
    - Welcome to the arena!
    - Prepare to fight.
    - Wario time!

  // Weighted random: common 70%, rare 20%, legendary 10%
  loot_tier:random 70 20 10
    - common
    - rare
    - legendary

map_rotation
  - Arena of Doom
  - Crystal Caverns
  - Wario Stadium

rules |
  1. No cheating.
  2. Respect the Syndicate.
  3. Have fun!

// Include database settings from a separate file
database:include ./db.synx

// Secrets — won't appear in logs
api_key[required]:secret sk-live-abc123def456

credits
  lead_dev KaiserBerg
  studio APERTURESyndicate
  year 2026
  contact:alias lead_dev

Result of one Synx.parse() call:

json
{
  "app_name": "TotalWario",
  "version": "2.0.0",
  "server": {
    "port": 8080,
    "host": "0.0.0.0",
    "ssl_enabled": false
  },
  "gameplay": {
    "base_hp": 100,
    "boss_hp": 500,
    "max_players": 16,
    "difficulty": "normal",
    "greeting": "Wario time!",
    "loot_tier": "common"
  },
  "map_rotation": [
    "Arena of Doom",
    "Crystal Caverns",
    "Wario Stadium"
  ],
  "rules": "1. No cheating.\n2. Respect the Syndicate.\n3. Have fun!",
  "database": {
    "host": "localhost",
    "port": 5432,
    "name": "mydb"
  },
  "api_key": "[SECRET]",
  "credits": {
    "lead_dev": "KaiserBerg",
    "studio": "APERTURESyndicate",
    "year": 2026,
    "contact": "KaiserBerg"
  }
}

On the next parse() call, greeting and loot_tier will be different — that's the point of :random.

Full examples | AS Docs