Laizy CMS
CLI

CLI Reference

Every Laizy CLI command, flag, and option — from project setup to content management.

CLI Reference

The Laizy CLI provides a Prisma-like developer experience for managing your headless CMS. Every operation is a command, making it easy to automate with scripts or AI agents.

Installation

The CLI is included with the laizy-cms package:

pnpm add laizy-cms

Run commands with:

pnpm laizy <command>

Commands

laizy init

Initialize a new Laizy CMS project in the current directory.

pnpm laizy init

Creates:

  • ~/.laizyrc — Global configuration with API token
  • laizy/schema.laizy — Schema file for content models
  • .laizy/project.json — Local project context

Link the current directory to an existing Laizy project.

pnpm laizy link

Prompts you to select from your accessible projects and writes the project context to .laizy/project.json.

laizy sync

Sync your local schema with the database.

pnpm laizy sync              # Interactive sync with confirmations
pnpm laizy sync --dry-run    # Preview changes without applying
pnpm laizy sync --force      # Skip confirmation prompts

The sync command:

  1. Reads your local .laizy schema file
  2. Fetches the current schema from the database
  3. Computes a diff and generates a migration plan
  4. Shows impact analysis (safe, warning, or destructive changes)
  5. Asks for confirmation before applying
FlagDescription
--dry-runShow the migration plan without executing
--forceSkip confirmation prompts

laizy generate

Generate a TypeScript client from your synced schema.

pnpm laizy generate

Outputs three files to your configured output directory:

FileDescription
types.tsTypeScript interfaces for each content model
client.tsClient class with findMany(), findById(), count() methods
index.tsRe-exports for clean imports

laizy status

Show the current state of your schema in the cloud.

pnpm laizy status

Displays a table of all content models, their fields, and constraints.

laizy config

View your current CLI configuration.

pnpm laizy config

Shows your base URL, API token (masked), and project context.

laizy content create

Create content entries from the CLI.

# Pipe JSON from stdin
echo '{"title": "Hello", "content": "World", "slug": "hello"}' \
  | pnpm laizy content create BlogPost

# Pass JSON inline
pnpm laizy content create BlogPost --json '{"title": "Hello", "slug": "hello"}'
FlagDescription
--json <data>Content data as JSON string
--status <status>Set status: draft or published (default: draft)
--dry-runValidate without creating

laizy content list

List content entries for a model.

pnpm laizy content list BlogPost
pnpm laizy content list BlogPost --status published
pnpm laizy content list BlogPost --json    # JSON output for scripts
FlagDescription
--status <status>Filter by status
--jsonOutput as JSON (useful for piping)

laizy project list

List all projects accessible to your account.

pnpm laizy project list

laizy project info

Show details about the currently linked project.

pnpm laizy project info

laizy project create

Create a new project.

pnpm laizy project create

Prompts for project name and creates it in your current organization.

Remove the local project context.

pnpm laizy project unlink

Configuration

Global config (~/.laizyrc)

{
  "baseUrl": "https://laizycms.com",
  "apiToken": "laizy_eyJhbGciOiJI...",
  "schemaPath": "laizy/schema.laizy",
  "outputDir": "generated/laizy"
}

Local project context (.laizy/project.json)

{
  "projectId": "abc123",
  "projectName": "my-website"
}

This file is created by laizy init or laizy link and should be added to .gitignore if project context varies across team members.

On this page