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 (@nkapp/cli) or can be run via npx.

npm install -g @nkapp/cli 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.
-V, --versionPrints the CLI version.
--helpShows help for any command or subcommand.

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 startStart stopped services without recreating containers
nkapp stopStop running services without removing them
nkapp restartRestart running services
nkapp destroyStop and remove services (keeps volumes by default)
nkapp cleanFull project reset: wipe remote infra and local state
nkapp teardownState-free, tag-based remote teardown for CI/CD
nkapp planStrictly read-only preview of upcoming changes

Deployment

CommandDescription
nkapp deployDeploy directly to a VPS via SSH
nkapp export k8sTranslate nanokit.yml into Kubernetes manifests (offline)
nkapp export helmGenerate a parameterized Helm chart from nanokit.yml (offline)

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
nkapp backupTake manual backups and manage the backup catalog
nkapp restoreRestore a database from a backup

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 envList and sync environment variables
nkapp infraManage cloud infrastructure settings
nkapp infra destroyForcefully wipe all remote infrastructure

Account, Providers & Teams

CommandDescription
nkapp authConnect the CLI to your Nanokit account
nkapp provider authManage cloud provider credentials
nkapp teamManage teams, invites, and role-based access

Bootstrapping & Maintenance

CommandDescription
nkapp configureInteractive wizard to setup a new project
nkapp initInitialize a new Nanokit project
nkapp doctorRun an environment health check
nkapp updateUpdate the CLI to the latest published version