Launch is a deployment platform that enables you to host your Contentstack-powered JAM stack website instantly. Launch hosts websites managed by any CMS (headless or traditional).
You can create a project in Launch by connecting your GitHub repository—Launch deploys your site instantly. Alternatively, you can upload a folder or .zip file to create a project.
This step-by-step guide discusses how you can perform different operations in Launch using the CLI.
Note: This prerequisite is applicable only if you are importing a project via GitHub.
Contentstack Launch lets you perform the following operations in Contentstack CLI:
To begin with, create a project in Launch using the CLI by importing a project from GitHub or uploading a file. To do this, follow the steps given below:
csdx launch
csdx launch --data-dir <path>
Note: If you choose GitHub to create your project, provide the directory path in the Git repository as the current working directory path.
Note: Launch automatically identifies Git projects.

Use this option to import environment variables directly from an existing stack in your organization.
If selected, you’ll be prompted to choose a specific Stack and provide a valid Delivery Token.
You can manually add variables as key-value pairs.
If selected, after adding key-value pairs, a prompt, Would you like to add more variables.? appears.
You can import variables from a .env.local file.
Note: Create a .env.local file in the repo to import variables from your .env.local file. In this file, each key-value pair must be on a separate line using the format KEY=VALUE.
Allows you to skip these options and create a project without any environment variables.
Note: The 'Skip adding environment variables' option cannot be combined with other environment variable options. You can either choose 'Skip adding environment variables' or one or more of the other available options.
You have successfully deployed a Launch project using the CLI.
Usage
csdx launch
Options
Examples
csdx launch --config <path to launch config file> --type <options: GitHub|FileUpload>csdx launch --data-dir <path of current working dir> --type <options: GitHub|FileUpload>csdx launch --config <path to launch config file> --type <options: GitHub|FileUpload> --name=<value> --environment=<value> --branch=<value> --build-command=<value> --framework=<option> --org=<value> --out-dir=<value> --server-command=<value>csdx launch --config <path to launch config file> --type <options: GitHub|FileUpload> --name=<value> --environment=<value> --branch=<value> --build-command=<value> --framework=<option> --org=<value> --out-dir=<value> --variable-type="Import variables from a stack" --alias=<value>csdx launch --config <path to launch config file> --type <options: GitHub|FileUpload> --name=<value> --environment=<value> --branch=<value> --build-command=<value> --framework=<option> --org=<value> --out-dir=<value> --variable-type="Manually add custom variables to the list" --env-variables="APP_ENV:prod, TEST_ENV:testVal"Note: If multiple branches are identified in the configuration, you will be prompted to Choose a branch to proceed with the Launch operations. A single config file can have multiple configurations based on the branch.
To redeploy or re-initialize an existing project, run the launch command using the project’s directory path or execute it from the current working directory.
Usage
If the cs-launch.json file is present, then run the following command to redeploy from the current working directory:
csdx launch
If you are using GitHub projects, after running the command, you will see a prompt as shown in the screenshot below:
If you are using the File Upload projects, after running the command, you will see a prompt as shown in the screenshot below:
You will be prompted to select a redeployment method, as shown in the screenshot below:
Your project will be redeployed.
Options
Examples
csdx launch --data-dir <project-directory-path>
csdx launch --environment <environment name or UID>csdx launch --redeploy-latest
csdx launch --redeploy-latest
csdx launch --redeploy-last-upload
csdx launch --data-dir=/root/src/project1 --redeploy-latest
--config=/root/configs/project1/dev.jsonThe Launch CLI can be utilized within CI environments to trigger redeployments for Launch projects. Follow the steps below to configure and use Launch CLI in your CI pipeline.
{
"project": {
"uid": "<projectUid>",
"name": "<projectName>",
"projectType": "GITHUB", // (Or FILEUPLOAD if it's a FILEUPLOAD-based project)
"organizationUid": "<organizationUid>",
"environments": [
{
"uid": "<environmentUid>",
"name": "<environmentName>",
"frameworkPreset": "OTHER" // Possible values: GATSBY, NEXTJS, CRA, CSR, ANGULAR, VUEJS, OTHER
}
],
"deployments": [
{
"uid": "<deploymentUid of latest or any previous deployment belonging to the particular environment>"
}
]
}
}You can find the values for projectUid, environmentUid, organizationUid, and deploymentUid by inspecting the network requests made to your deployed site. These values are available in the response headers:
Commit the cs-launch.json file to your repository.
Use the following steps to trigger a redeployment using the Launch CLI within your CI environment:
Configure the CLI to use the appropriate region.
Example: csdx config:set:region NA
Use the csdx auth:login command to log in.
Example: csdx auth:login --username youremail@contentstack.com --password *****
Use the following command to redeploy a specific environment:
Example: csdx launch -c /path/to/project/launch-cli-config/cs-launch.json -e development --redeploy-latest
Note: The Launch CLI exits with a non-zero status code if the deployment fails. Ensure your CI pipeline is configured to handle this appropriately.
By following these steps, you can seamlessly integrate Launch redeployments into your CI/CD pipeline, enhancing automation and deployment efficiency.
You can fetch the previous deployment logs and the latest server logs for Launch projects in CLI using the launch:logs command.
csdx launch:logsUsage
csdx launch:logsOptions
Note: If you do not pass a deployment ID, by default Launch fetches the latest deployment logs.
Examples
csdx launch:logs -e "environment number or uid" --type "types of flags"csdx launch:logs -e "environment number or uid" --deployment "deployment number or uid"You can test your Launch project Cloud Functions locally using the launch:functions command in CLI.
Usage
csdx launch:functionsOptions
Examples
csdx launch:functionscsdx launch:functions -p "port number"You can display the list of deployments for an environment for Launch projects using the launch:deployments command in CLI.
csdx launch:deploymentsYou have successfully listed the deployments for the selected environment.
Usage
csdx launch:deploymentsOptions
Examples
csdx launch:deployments -d "current working directory"csdx launch:deployments -e "environment number or uid"You can display the list of environments that are available for a particular project using the launch:environments command in CLI.
csdx launch:environmentsYou have successfully listed the environments for the selected project.
Usage
csdx launch:environmentsOptions
Examples
csdx launch:environments -d "current working directory"csdx launch:environments --org=<org UID> --project=<Project UID>You can open the live site for an environment of your Launch projects using the launch:open command in CLI.
csdx launch:openYou have successfully opened the live site for the selected environment.
Usage
csdx launch:openOptions
Examples
csdx launch:open --environment=environment --data-dir <path/of/current/working/dir>csdx launch:open --environment=environment --config <path/to/launch/config/file>