Skip to content

CLI Commands

Complete reference for all StackSolo CLI commands.

Terminal window
# Use directly with npx (recommended)
npx stacksolo <command>
# Or install globally
npm install -g stacksolo
CommandDescription
stacksolo initInitialize a new project
stacksolo cloneBootstrap from an existing project
stacksolo scaffoldGenerate local dev files
stacksolo addAdd template resources to existing project
stacksolo deployDeploy infrastructure
stacksolo destroyDestroy all resources
stacksolo mergeMerge multiple projects into one
stacksolo statusShow deployment status
stacksolo eventsView deploy event logs
stacksolo inventoryScan and manage GCP resources
stacksolo devStart local development
stacksolo logsView deployment logs
stacksolo outputShow resource outputs

Initialize a new StackSolo project.

Terminal window
stacksolo init [options]

Options:

OptionDescription
-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, --yesSkip prompts and use defaults
--create-projectCreate a new GCP + Firebase project
--list-templatesList available remote templates
--skip-org-policySkip org policy check and fix
--skip-apisSkip enabling GCP APIs

What it does:

  1. Checks gcloud authentication
  2. Lists your GCP projects
  3. Enables required APIs
  4. Asks what type of app you’re building
  5. Generates .stacksolo/stacksolo.config.json

Create a brand new GCP project with Firebase pre-configured:

Terminal window
stacksolo init --create-project

This interactive flow:

  1. Checks gcloud and firebase CLI authentication
  2. Prompts for project name and auto-generates a unique GCP project ID
  3. Creates the GCP project
  4. Guides you through enabling billing (with automatic linking if you have billing accounts)
  5. Enables all required GCP APIs
  6. Adds Firebase to the project
  7. Optionally configures Firebase Authentication (pauses for manual setup)
  8. Sets up org policies and Cloud Build permissions
  9. Generates your stacksolo config with kernel support

Example:

Terminal window
# Create new project interactively
stacksolo init --create-project
# Create with pre-set name and region
stacksolo init --create-project --name my-app --region us-central1

Why use this? Each stacksolo project gets its own isolated GCP/Firebase project. This avoids cross-project complexity and keeps billing/quotas separate.

Clone a remote stack or bootstrap from an existing local project. Stacks are complete, deployable applications with full source code.

Terminal window
stacksolo clone [source] [destination] [options]

Arguments:

ArgumentDescription
sourceStack ID (e.g., rag-platform) or path to local project
destinationDirectory name for the new project

Options:

OptionDescription
--listList available remote stacks
-n, --name <name>Name for the new project
-o, --output <dir>Output directory (default: current directory)
--no-vpcDo not share the VPC (local clone only)
--no-bucketsDo not share storage buckets (local clone only)
--no-registryDo not share artifact registry (local clone only)
-y, --yesSkip prompts and use defaults

Examples:

Terminal window
# List available stacks
stacksolo clone --list
# Clone a remote stack
stacksolo clone rag-platform my-chatbot
# Clone with defaults (no prompts)
stacksolo clone rag-platform my-chatbot -y
# Clone a local project
stacksolo 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-vpc

Remote 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

Generate local development files from your config.

Terminal window
stacksolo scaffold [options]
OptionDescription
--env-onlyOnly generate .env files
--docker-onlyOnly generate docker-compose.yml
--forceOverwrite existing files
--dry-runShow what would be generated

Add template resources to an existing StackSolo project without re-initializing.

Terminal window
stacksolo add <template> [options]

Arguments:

ArgumentDescription
templateTemplate ID to add (e.g., pdf-extractor)

Options:

OptionDescription
--name <prefix>Prefix for added resource names (avoids conflicts)
--dry-runPreview changes without applying
--listList available templates
-y, --yesSkip confirmation prompts

What it does:

  1. Loads your existing stacksolo.config.json
  2. Fetches the template configuration from the remote repository
  3. Merges template resources (buckets, functions, etc.) into your config
  4. Copies source files to the appropriate directories
  5. Detects and warns about naming conflicts

Examples:

Terminal window
# List available templates
stacksolo add --list
# Add PDF extractor to your project
stacksolo add pdf-extractor
# Add with a name prefix (creates "docs-uploads", "docs-processed", etc.)
stacksolo add pdf-extractor --name docs
# Preview changes without applying
stacksolo add pdf-extractor --dry-run
# Add without confirmation prompts
stacksolo add pdf-extractor -y

Using Name Prefix:

When adding a template to a project that already has resources with similar names, use --name to prefix all added resources:

Terminal window
# First PDF processor for invoices
stacksolo add pdf-extractor --name invoice
# Second PDF processor for contracts
stacksolo add pdf-extractor --name contract

This creates separate buckets and functions for each use case:

  • invoice-uploads, invoice-processed, invoice-pdf-processor
  • contract-uploads, contract-processed, contract-pdf-processor

See also: Templates

Deploy your infrastructure to GCP.

Terminal window
stacksolo deploy [options]
OptionDescription
--previewShow what would change
--skip-buildSkip building container images
--skip-secretsSkip secret validation and auto-creation
--skip-preflightSkip pre-flight conflict detection
--tag <tag>Container image tag (default: latest)
--refreshRefresh Terraform state first
--forceForce recreate conflicting resources
--import-conflictsAutomatically import conflicting resources
--delete-conflictsAutomatically delete conflicting resources
-v, --verboseShow real-time Terraform and Docker output
--helmGenerate Helm chart (Kubernetes backend only)
-y, --yesSkip confirmation prompts

Secret Auto-Creation:

When your config references secrets using @secret/secret-name in environment variables, the deploy command automatically:

  1. Scans your config for all @secret/ references
  2. Checks which secrets exist in GCP Secret Manager
  3. For missing secrets:
    • Checks .env.production for matching values
    • Prompts you to confirm using values from .env.production
    • Or prompts you to enter values manually
Terminal window
$ 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:

Terminal window
# Preview Helm chart
stacksolo deploy --helm --preview
# Generate and deploy via Helm
stacksolo deploy --helm

The chart is generated to .stacksolo/helm-chart/. See Helm Plugin for multi-environment deployment workflows.

Destroy all deployed resources.

Terminal window
stacksolo destroy [options]
OptionDescription
--forceSkip confirmation prompt

Show deployment status.

Terminal window
stacksolo status

Show outputs from deployed resources.

Terminal window
stacksolo output [resource]

View deployment logs.

Terminal window
stacksolo logs [options]
OptionDescription
--followStream logs in real-time
--since <duration>Show logs since (e.g., 1h, 30m)

View high-resolution event logs for deploy operations. Events are stored in ~/.stacksolo/registry.db and provide full observability of every operation during deployment.

Terminal window
# View latest session events
stacksolo events
# List all sessions
stacksolo events list [options]
# View specific session
stacksolo events show [session-id] [options]

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 |
+--------------+-----------------+------------+----------------------+-------------------------------------+

List recent deploy sessions.

OptionDescription
-n, --limit <number>Number of sessions to show (default: 10)
--jsonOutput as JSON

Show events for a specific session.

Terminal window
# View by session ID (first 8 chars work)
stacksolo events show abc12345
# Filter by category
stacksolo events show --category terraform
# Filter by resource
stacksolo events show --resource my-bucket
# JSON output
stacksolo events show --json
OptionDescription
-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
--jsonOutput as JSON
CategoryDescription
internalSession lifecycle, phase transitions, conflicts, user prompts
terraformTerraform init, plan, apply operations and resource changes
dockerDocker build and push operations
gcloudgcloud CLI commands
fileFile system operations
gcsGCS uploads

Merge multiple StackSolo projects into a single deployable stack. Useful for CI pipelines or combining microservices.

Terminal window
stacksolo merge <projects...> --name <name> [options]

Arguments:

ArgumentDescription
projectsPaths to project directories or config files (1 or more)

Options:

OptionDescription
--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-runShow what would be merged without writing files

Examples:

Terminal window
# Merge two projects
stacksolo merge ./users-api ./orders-api --name platform
# Merge with custom output directory
stacksolo merge ./api ./web --name my-app --output ./deploy
# Preview merge without writing files
stacksolo merge ./services/* --name prod-stack --dry-run

How it works:

  1. Loads and validates all source project configs
  2. Detects conflicts (all projects must use the same GCP project ID)
  3. Prefixes all resource names with source project name (e.g., apiusers-api-api)
  4. Merges networks into a single shared VPC
  5. Combines load balancer routes with path prefixes (e.g., /users/*, /orders/*)
  6. Writes merged config to output directory

See also: Resource Sharing Guide

Scan and manage GCP resources across your projects. Helps track shared resources and find orphaned infrastructure.

Terminal window
stacksolo inventory [options]

Options:

OptionDescription
--project <id>GCP project ID to scan
--jsonOutput as JSON
--orphanedShow only orphaned resources

Subcommands:

Terminal window
# Scan for all StackSolo resources
stacksolo inventory --project=my-gcp-project
# Adopt an unmanaged resource
stacksolo inventory adopt "VPC Network" default my-project-name
# Mark a resource as shared with other projects
stacksolo inventory share "VPC Network" my-vpc second-project third-project

Resource 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

Start a local development environment.

Terminal window
stacksolo dev [options]
OptionDescription
--localRun services locally without Docker/K8s
--stopTear down local environment
--statusShow running pods
--logs [service]Tail logs
--rebuildForce regenerate K8s manifests
--no-emulatorsSkip Firebase/Pub/Sub emulators

Run services directly on your machine without Docker or Kubernetes.

Terminal window
stacksolo dev --local
stacksolo dev --local --no-emulators

How it works:

  1. Reads config from .stacksolo/stacksolo.config.json
  2. Finds all services (functions, UIs, containers)
  3. Runs npm run dev for each service in parallel
  4. Streams logs with colored prefixes per service
  5. Ctrl+C gracefully stops all processes

Port allocation:

Service TypePorts
Functions8081, 8082, 8083…
UIs3000, 3001, 3002…
Containers9000, 9001, 9002…

Requirements:

All services must have an npm run dev script in their package.json:

Service TypeRequired dev Script
Functiontsup src/index.ts --watch --onSuccess 'functions-framework ...'
UI (React/Vue)vite
Containertsx watch src/index.ts

The CLI injects PORT env var for functions/containers, and passes --port flag for UIs.

Start a local Kubernetes environment via OrbStack or Docker Desktop.

Terminal window
stacksolo dev

Prerequisites: OrbStack or any local Kubernetes cluster.

Build container images locally.

Terminal window
stacksolo build [options]
OptionDescription
--service <name>Build specific service
--tag <tag>Image tag
--pushPush to registry

Manage configuration.

Terminal window
# View config
stacksolo config show
# Edit config
stacksolo config edit
# Validate config
stacksolo config validate

Manage environment variables.

Terminal window
# List env vars
stacksolo env list
# Set env var
stacksolo env set API_KEY=secret123
# Remove env var
stacksolo env unset API_KEY
OptionDescription
--helpShow help
--versionShow version
--verboseDetailed output
--quietSuppress output
VariableDescription
STACKSOLO_CONFIGPath to config file
STACKSOLO_PROJECTGCP project ID override
STACKSOLO_REGIONRegion override
GOOGLE_APPLICATION_CREDENTIALSPath to service account key
CodeMeaning
0Success
1General error
2Configuration error
3Authentication error
4Deployment error
Terminal window
npm install -g @stacksolo/cli
gcloud auth login
gcloud auth application-default login
mkdir my-app && cd my-app
stacksolo init
Terminal window
# Local mode (no Docker/K8s - fastest)
stacksolo dev --local
# Make changes, see live reload...
# Ctrl+C to stop
# Or Kubernetes mode
stacksolo dev
stacksolo dev --logs api
stacksolo dev --stop
Terminal window
stacksolo deploy --preview
stacksolo deploy
stacksolo status