title: Navius CLI Reference description: Comprehensive reference for the Navius command-line interface category: getting-started tags:

  • cli
  • reference
  • commands
  • development
  • tooling related:
  • installation.md
  • development-setup.md
  • first-steps.md last_updated: March 27, 2025 version: 1.0 status: active

Navius CLI Reference

Overview

This document provides a comprehensive reference for the Navius command-line interface (CLI), including all available commands, options, environment variables, and exit codes.

Prerequisites

  • Rust and Cargo installed
  • Navius project cloned and dependencies installed (see Installation Guide)

Quick Start

Most commonly used commands:

# Run the application with default settings
cargo run

# Run in release mode
cargo run --release

# Run with specific features
cargo run --features "feature1,feature2"

# Run tests
cargo test

Basic Commands

Run Application

cargo run

Starts the application with default configuration.

Run with Specific Feature Flags

cargo run --features "feature1,feature2"

Runs the application with specific features enabled.

Development Mode

cargo run --features "dev"

Runs the application in development mode, which enables additional logging and development tooling.

Configuration Commands

Using Custom Configuration

cargo run -- --config-path=/path/to/config.yaml

Starts the application with a custom configuration file.

Environment Override

ENV_VAR=value cargo run

Runs the application with environment variable overrides.

Testing Commands

Run All Tests

cargo test

Runs all tests in the application.

Run Specific Tests

cargo test test_name

Runs tests matching the specified name.

Run Tests with Coverage

cargo tarpaulin --out Html

Runs tests and generates a coverage report.

Build Commands

Debug Build

cargo build

Builds the application in debug mode.

Release Build

cargo build --release

Builds the application in release mode, with optimizations enabled.

Build Documentation

cargo doc --no-deps --open

Builds and opens the API documentation.

Linting and Formatting

Check Code Style

cargo clippy

Checks the code for style issues and common mistakes.

Format Code

cargo fmt

Formats the code according to the Rust style guidelines.

Database Commands

Run Migrations

cargo run --bin migrate

Runs database migrations to set up or update the database schema.

Reset Database

cargo run --bin reset-db

Resets the database (warning: this will delete all data).

Advanced Commands

Generate Offline SQLx Data

cargo sqlx prepare

Generates SQLx data for offline compilation.

Analyze Binary Size

cargo bloat --release

Analyzes the binary size to identify large dependencies.

Key Concepts

Environment Variables

VariableDescriptionDefault
RUST_LOGControls log levelinfo
CONFIG_PATHPath to configuration fileconfig/default.yaml
DATABASE_URLDatabase connection stringConfigured in YAML
PORTServer port3000
HOSTServer host127.0.0.1

Exit Codes

CodeMeaning
0Success
1General error
2Configuration error
3Database connection error
4Permission error

Script Files

Navius provides several convenience scripts in the project root:

ScriptPurpose
run_dev.shRuns the application in development mode with hot reloading
run_prod.shRuns the application in production mode
test.shRuns tests with common options
reset_db.shResets the database and reruns migrations

Troubleshooting

IssueSolution
Command not foundMake sure you're in the project root directory
Permission deniedCheck file permissions or use sudo if appropriate
Dependency errorsRun cargo update to update dependencies
Test failuresCheck error messages and review related code

Next Steps