CLI Reference

Installation

The Distats CLI is used via npx and does not need to be installed globally:

npx distats-cli@latest <command>

Commands

init

Initializes a new Distats Panel installation in the current directory.

npx distats-cli@latest init

What it does:

  1. Verifies the target directory is empty (exits with an error if not)
  2. Clones the Distats Panel repository into the current directory
  3. Runs npm install to install all dependencies
  4. Runs npm run build to produce a production Next.js build
  5. Generates @distats_panel/config.json with default values

Output files:

  • @distats_panel/config.json — your panel configuration
  • @distats_panel/database.sqlite — created on first panel start

Run init inside an empty directory. The CLI will refuse to initialize if existing files are detected to avoid overwriting your project.


create-user

Creates a new administrator account in the local SQLite database.

npx distats-cli@latest create-user

What it does:

  1. Reads @distats_panel/config.json to locate the SQLite database
  2. Prompts for a username and password
  3. Hashes the password using Node.js crypto.scrypt with a random salt
  4. Inserts the record into the users table

Example session:

? Enter username: admin
? Enter password: ••••••••••••
✔ User "admin" created successfully.

After this, you can log in at http://localhost:3000 with those credentials.


Running the panel

The CLI only handles initialization. To start the panel after setup, use npm directly:

# Start the production server
npm start

# Or run in development mode (with hot-reload)
npm run dev

The panel will be available at http://localhost:3000 (or whatever port Next.js assigns if 3000 is in use).