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-cmsRun commands with:
pnpm laizy <command>Commands
laizy init
Initialize a new Laizy CMS project in the current directory.
pnpm laizy initCreates:
~/.laizyrc— Global configuration with API tokenlaizy/schema.laizy— Schema file for content models.laizy/project.json— Local project context
laizy link
Link the current directory to an existing Laizy project.
pnpm laizy linkPrompts 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 promptsThe sync command:
- Reads your local
.laizyschema file - Fetches the current schema from the database
- Computes a diff and generates a migration plan
- Shows impact analysis (safe, warning, or destructive changes)
- Asks for confirmation before applying
| Flag | Description |
|---|---|
--dry-run | Show the migration plan without executing |
--force | Skip confirmation prompts |
laizy generate
Generate a TypeScript client from your synced schema.
pnpm laizy generateOutputs three files to your configured output directory:
| File | Description |
|---|---|
types.ts | TypeScript interfaces for each content model |
client.ts | Client class with findMany(), findById(), count() methods |
index.ts | Re-exports for clean imports |
laizy status
Show the current state of your schema in the cloud.
pnpm laizy statusDisplays a table of all content models, their fields, and constraints.
laizy config
View your current CLI configuration.
pnpm laizy configShows 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"}'| Flag | Description |
|---|---|
--json <data> | Content data as JSON string |
--status <status> | Set status: draft or published (default: draft) |
--dry-run | Validate 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| Flag | Description |
|---|---|
--status <status> | Filter by status |
--json | Output as JSON (useful for piping) |
laizy project list
List all projects accessible to your account.
pnpm laizy project listlaizy project info
Show details about the currently linked project.
pnpm laizy project infolaizy project create
Create a new project.
pnpm laizy project createPrompts for project name and creates it in your current organization.
laizy project unlink
Remove the local project context.
pnpm laizy project unlinkConfiguration
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.