Get Started with YINI

Welcome! This guide helps you create your first working .yini file in under 2 minutes using the terminal.

YINI is a human-friendly configuration file format. It is inspired by INI, but adds nested sections, arrays, objects, and comments.

If you want to try YINI without installing anything, use the YINI Playground. This page focuses on the YINI CLI, which is the simplest starting point for local files and automation.

Prerequisite: Node.js

You need Node.js to run the YINI command-line (CLI) tool.

You can check if Node.js is already installed by running:

node -v

If Node.js is not installed, download it from: https://nodejs.org ↗

It’s recommended to use Node.js 20 or later.


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

Option A - use without installing

npx yini-cli --help

Option B - install yini as a command

npm i -g yini-cli

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

npm i -D yini-cli

By default, yini parse prints formatted (easy-to-read) JSON to the terminal.

If you want a fuller introduction, examples, and common commands, see the YINI CLI page.


2) Create your first .yini file

Save this as config.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:

  • Sections: start with ^. Add more carets for nested sections (sub-sections): (^, ^^, ^^^, …).
  • Settings: written as key = value pairs.
  • Comments: Use // or # for comments on the same line. You do not need a space after #.
  • Arrays: [1, 2, 'three']
  • Objects: { key: 'value', n: 1 }
  • Strings: must be quoted 'like this' or "like this".
  • For more details, see: Learn the YINI format.

Coming from INI? YINI keeps the same familiar key-value style, but adds nested sections, lists, and objects.

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:

npx yini-cli parse config.yini

Or, if you used option B or C (using npm) in step 1:

yini parse config.yini

By default, parse outputs formatted (easy-to-read) JSON:

{
    "App": {
        "name": "Demo",
        "version": "1.0.0",
        "features": ["search", "dark-mode"]
    },
    "Database": {
        "host": "localhost",
        "port": 5432,
        "auth": { "user": "admin", "pass": "secret" }
    }
}

Now you have a working YINI file

You have now created a .yini file and parsed it to JSON.

The basic steps are:

  • Create a .yini file with sections and settings.
  • Run yini parse or npx yini-cli parse.
  • Use the JSON output in tools, scripts, or applications.

💡 Common tips:

  • Keys and section names are case-sensitive: App and app are different names.
  • Strings must always be quoted, either ' or ".

More CLI options

Once the basic parse works, you can change the output style or write the result to a file.

Compact JSON

To output minified JSON with no extra spaces or line breaks:

yini parse config.yini --compact

JavaScript-style output

To output a JavaScript-style object instead of JSON, use the --js flag.

yini parse config.yini --js

Explicit JSON output

Formatted (easy-to-read) JSON is the default, but you can also request it with a flag:

yini parse config.yini --json

Write output to a file

To save the result:

yini parse config.yini -o output.json

By default, YINI CLI does not replace a newer output file by mistake. For the full list of output and file-writing options, see the YINI CLI page.

Use YINI in other ways

You can use YINI after this first CLI flow:

You can explore more tools on the Get YINI Tools page.


Summary

You have just created and parsed your first YINI configuration file.

Next steps

  • ➡️ Quick Tutorial

    Walk through the core YINI ideas in a few minutes.

  • ➡️ YINI Examples

    Study practical YINI files from small to larger configs.

  • ➡️ YINI CLI

    Learn the command-line options after the first parse.