Projects & apps

Projects and apps

Create and link projects, manage environments, and manage apps directly.

The CLI says project and environment, like the dashboard, and so do its flags: -p, --project and -e, --env (--pipeline and --phase still work). Only the variables STACKBLAZE_PIPELINE and STACKBLAZE_PHASE and the keys in JSON output keep the names pipeline and phase.

stackblaze init

Alias: new

Creates a project and writes .stackblaze/project.json in the current directory, linking it to that project and environment. If a project with that name exists, it is linked instead. init does not link an app; stackblaze up adds it.

usage
stackblaze init [options]
FlagDescription
-p, --project <name>Project name (default: the directory name)
-e, --env <name>Environment to link (default: the first of --phases, else production)
--phases <names...>Environments to create on a new project (default production)
--domain <host>Wildcard domain for the new project
-y, --yesAccept the defaults without prompting

Also accepts the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze init
stackblaze init -y
stackblaze init -p shop --phases staging production -e staging

stackblaze context

Prints what the CLI would use here: the API URL and the project, environment and app after applying flags, STACKBLAZE_* variables and .stackblaze/project.json. The text output labels them api:, project:, environment: and app:; JSON output keeps the keys pipeline and phase. Makes no API call.

usage
stackblaze context

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

stackblaze projects

Aliases: project, pipelines, pipeline

Manages projects. list shows projects and their environments; stackblaze list and stackblaze ls do the same. create takes the new project's name as [name] or with -p. iac shows or switches Infrastructure as Code for the project (see below). delete removes a project and all its apps (default: the linked project) and asks you to type its name unless -y; when it was the linked project, the link is removed.

usage
stackblaze projects list
stackblaze projects create [name] [--phases <names...>] [--domain <host>] [--region <slug>]
stackblaze projects delete [name] [-y]
stackblaze projects iac [on|off|status]

iac with no argument (or status) shows whether Infrastructure as Code is on for the linked project, or the one named with -p; on and off switch it. It is the same switch as Project Settings → General → Infrastructure as Code. Projects made with projects create start with it off.

FlagDescription
--phases <names...>create: environments to create (default production)
--domain <host>create: wildcard domain for the project's apps
--region <slug>create: region to create the project in, e.g. us-west-1 (default: your organization's preferred region)
-y, --yesdelete: skip the confirmation

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze projects list
stackblaze projects create shop --phases staging production
stackblaze projects create shop-west --region us-west-1
stackblaze projects iac on -p shop
stackblaze projects delete shop-old -y

stackblaze phases

Aliases: phase, environments

Manages a project's environments, such as staging and production. delete does not delete the apps in the environment, and you cannot delete a project's only environment. use switches the environment in this directory's link; without a name you pick from a list.

usage
stackblaze phases list
stackblaze phases create <name>
stackblaze phases delete <name> [-y]
stackblaze phases use [name]
FlagDescription
-y, --yesdelete: skip the confirmation

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze phases create staging
stackblaze phase use staging
stackblaze phases delete preview -y

stackblaze apps

Alias: app

Manages apps directly. list shows apps across your projects, filtered to the scope; get shows one app's URL, status, instance count and variable count; create makes an app from an image or a git repository; update changes an existing app; restart, redeploy and scale are the same as the top-level commands; delete asks you to type the app name unless -y.

usage
stackblaze apps list
stackblaze apps get [name]
stackblaze apps create [name] [--mode docker|git] [options]
stackblaze apps update [name] [options]
stackblaze apps restart [name]
stackblaze apps redeploy [name] [--tag <tag>] [-m <text>]
stackblaze apps scale [web=N] [worker=N] [--autoscale <process=min:max>]
stackblaze apps delete [name] [-y]

get, update, restart, redeploy and delete take the app as [name], or with -a; the default is the linked app.

create needs a project; the environment defaults to production. An image app created without --port, --domain or --worker uses the image's EXPOSE port, or port 3000 with a warning. update needs at least one change.

--image takes a full reference such as nginx:1.27. On create, --tag is only needed when --image has no tag, and the two must agree; with neither, the tag is latest. On update, a bare name such as --image nginx keeps the app's current tag.

FlagDescription
--mode <mode>create: docker or git (default: docker with --image, git with --repository)
--name <name>create: app name (or pass it positionally)
--image <ref>create, update: image reference, e.g. nginx:1.27
--tag <tag>create, update: image tag when --image has none
--repository <url>create: git URL
--branch <name>create, update: git branch (create default main)
--buildstrategy <s>create, update: buildpacks, dockerfile, nixpacks or plain
--build-context <dir>, --dockerfile-path <path>create, update: monorepo build context and Dockerfile path
--port <n>create, update: container port
--workercreate: background worker, no port and no public URL
--replicas <n>create: replicas (default 1)
-r, --replicas <n>, --worker-replicas <n>update: web and worker replicas
--podsize <name>update: instance size, by name
--domain <host>create, update: custom domain (update replaces the existing hosts)
--addon <name>create: attach an add-on by kind or name (repeatable)
--env <KEY=value>create, update: variable (repeatable)
--waitcreate: wait until the app is running
--timeout <seconds>create: maximum --wait time (default 600)
--tag <tag>redeploy: deploy this image tag
-m, --message <text>redeploy: release message shown in the deployment history
-y, --yesdelete: skip the confirmation

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze apps list -o json | jq -r '.[] | "\(.pipeline)/\(.phase)/\(.app)"'
stackblaze apps create api --image registry.example.com/acme/api:1.4.2 --port 8080 -p shop --wait
stackblaze apps get api
stackblaze apps update api --env FEATURE_X=on
stackblaze apps delete old-api -y

stackblaze open

Prints the URL of the linked app's dashboard page and opens it in your browser. With no app in scope, it opens the project page. The browser opens only when stdout is a terminal and JSON output is off.

usage
stackblaze open [--app-url] [--no-browser]
FlagDescription
--app-urlOpen the app's public URL instead of the dashboard
--no-browserOnly print the URL

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze open
stackblaze open --app-url
stackblaze open --no-browser -o json | jq -r .url