Skip to Content
CLI ReferenceCLI Overview

CLI Overview

The Nanokit CLI, invoked via the nkapp command, is the central tool for managing your application’s lifecycle. It handles everything from local development bootstrapping to remote cloud orchestration.

Installation

Nanokit is distributed as a global npm package or can be run via npx.

npm install -g nkapp nkapp --version

Global Flags

Most commands support these flags to ensure consistency across different environments and automation flows:

FlagDescription
-e, --env <env>Specifies the target environment (e.g., local, stage, production). Defaults to local for most commands.
-y, --yesSkips interactive confirmation prompts. Essential for CI/CD pipelines.
--verboseEnables detailed logging of infrastructure events and SSH communications.

Execution Workflow

When you run a command like nkapp up, Nanokit follows a deterministic multi-stage workflow:

  1. Config Validation: The nanokit.yml file is parsed and validated against the Zod schema.
  2. Environment Merging: Environment-specific overrides are applied to the global configuration.
  3. Secret Resolution: All vault:// or env:// references are resolved into actual values.
  4. Infrastructure Planning: Nanokit compares the desired state with the current state of the provider.
  5. Action: The plan is applied, creating or updating resources as needed.

Command Reference

Lifecycle Commands

The primary commands you’ll use daily to manage your stack:

CommandDescription
nkapp upFull-stack orchestration: plan, provision, deploy
nkapp runDeploy services only (requires infrastructure to be ready)
nkapp stopStop running services without removing them
nkapp destroyStop and remove services (keeps volumes by default)
nkapp cleanFull project reset: wipe remote infra and local state
nkapp planStrictly read-only preview of upcoming changes

Deployment

CommandDescription
nkapp deployDeploy directly to a VPS via SSH

Observability

CommandDescription
nkapp hubOpen the Nanokit Hub (Bridge)
nkapp logsStream logs from project services
nkapp shellOpen an interactive terminal in a service or database
nkapp exposeExpose a service to LAN or globally via tunnel

Database Management

CommandDescription
nkapp dbManage database lifecycle, branching, and resets

Configuration Management

CommandDescription
nkapp configUnified command to manage all project settings
nkapp serviceAdd, remove, or modify services in nanokit.yml
nkapp hostManage project hostnames, SSL trust, and remote bootstrapping
nkapp secretsManage secrets and Vault integration
nkapp infraManage cloud infrastructure settings
nkapp infra destroyForcefully wipe all remote infrastructure
nkapp authManage cloud provider credentials

Bootstrapping

CommandDescription
nkapp configureInteractive wizard to setup a new project
nkapp initInitialize a new Nanokit project