CLI Commands
Complete reference for all StackSolo CLI commands.
Installation
Section titled “Installation”# Use directly with npx (recommended)npx stacksolo <command>
# Or install globallynpm install -g stacksoloCommand Overview
Section titled “Command Overview”| Command | Description |
|---|---|
stacksolo init | Initialize a new project |
stacksolo clone | Bootstrap from an existing project |
stacksolo scaffold | Generate local dev files |
stacksolo add | Add template resources to existing project |
stacksolo deploy | Deploy infrastructure |
stacksolo destroy | Destroy all resources |
stacksolo merge | Merge multiple projects into one |
stacksolo status | Show deployment status |
stacksolo events | View deploy event logs |
stacksolo inventory | Scan and manage GCP resources |
stacksolo dev | Start local development |
stacksolo logs | View deployment logs |
stacksolo output | Show resource outputs |
Project Commands
Section titled “Project Commands”stacksolo init
Section titled “stacksolo init”Initialize a new StackSolo project.
stacksolo init [options]Options:
| Option | Description |
|---|---|
-n, --name <name> | Project name |
--project-id <id> | GCP project ID |
-r, --region <region> | Region |
-t, --template <template> | Project template (function-api, ui-api, etc.) |
-y, --yes | Skip prompts and use defaults |
--create-project | Create a new GCP + Firebase project |
--list-templates | List available remote templates |
--skip-org-policy | Skip org policy check and fix |
--skip-apis | Skip enabling GCP APIs |
What it does:
- Checks gcloud authentication
- Lists your GCP projects
- Enables required APIs
- Asks what type of app you’re building
- Generates
.stacksolo/stacksolo.config.json
Create Project Mode (--create-project)
Section titled “Create Project Mode (--create-project)”Create a brand new GCP project with Firebase pre-configured:
stacksolo init --create-projectThis interactive flow:
- Checks gcloud and firebase CLI authentication
- Prompts for project name and auto-generates a unique GCP project ID
- Creates the GCP project
- Guides you through enabling billing (with automatic linking if you have billing accounts)
- Enables all required GCP APIs
- Adds Firebase to the project
- Optionally configures Firebase Authentication (pauses for manual setup)
- Sets up org policies and Cloud Build permissions
- Generates your stacksolo config with kernel support
Example:
# Create new project interactivelystacksolo init --create-project
# Create with pre-set name and regionstacksolo init --create-project --name my-app --region us-central1Why use this? Each stacksolo project gets its own isolated GCP/Firebase project. This avoids cross-project complexity and keeps billing/quotas separate.
stacksolo clone
Section titled “stacksolo clone”Clone a remote stack or bootstrap from an existing local project. Stacks are complete, deployable applications with full source code.
stacksolo clone [source] [destination] [options]Arguments:
| Argument | Description |
|---|---|
source | Stack ID (e.g., rag-platform) or path to local project |
destination | Directory name for the new project |
Options:
| Option | Description |
|---|---|
--list | List available remote stacks |
-n, --name <name> | Name for the new project |
-o, --output <dir> | Output directory (default: current directory) |
--no-vpc | Do not share the VPC (local clone only) |
--no-buckets | Do not share storage buckets (local clone only) |
--no-registry | Do not share artifact registry (local clone only) |
-y, --yes | Skip prompts and use defaults |
Examples:
# List available stacksstacksolo clone --list
# Clone a remote stackstacksolo clone rag-platform my-chatbot
# Clone with defaults (no prompts)stacksolo clone rag-platform my-chatbot -y
# Clone a local projectstacksolo clone ./my-existing-project --name my-new-api
# Clone but create a new VPC (local clone only)stacksolo clone ./my-existing-project --name my-new-api --no-vpcRemote Stacks:
Remote stacks are hosted in the stacksolo-architectures repository. They include:
- Full source code (services, apps)
- Infrastructure configuration
- Documentation and setup guides
- Variable substitution for customization
Local Project Cloning:
When cloning a local project, shared resources (VPC, buckets, registry) are automatically configured with existing: true:
- VPC Network - Reuses the source project’s VPC (avoids quota limits)
- Storage Buckets - References existing buckets
- Artifact Registry - Uses the same container registry
See also: Resource Sharing Guide
stacksolo scaffold
Section titled “stacksolo scaffold”Generate local development files from your config.
stacksolo scaffold [options]| Option | Description |
|---|---|
--env-only | Only generate .env files |
--docker-only | Only generate docker-compose.yml |
--force | Overwrite existing files |
--dry-run | Show what would be generated |
stacksolo add
Section titled “stacksolo add”Add template resources to an existing StackSolo project without re-initializing.
stacksolo add <template> [options]Arguments:
| Argument | Description |
|---|---|
template | Template ID to add (e.g., pdf-extractor) |
Options:
| Option | Description |
|---|---|
--name <prefix> | Prefix for added resource names (avoids conflicts) |
--dry-run | Preview changes without applying |
--list | List available templates |
-y, --yes | Skip confirmation prompts |
What it does:
- Loads your existing
stacksolo.config.json - Fetches the template configuration from the remote repository
- Merges template resources (buckets, functions, etc.) into your config
- Copies source files to the appropriate directories
- Detects and warns about naming conflicts
Examples:
# List available templatesstacksolo add --list
# Add PDF extractor to your projectstacksolo add pdf-extractor
# Add with a name prefix (creates "docs-uploads", "docs-processed", etc.)stacksolo add pdf-extractor --name docs
# Preview changes without applyingstacksolo add pdf-extractor --dry-run
# Add without confirmation promptsstacksolo add pdf-extractor -yUsing Name Prefix:
When adding a template to a project that already has resources with similar names, use --name to prefix all added resources:
# First PDF processor for invoicesstacksolo add pdf-extractor --name invoice
# Second PDF processor for contractsstacksolo add pdf-extractor --name contractThis creates separate buckets and functions for each use case:
invoice-uploads,invoice-processed,invoice-pdf-processorcontract-uploads,contract-processed,contract-pdf-processor
See also: Templates
Infrastructure Commands
Section titled “Infrastructure Commands”stacksolo deploy
Section titled “stacksolo deploy”Deploy your infrastructure to GCP.
stacksolo deploy [options]| Option | Description |
|---|---|
--preview | Show what would change |
--skip-build | Skip building container images |
--skip-secrets | Skip secret validation and auto-creation |
--skip-preflight | Skip pre-flight conflict detection |
--tag <tag> | Container image tag (default: latest) |
--refresh | Refresh Terraform state first |
--force | Force recreate conflicting resources |
--import-conflicts | Automatically import conflicting resources |
--delete-conflicts | Automatically delete conflicting resources |
-v, --verbose | Show real-time Terraform and Docker output |
--helm | Generate Helm chart (Kubernetes backend only) |
-y, --yes | Skip confirmation prompts |
Secret Auto-Creation:
When your config references secrets using @secret/secret-name in environment variables, the deploy command automatically:
- Scans your config for all
@secret/references - Checks which secrets exist in GCP Secret Manager
- For missing secrets:
- Checks
.env.productionfor matching values - Prompts you to confirm using values from
.env.production - Or prompts you to enter values manually
- Checks
$ stacksolo deploy
Checking secrets...✓ SECRET_API_KEY exists✗ OPENAI_API_KEY missing
Found OPENAI_API_KEY in .env.production? Use this value? (Y/n)
Creating secret 'openai-api-key'...✓ Secret created
Deploying...To skip secret checking: stacksolo deploy --skip-secrets
See also: Secrets Guide
Helm Output:
For Kubernetes backend projects, use --helm to generate a Helm chart instead of raw manifests:
# Preview Helm chartstacksolo deploy --helm --preview
# Generate and deploy via Helmstacksolo deploy --helmThe chart is generated to .stacksolo/helm-chart/. See Helm Plugin for multi-environment deployment workflows.
stacksolo destroy
Section titled “stacksolo destroy”Destroy all deployed resources.
stacksolo destroy [options]| Option | Description |
|---|---|
--force | Skip confirmation prompt |
stacksolo status
Section titled “stacksolo status”Show deployment status.
stacksolo statusstacksolo output
Section titled “stacksolo output”Show outputs from deployed resources.
stacksolo output [resource]stacksolo logs
Section titled “stacksolo logs”View deployment logs.
stacksolo logs [options]| Option | Description |
|---|---|
--follow | Stream logs in real-time |
--since <duration> | Show logs since (e.g., 1h, 30m) |
stacksolo events
Section titled “stacksolo events”View high-resolution event logs for deploy operations. Events are stored in ~/.stacksolo/registry.db and provide full observability of every operation during deployment.
# View latest session eventsstacksolo events
# List all sessionsstacksolo events list [options]
# View specific sessionstacksolo events show [session-id] [options]stacksolo events (default)
Section titled “stacksolo events (default)”Shows events from the most recent deploy session in an ASCII table.
+--------------+-----------------+------------+----------------------+-------------------------------------+| TIME | PROJECT | CATEGORY | EVENT | DETAILS |+--------------+-----------------+------------+----------------------+-------------------------------------+| 19:55:54.294 | my-app | internal | session_start | deploy || 19:55:54.297 | my-app | internal | phase_start | phase=preflight || 19:56:24.356 | my-app | internal | phase_end | phase=preflight || 19:56:24.358 | my-app | internal | phase_start | phase=apply || 19:56:24.359 | my-app | terraform | apply_start | || 19:57:14.519 | my-app | terraform | apply_end | exit=0 || 19:57:14.521 | my-app | internal | phase_end | phase=apply || 19:57:14.521 | my-app | internal | session_end | exit=0 |+--------------+-----------------+------------+----------------------+-------------------------------------+stacksolo events list
Section titled “stacksolo events list”List recent deploy sessions.
| Option | Description |
|---|---|
-n, --limit <number> | Number of sessions to show (default: 10) |
--json | Output as JSON |
stacksolo events show
Section titled “stacksolo events show”Show events for a specific session.
# View by session ID (first 8 chars work)stacksolo events show abc12345
# Filter by categorystacksolo events show --category terraform
# Filter by resourcestacksolo events show --resource my-bucket
# JSON outputstacksolo events show --json| Option | Description |
|---|---|
-c, --category <category> | Filter by category: internal, terraform, docker, gcloud, file, gcs |
-r, --resource <name> | Filter by resource name |
-n, --limit <number> | Maximum events to show |
--json | Output as JSON |
Event Categories
Section titled “Event Categories”| Category | Description |
|---|---|
internal | Session lifecycle, phase transitions, conflicts, user prompts |
terraform | Terraform init, plan, apply operations and resource changes |
docker | Docker build and push operations |
gcloud | gcloud CLI commands |
file | File system operations |
gcs | GCS uploads |
stacksolo merge
Section titled “stacksolo merge”Merge multiple StackSolo projects into a single deployable stack. Useful for CI pipelines or combining microservices.
stacksolo merge <projects...> --name <name> [options]Arguments:
| Argument | Description |
|---|---|
projects | Paths to project directories or config files (1 or more) |
Options:
| Option | Description |
|---|---|
--name <name> | Name for the merged project (required) |
-o, --output <dir> | Output directory (default: .stacksolo-merged/) |
--shared-vpc <name> | Use a shared VPC for all projects |
--dry-run | Show what would be merged without writing files |
Examples:
# Merge two projectsstacksolo merge ./users-api ./orders-api --name platform
# Merge with custom output directorystacksolo merge ./api ./web --name my-app --output ./deploy
# Preview merge without writing filesstacksolo merge ./services/* --name prod-stack --dry-runHow it works:
- Loads and validates all source project configs
- Detects conflicts (all projects must use the same GCP project ID)
- Prefixes all resource names with source project name (e.g.,
api→users-api-api) - Merges networks into a single shared VPC
- Combines load balancer routes with path prefixes (e.g.,
/users/*,/orders/*) - Writes merged config to output directory
See also: Resource Sharing Guide
stacksolo inventory
Section titled “stacksolo inventory”Scan and manage GCP resources across your projects. Helps track shared resources and find orphaned infrastructure.
stacksolo inventory [options]Options:
| Option | Description |
|---|---|
--project <id> | GCP project ID to scan |
--json | Output as JSON |
--orphaned | Show only orphaned resources |
Subcommands:
# Scan for all StackSolo resourcesstacksolo inventory --project=my-gcp-project
# Adopt an unmanaged resourcestacksolo inventory adopt "VPC Network" default my-project-name
# Mark a resource as shared with other projectsstacksolo inventory share "VPC Network" my-vpc second-project third-projectResource categories:
- Managed - Resources with StackSolo labels linked to registered projects
- Orphaned - StackSolo resources whose projects are no longer registered
- Unmanaged - GCP resources without StackSolo labels
See also: Resource Sharing Guide
Development Commands
Section titled “Development Commands”stacksolo dev
Section titled “stacksolo dev”Start a local development environment.
stacksolo dev [options]| Option | Description |
|---|---|
--local | Run services locally without Docker/K8s |
--stop | Tear down local environment |
--status | Show running pods |
--logs [service] | Tail logs |
--rebuild | Force regenerate K8s manifests |
--no-emulators | Skip Firebase/Pub/Sub emulators |
Local Mode (--local)
Section titled “Local Mode (--local)”Run services directly on your machine without Docker or Kubernetes.
stacksolo dev --localstacksolo dev --local --no-emulatorsHow it works:
- Reads config from
.stacksolo/stacksolo.config.json - Finds all services (functions, UIs, containers)
- Runs
npm run devfor each service in parallel - Streams logs with colored prefixes per service
- Ctrl+C gracefully stops all processes
Port allocation:
| Service Type | Ports |
|---|---|
| Functions | 8081, 8082, 8083… |
| UIs | 3000, 3001, 3002… |
| Containers | 9000, 9001, 9002… |
Requirements:
All services must have an npm run dev script in their package.json:
| Service Type | Required dev Script |
|---|---|
| Function | tsup src/index.ts --watch --onSuccess 'functions-framework ...' |
| UI (React/Vue) | vite |
| Container | tsx watch src/index.ts |
The CLI injects PORT env var for functions/containers, and passes --port flag for UIs.
Kubernetes Mode (default)
Section titled “Kubernetes Mode (default)”Start a local Kubernetes environment via OrbStack or Docker Desktop.
stacksolo devPrerequisites: OrbStack or any local Kubernetes cluster.
stacksolo build
Section titled “stacksolo build”Build container images locally.
stacksolo build [options]| Option | Description |
|---|---|
--service <name> | Build specific service |
--tag <tag> | Image tag |
--push | Push to registry |
Configuration Commands
Section titled “Configuration Commands”stacksolo config
Section titled “stacksolo config”Manage configuration.
# View configstacksolo config show
# Edit configstacksolo config edit
# Validate configstacksolo config validatestacksolo env
Section titled “stacksolo env”Manage environment variables.
# List env varsstacksolo env list
# Set env varstacksolo env set API_KEY=secret123
# Remove env varstacksolo env unset API_KEYGlobal Options
Section titled “Global Options”| Option | Description |
|---|---|
--help | Show help |
--version | Show version |
--verbose | Detailed output |
--quiet | Suppress output |
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
STACKSOLO_CONFIG | Path to config file |
STACKSOLO_PROJECT | GCP project ID override |
STACKSOLO_REGION | Region override |
GOOGLE_APPLICATION_CREDENTIALS | Path to service account key |
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Authentication error |
| 4 | Deployment error |
Common Workflows
Section titled “Common Workflows”First-time setup
Section titled “First-time setup”npm install -g @stacksolo/cligcloud auth logingcloud auth application-default loginmkdir my-app && cd my-appstacksolo initDaily development
Section titled “Daily development”# Local mode (no Docker/K8s - fastest)stacksolo dev --local# Make changes, see live reload...# Ctrl+C to stop
# Or Kubernetes modestacksolo devstacksolo dev --logs apistacksolo dev --stopDeploying changes
Section titled “Deploying changes”stacksolo deploy --previewstacksolo deploystacksolo status