Get Started with YINI
Welcome! This guide gets you from zero → a working .yini config in a few minutes. Learn how to install and use YINI from the CLI.
YINI is a human-friendly configuration format — like INI, but with nested sections, comments, arrays, and objects.
Prerequisite: Node.js installed
- The examples assumes you have Node.js installed on your system.
💡 Tip: You can check if you have Node installed with:
node -vIt’s recommended to have at least Node 16.
1) Install yini-cli (or just use npx)
Option A — use without installing
npx yini-cli --helpOption B — enable yini CLI globally
npm i -g yini-cliOption C — add the CLI to your Node.js project
npm i -D yini-cliAfter installing, you can run npx yini-cli or add an npm script like “yini”: “yini”.
💡 You can use either npx yini (no install), or just yini if yini-cli is installed globally or locally.
2) Create your first .yini file
Save this as config2.yini:
^ App
name = "Demo"
version = "1.0.0"
features = [ "search", "dark-mode" ] // Comments are allowed
^ Database
host = "localhost"
port = 5432
auth = { user: "admin", pass: "secret" } // Object literalNotes:
- Sections: start with
^. Add more carets for nesting (sub-sections): (^,^^,^^^, …). - Members: written as
key = valuepairs. - Comments: Use
//or#(including a space after the hash) for inline comments. - Arrays:
[1, 2, 'three'] - Objects:
{ key: 'value', n: 1 } - Strings: must be quoted
'like this'or"like this". - For more details see: YINI’s syntax and structure.
3) Parse your .yini file
Once your file is saved, parse it with the CLI:
If you used option A (with npx) in step 1, type the following:
npx yini-cli parse config2.yiniOr, if you used option B or C in step 1:
yini parse config2.yiniJS Output:
You should see output like (JavaScript Object):
{
App: {
name: 'Demo',
version: '1.0.0',
features: [ 'search', 'dark-mode' ]
},
Database: {
host: 'localhost',
port: 5432,
auth: { user: 'admin', pass: 'secret' }
}
}4) Other output styles
4.1) Results in JSON
If you want the output in pure JSON, use the --json flag.
If you used option A (with npx) in step 1, type the following:
npx yini-cli parse --json config2.yiniOr, if you used option B or C in step 1:
yini parse --json config2.yiniJSON Output:
{"App":{"name":"Demo","version":"1.0.0","features":["search","dark-mode"]},"Database":{"host":"localhost","port":5432,"auth":{"user":"admin","pass":"secret"}}}4.2) Results in pretty JSON
If you want the output in pretty JSON so it’s easier to read, use the --pretty flag.
If you used option A (with npx) in step 1, type the following:
npx yini-cli parse --pretty config2.yiniOr, if you used option B or C in step 1:
yini parse --pretty config2.yiniPretty JSON Output:
{
"App": {
"name": "Demo",
"version": "1.0.0",
"features": [
"search",
"dark-mode"
]
},
"Database": {
"host": "localhost",
"port": 5432,
"auth": {
"user": "admin",
"pass": "secret"
}
}
}Summary
✅ You just parsed your first YINI file into both JavaScript and JSON formats!
🧭 Next Steps
- ▶️ Quick Tutorial — 5-minute guided walkthrough of YINI.
- 📖 Intro to YINI format — 10–15 minute introduction to YINI format’s syntax and structure.
- 📘 Specification — Read the full YINI Specification.
