Seeding a New Stack with CLI
This guide demonstrates how to create a new stack in Contentstack and seed it with content from a GitHub repository using the Contentstack Command-Line Interface (CLI).
Prerequisites
Ensure you have the following before starting:
- A Contentstack account with English set as the master language.
- Terminal access with a package manager installed (e.g., npm).
- Knowledge of the region hosting your Contentstack instance (AWS, Azure, or Google Cloud; US or Europe).
- Your Contentstack organization UID.
Installing the Contentstack CLI
You can install the CLI globally or run it directly using npx:
npm install -g @contentstack/cli
Or run directly without global install
npx @contentstack/cli
Configuring the CLI
Step 1: Set Your Region
Configure the CLI with the hosting region:
csdx config:set:region
Select your region (e.g., AWS Europe).
Step 2: Authentication
Log into Contentstack with your email and password:
csdx auth:login
Alternatively, you can store management tokens for persistent authentication. Check the official documentation for more details.
Creating and Seeding a Stack
Use the stack seed command to import content from a GitHub repository:
csdx stack:seed --repo github-repository-url --org organization-uid --stack new-stack-name
Replace placeholders:
- <GitHub-Repository-URL>: URL of the GitHub repository containing your seed content.
- <Organization-UID>: Your Contentstack organization UID.
- <New-Stack-Name>: Name for your new stack.
Execute the command to create and seed your stack.
Verify Stack Creation
After the import completes, log in to your Contentstack account to inspect and verify the newly created stack.