Skip to main content

App Deployment

v3.0.0+

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).

Best for: Frontend Projects with Build Pipelines

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

ParameterDescriptionDefault
[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, --forceSkip 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:

FieldDescriptionDefault
serviceNameService namepackage.json name or directory name
rootProject root directory (relative path), for monorepo scenariosCurrent directory
frameworkFramework type: react / vue / vite / next / nuxt / angular / staticAuto-detect
installCommandInstall command, empty string to skip installnpm install
buildCommandBuild command, empty string to skip buildAuto-detect based on framework
outputDirBuild output directory./dist (./ when no build command)
deployPathDeployment path (static hosting mount path)/${serviceName}
envVariablesEnvironment variables, key-value pairs, injected during cloud build
ignoreGlob 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., envVariables has no CLI parameter, buildCommand has framework defaults), see the table below for details.

Priority for each parameter:

ParameterPriority
serviceNameCLI 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})
envVariablesOnly read from cloudbaserc.json (no CLI parameter)

Special Notes:

  • Both --cwd and config.app.root specify the project working directory; --cwd has higher priority
  • envVariables has no corresponding CLI parameter; can only be configured in cloudbaserc.json
  • When --yes or --json is 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

ParameterDescriptionDefault
-e, --env-id <envId>Environment ID
-l, --limit <n>Number of results20
-o, --offset <n>Offset0
--jsonOutput 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

ParameterDescriptionDefault
<serviceName>App name (required)
-l, --limit <n>Number of results20
-o, --offset <n>Offset0
-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

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

ParameterDescriptionDefault
<serviceName>App name (required)
-e, --env-id <envId>Environment ID
--dry-runPreview 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
Warning

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.