CLI Commands

Nixi includes a command-line tool for managing projects, running servers, and building applications.

Commands Overview

Command Alias Description
nixi help nixi h Show help message
nixi version nixi v Show version
nixi new <name> nixi n Create new project
nixi dev [port] [-w] nixi d Start dev server (with optional watch mode)
nixi serve [port] nixi s Start server (alias for dev)
nixi generate <type> <name> nixi g Generate code (component, route, model, middleware)
nixi build [dir] nixi b Build for production
nixi style [out] Compile CSS from Nixi.style
nixi test [pattern] nixi t Run tests
nixi gtk [app.lua] Run GTK desktop app
nixi add <package> Install Lua package via LuaRocks
nixi init nixi i Initialize Nixi in existing folder
nixi doctor nixi r Check system requirements
nixi clean nixi c Clean build artifacts
nixi css [file] Compile CSS DSL to file

help

Display all available commands and usage information.

nixi help

version

Show the installed Nixi version.

nixi version
# or
nixi v

new

Create a new Nixi project from the template.

nixi new <name>
# or
nixi n myapp

Options:

dev

Start the development server.

nixi dev [port]
# or
nixi d 8080

build

Build a static site for deployment on Vercel, Cloudflare, Netlify, or any static hosting.

nixi build [output-dir]
# or
nixi build dist/

# Build and clean first
nixi build --clean

Output:

build/
├── index.html           # Pre-rendered homepage
├── css/
│   └── style.css      # Extracted CSS
├── 404.html            # Error page
└── public/            # Static assets

Configuration

Create nixi.config.json to configure dynamic routes:

{
  "build": {
    "output": "build",
    "dynamicValues": {
      "/users/:id": [{ "id": "1" }, { "id": "2" }],
      "/posts/:slug": [{ "slug": "hello" }, { "slug": "world" }]
    },
    "skipRoutes": ["/api/*", "/webhook/*"]
  }
}

Features:

doctor

Check system requirements and dependencies.

nixi doctor
# or
nixi r

Checks Performed:

Check Description
Lua Lua interpreter version
LuaJIT Just-In-Time compiler availability
LuaFileSystem File system operations library
LuaSocket HTTP server library
LuaRocks Package manager availability
Templates Project template files

serve

Start the development server (alias for dev).

nixi serve [port]
# or
nixi s 8080

generate

Generate code files for components, routes, models, and middleware.

nixi generate <type> <name>
# or
nixi g component button

Generator Types:

Type Alias Description
component c Create UI component
route r Create route file
model m Create database model
middleware Create middleware

Examples:

nixi generate component button
nixi generate route /api/users
nixi generate model user
nixi generate middleware auth

# With force overwrite
nixi generate component button -f

style

Compile CSS from Nixi.style DSL to a file.

nixi style [output.css]
# Compile to stdout
nixi style

# Compile to file
nixi style public/style.css

test

Run tests using the busted framework.

nixi test [pattern]
# or
nixi t "*"

Requirements: Install busted with luarocks install busted

gtk

Run a GTK desktop application.

nixi gtk [app.lua]
# or
nixi gtk myapp.lua

Requirements: GTK4 and lgi library

luarocks install lgi

add

Install Lua packages via LuaRocks.

nixi add <package>
# or
nixi add luafilesystem
nixi add luasocket

init

Initialize Nixi in an existing folder.

nixi init
# or
nixi i -f  # Force overwrite

Creates:

clean

Remove build artifacts and temporary files.

nixi clean
# or
nixi c

Removes:

css

Compile CSS from Nixi.style DSL to a standalone CSS file.

nixi css [output.css]
# Compile to public/style.css
nixi css public/style.css

This extracts all CSS rules defined with Nixi.style.rule() and writes them to a file.

Options

Option Description
-h, --help Show help for a command
-f, --force Force overwrite existing files
-w, --watch Enable watch mode (live reload)