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 destroyon 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
| Flag | Type | Default | Description |
|---|---|---|---|
-e, --env <env> | string | local | Target environment |
-y, --yes | boolean | false | Skip confirmation prompt |
What Gets Removed
| Resource | Removed? | Target |
|---|---|---|
| Service containers | ✅ | Local & Cloud |
| Gateway / Load Balancer | ✅ | Local & Cloud (ALB/NLB) |
| Named volumes (caches, DBs) | ✅ | Local & Cloud (EFS) |
| Docker networks / VPC | ✅ | Local & Cloud |
| Nanokit state files | ✅ | Local |
| Target Groups | ✅ | Cloud |
| CloudWatch Log Groups | ✅ | Cloud |
| Elastic IPs | ✅ | Cloud |
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
| Command | Containers | Volumes | State |
|---|---|---|---|
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 upafterwards to reconcile from scratch.