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

💡 Tip: You can check if you have Node installed with:

node -v

It’s recommended to have at least Node 16.


1) Install yini-cli (or just use npx)

Option A — use without installing

npx yini-cli --help

Option B — enable yini CLI globally

npm i -g yini-cli

Option C — add the CLI to your Node.js project

npm i -D yini-cli

After 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 literal

Notes:

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.yini

Or, if you used option B or C in step 1:

yini parse config2.yini

JS 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.yini

Or, if you used option B or C in step 1:

yini parse --json config2.yini

JSON 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.yini

Or, if you used option B or C in step 1:

yini parse --pretty config2.yini

Pretty 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