Skip to Content
CLI Referencenkapp clean

nkapp clean

clean [-e <env>] [-y]

Hard Reset (Nuclear Option): Wipes ALL containers, volumes, networks, and state for the project.

  • Local: Removes all Docker resources and wipes local state files.
  • Cloud (AWS/GCP): Performs a deep infrastructure wipe, including Load Balancers, Target Groups, Log Groups, and VPC networking to prevent orphaned resources.
  • More destructive than destroy — also removes persistent data (volumes), cloud-native gateways, and local state files.
  • Remote Integration: Automatically triggers infra destroy on the active provider to ensure no orphaned resources or costs remain on cloud platforms (AWS, DigitalOcean, etc.).
  • Local Integration: Wipes all local metadata and caches in .nanokit/.
nkapp clean [options]

Options

FlagTypeDefaultDescription
-e, --env <env>stringlocalTarget environment
-y, --yesbooleanfalseSkip confirmation prompt

What Gets Removed

ResourceRemoved?Target
Service containersLocal & Cloud
Gateway / Load BalancerLocal & Cloud (ALB/NLB)
Named volumes (caches, DBs)Local & Cloud (EFS)
Docker networks / VPCLocal & Cloud
Nanokit state filesLocal
Target GroupsCloud
CloudWatch Log GroupsCloud
Elastic IPsCloud

Nuclear Clean on Cloud Providers

When running nkapp clean on cloud providers (like AWS), Nanokit performs a “Nuclear” deep clean. It doesn’t just stop services; it actively discovers and destroys all project-tagged infrastructure to prevent orphaned resources and hidden costs.

This includes:

  • Releasing unassociated Elastic IPs.
  • Deleting Application/Network Load Balancers.
  • Wiping EFS File Systems.
  • Detaching and deleting Internet Gateways and Subnets.
  • Waiting for ENIs (Network Interfaces) to settle before final VPC removal.

Difference from destroy

CommandContainersVolumesState
nkapp destroy✅ Removed❌ Kept❌ Kept
nkapp clean✅ Removed✅ Removed✅ Removed

Examples

# Full wipe of local environment nkapp clean -e local -y # Clean staging (with confirmation prompt) nkapp clean -e stage

[!CAUTION] This operation is irreversible. All persistent data in named volumes (databases, caches, node_modules) will be permanently deleted. Run nkapp up afterwards to reconcile from scratch.