Quick Tutorial: YINI Basics
YINI makes data-files (such as configuration files and application settings) readable for humans and consistent for machines — like INI, but with real structure, lists (arrays), objects, and comments.
This short tutorial covers the basics of the YINI format and how to validate your configuration.
1) What is YINI (in one line)?
A human-friendly config format (like INI) with real structure: sections, clear nested sections, arrays, objects, and unambiguous, predictable rules.
2) Create your first file
Make a file named config3.yini and paste:
^ App
name = "Demo"
version = "1.0.0"
features = ["search", "dark-mode"] // comments are allowed
^ Server
host = "0.0.0.0"
port = 8080
^^ Logging
enabled = false💡 Quick syntax reference: YINI Cheat Sheet.
💡 What’s happening
^starts a section. More carets = nested section (^^ Loggingis insideServer).key = valuedefines a setting.- Lists (arrays):
[1, 2, 3], objects:{ key: value }. - Comments:
//or#(include a space after#for inline comments). - Want more of YINI’s syntax and structure? Read Learn the YINI Format.
3) Validate your config (in CLI)
In your terminal or command line (from the same folder as your file), run:
npx yini-cli validate ./config3.yiniYou should see something like:
✅ Validation passed — 0 errors, 0 warnings.If YINI reports 0 errors, 0 warnings, everything’s fine. A non-zero exit code means something went wrong.
More commands and options
To explore more commands and options, run:
npx yini-cli --helpIf you want a fuller introduction, examples, and common commands, see the YINI CLI page.
4) Load YINI in your app
If you want to use YINI at runtime in a TypeScript/JavaScript (Node.js) app, you can load the same file as native objects, with the YINI Parser.
import YINI from 'yini-parser'
const config = YINI.parseFile('./config3.yini')
console.log(config.App.name)
console.log(config.Server.host)5) npm script
Use this in CI to catch config mistakes early:
{
"scripts": {
"config:check": "npx yini-cli validate ./config3.yini"
}
}Run with:
npm run config:check💡 Common Questions
Does indentation matter?
No, indentation is only for readability.
Structure is determined by section markers (^, ^^, etc.), not spaces.
Can I mix comment styles?
Yes, YINI supports both // and # for inline comments.
For consistency, use just one style per file.
✅ You just wrote and validated your first YINI config!
That’s the basics.
Next Steps
- ➡️ Get Started
Installation and CLI usage overview. - ➡️ YINI Examples
Shows YINI configuration examples. - 📖 Learn the YINI format
10–15 minute introduction to YINI format’s syntax and structure.
YINI is designed to stay simple and structured — explore it and see whether it fits your use case.
