Quick Tutorial: YINI Basics

This short tutorial helps you understand the basic shape of a YINI file and how to validate (check that the file is valid YINI).

1) What is YINI (in one line)?

It is a human-friendly config format with sections, settings, nested sections, lists, objects, comments, and clear rules.


2) Create your first file

Make a file named tutorial.yini and paste the following content into it:

^ 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

Don’t want to create a local file? Paste the example into the YINI Playground and parse it in the browser.

💡 Quick syntax reference: YINI Cheat Sheet.

💡 What’s happening

  • ^ starts a section.
  • More ^ symbols create nested sections. Here, ^^ Logging is inside Server.
  • key = value defines a setting.
  • Lists look like this: [1, 2, 3].
  • Objects look like this: { key: "value" }.
  • Comments start with // or #. You do not need a space after #.

3) What structure does this create?

The example creates two top-level sections: App and Server. The Logging section is nested inside Server.

That structure looks like this as data:

{
    "App": {
        "name": "Demo",
        "version": "1.0.0",
        "features": ["search", "dark-mode"]
    },
    "Server": {
        "host": "0.0.0.0",
        "port": 8080,
        "Logging": {
            "enabled": false
        }
    }
}

For a fuller syntax guide, read Learn the YINI Format.


4) Validate your config with the CLI

To validate without installing anything, paste your file into the YINI Playground and select Parse. The playground displays Valid YINI when the file parses successfully.

If Node.js and npm are installed, run this command from the same folder as your file to validate it:

npx yini-cli validate ./tutorial.yini

You should see something like:

 Validation passed 0 errors, 0 warnings.

Zero errors and warnings means the file is valid.
Otherwise, the output explains what needs to be fixed.

More commands and options

To explore more commands and options, run:

npx yini-cli --help

For more command examples and options, see the YINI CLI page.

Optional: Load YINI in your app

If you want to use YINI in an app, use a parser. For Node.js, install the YINI Parser:

npm install yini-parser
import YINI from 'yini-parser'

const config = YINI.parseFile('./tutorial.yini')

console.log(config.App.name)
console.log(config.Server.host)

There is also a Python parser for Python projects.

Optional: Add an npm script

You can add a script to your Node.js project to check the file again later. This is also useful in CI.

{
  "scripts": {
    "config:check": "npx yini-cli validate ./tutorial.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.

YINI is designed to stay simple and structured. Explore some practical YINI examples and see whether it fits your use case.

Next steps