Docs

BCMS CLI

Install and use the BCMS CLI to create projects, log in, and pull types, entries, and media from your instance.

The BCMS CLI (@thebcms/cli) helps you create projects from starters, log in to your BCMS account, and pull types, entries, and media to your local machine.

Install

Install globally:

npm i -g @thebcms/cli

Or add it to a project:

npm i @thebcms/cli

List available commands:

bcms help

Login

Most commands need a logged-in BCMS account. Login opens a browser magic-link flow and stores credentials under ~/.bcms.

bcms login
bcms logout

Create a project

Scaffold a starter and create a matching BCMS instance. Supported frameworks: next, nuxt, gatsby, svelte, astro.

bcms create next
bcms create nuxt --project-name my-site --starter blog

If you omit flags, the CLI prompts for project name, framework, and starter. It clones from the BCMS starters repo, creates an instance, generates API keys, and writes a .env file.

Pull data

Pull content and generated types from an instance into your project:

bcms pull types
bcms pull types --language ts
bcms pull entries
bcms pull media
bcms pull types,entries,media

Useful options:

  • --output / --out: output directory (defaults: bcms/types, bcms/entries, bcms/media)

  • --language / --lng: type language (ts or gql)

  • --instance-id / --iid: skip the instance picker

API key auth (no browser login)

For CI or local scripts, authenticate with an API key instead of bcms login. See Working with API keys.

Option 1: environment variable

export BCMS_API_KEY="keyId.secret.instanceId"
bcms pull types --language ts

Option 2: bcms.config.js / bcms.config.cjs / bcms.config.mjs in the project root:

module.exports = {
  client: {
    // origin: 'https://app.thebcms.com',
    apiKey: process.env.BCMS_API_KEY,
  },
};

Common flags

  • --api-origin: API origin (default https://app.thebcms.com)

  • --verbose: print verbose errors

  • --version / -v: print the installed CLI version