App Deployment
The tcb app command is available since v3.0.0.
The tcb app command is used to deploy and manage CloudBase cloud apps. Each deployment overwrites the previous one and retains deployment history (viewable via tcb app versions).
Suitable for:
- Frontend projects with install + build steps (React / Vue / Next.js / Vite / Angular / Nuxt, etc.)
- Pure static projects
- Automated deployment in CI/CD pipelines
CLI automatically handles: Install dependencies → Build → Upload artifacts → Bind routes. Each deployment overwrites the previous one. View deployment history via tcb app versions list.
tcb app deploy
Deploy an app. CLI automatically executes: install dependencies → build → upload build artifacts → bind routes.
The following three invocation styles are completely equivalent:
tcb app deploy [serviceName] [options] # Full command
tcb deploy [serviceName] [options] # Top-level alias
tcb [options] # Bare command (routes to app deploy when no subcommand given)
Parameters
| Parameter | Description | Default |
|---|---|---|
[serviceName] | App name (optional; reads from package.json or prompts interactively if omitted) | — |
-e, --env-id <envId> | Target environment ID | — |
--framework <type> | Framework type: react / vue / vite / next / nuxt / angular / static | — |
--install-command <cmd> | Install command (leave empty to skip install) | npm install |
--build-command <cmd> | Build command (leave empty to skip build, suitable for pure static projects) | — |
--output-dir <dir> | Build output directory (default ./dist; use ./ when no build is needed) | Auto-detect |
--deploy-path <path> | Static hosting mount path | /${serviceName} |
--cwd <path> | Project directory (relative path) | Current directory |
-f, --force | Skip confirmation and overwrite when app name already exists | — |
Examples
# Deploy a Vite project (run from project root)
tcb app deploy --framework vite -e my-env-id
# Using top-level alias, completely equivalent
tcb deploy --framework vite -e my-env-id
# Bare command: interactive guided deployment
tcb
# Specify a project subdirectory (monorepo scenario)
tcb app deploy --cwd ./frontend -e my-env-id
# Deploy a Next.js project with custom output directory
tcb app deploy --framework next --output-dir .next -e my-env-id
# Pure static project (skip build step)
tcb app deploy --framework static --build-command "" --output-dir ./public -e my-env-id
# CI scenario: skip confirmation, overwrite existing app
tcb app deploy --framework react --force -e my-env-id
Configuring Deployment via cloudbaserc.json
In addition to specifying deployment options via CLI parameters, you can configure the app field in cloudbaserc.json for a zero-parameter deployment experience.
Configuration file structure:
{
"version": "2.0",
"envId": "my-env-id",
"app": {
"serviceName": "my-app",
"root": "./packages/web",
"framework": "react",
"installCommand": "npm install",
"buildCommand": "npm run build",
"outputDir": "build",
"deployPath": "/my-app",
"envVariables": {
"API_URL": "https://api.example.com"
}
}
}
Configuration fields:
| Field | Description | Default |
|---|---|---|
serviceName | Service name | package.json name or directory name |
root | Project root directory (relative path), for monorepo scenarios | Current directory |
framework | Framework type: react / vue / vite / next / nuxt / angular / static | Auto-detect |
installCommand | Install command, empty string to skip install | npm install |
buildCommand | Build command, empty string to skip build | Auto-detect based on framework |
outputDir | Build output directory | ./dist (./ when no build command) |
deployPath | Deployment path (static hosting mount path) | /${serviceName} |
envVariables | Environment variables, key-value pairs, injected during cloud build | — |
ignore | Glob patterns for files/directories to ignore | — |
General Priority Rule: CLI parameters > cloudbaserc.json configuration > Auto-detection > Interactive input
⚠️ Note: Some parameters have special rules (e.g.,
envVariableshas no CLI parameter,buildCommandhas framework defaults), see the table below for details.
Priority for each parameter:
| Parameter | Priority |
|---|---|
serviceName | CLI positional argument > cloudbaserc.json configuration > Interactive selection > Auto-infer (package.json or directory name) |
root | --cwd option > cloudbaserc.json configuration > Current directory |
framework | --framework option > cloudbaserc.json configuration > Auto-detect (package.json dependencies) > Undefined |
installCommand | --install-command option > cloudbaserc.json configuration > Auto-infer (npm install or empty) > Interactive input |
buildCommand | --build-command option > cloudbaserc.json configuration > Auto-detect (framework defaults or package.json scripts) > Interactive input > Empty string |
outputDir | --output-dir option > cloudbaserc.json configuration > Auto-detect (framework defaults) > Interactive input > ./dist (with build) or ./ (without build) |
deployPath | --deploy-path option > cloudbaserc.json configuration > Interactive input (default: /{serviceName}) |
envVariables | Only read from cloudbaserc.json (no CLI parameter) |
Special Notes:
- Both
--cwdandconfig.app.rootspecify the project working directory;--cwdhas higher priority envVariableshas no corresponding CLI parameter; can only be configured incloudbaserc.json- When
--yesor--jsonis specified, all interactive input is skipped and auto-inferred values are used instead - Framework auto-detection follows this priority: Next.js > Nuxt > Angular > Vite > Vue CLI > React (CRA) > Static HTML
Auto-save: After the first successful deployment, if no app configuration exists in cloudbaserc.json, CLI automatically saves the deployment parameters to the config file. Subsequent deployments require no repeated input.
For more details on configuration fields, see Configuration File documentation.
tcb app list
List all apps in the current environment.
tcb app list [options]
Parameters
| Parameter | Description | Default |
|---|---|---|
-e, --env-id <envId> | Environment ID | — |
-l, --limit <n> | Number of results | 20 |
-o, --offset <n> | Offset | 0 |
--json | Output JSON | — |
Example
tcb app list -e my-env-id
tcb app info
View details of a specific app (status, version, access domain, etc.).
tcb app info <serviceName> [options]
Example
tcb app info my-app -e my-env-id
# JSON output (for scripts to read the access domain)
tcb app info my-app --json -e my-env-id
tcb app versions list
List the version history of an app.
tcb app versions list <serviceName> [options]
Parameters
| Parameter | Description | Default |
|---|---|---|
<serviceName> | App name (required) | — |
-l, --limit <n> | Number of results | 20 |
-o, --offset <n> | Offset | 0 |
-e, --env-id <envId> | Environment ID | — |
Example
tcb app versions list my-app -e my-env-id
tcb app versions detail
View detailed information of a specific app version. Defaults to the latest version.
tcb app versions detail <serviceName> [options]
Parameters
| Parameter | Description | Default |
|---|---|---|
<serviceName> | App name (required) | — |
--version-name <name> | Version name (latest version if omitted) | — |
-e, --env-id <envId> | Environment ID | — |
Example
# View latest version details
tcb app versions detail my-app -e my-env-id
# View a specific version
tcb app versions detail my-app --version-name my-app-001 --env-id env-xxx
tcb app delete
Delete an app record. Does not delete the underlying app resource files.
tcb app delete <serviceName> [options]
Parameters
| Parameter | Description | Default |
|---|---|---|
<serviceName> | App name (required) | — |
-e, --env-id <envId> | Environment ID | — |
--dry-run | Preview the delete operation without executing | — |
Example
tcb app delete my-app -e my-env-id
# Preview delete (dry run)
tcb app delete my-app -e my-env-id --dry-run
This operation deletes all versions and resources of the app and is irreversible. Project resource files must be manually cleaned up in the static hosting bucket.