zfb
GitHub repository

Type to search...

to open search from anywhere

CLI Reference

Created Jun 24, 2026Takeshi Takatsudo

Complete reference for the zfb command-line interface — subcommands, flags, and environment variables.

Overview

The zfb binary exposes five subcommands for the full development lifecycle:

zfb new    — scaffold a new project from a template
zfb dev    — local development server with live reload
zfb build  — production build
zfb preview — serve a previously built site
zfb check  — typecheck and validate content-collection schemas

Run zfb --help or zfb <subcommand> --help to see the generated help text directly.

zfb new

Scaffold a new project from a built-in template.

zfb new <name> [--template <template>]

Arguments

NameTypeRequiredDescription
namepositionalyesName of the new project. Used as the destination directory.
--templatestringnoTemplate to scaffold from. Default: basic-blog.

Templates

v0 ships a single template: basic-blog, baked into the binary at compile time from crates/zfb/templates/basic-blog/.

Example

zfb new my-site
zfb new my-site --template basic-blog

zfb dev

Start the local development server with live reload.

zfb dev [--port <port>] [--host [<host>]]

Flags

FlagTypeDefaultDescription
--portu163000*Port to bind the dev server to.
--hoststringlocalhost*Host interface to bind to. Bare --host (no value) is a shortcut for 0.0.0.0.

* Falls back through: CLI flag → port/host in zfb.config.json → built-in default.

Lazy rendering

The dev server defaults to lazy rendering: changed routes are marked stale and re-rendered on the first request rather than immediately on every file change. This keeps the inner loop fast for large sites.

To restore the pre-lazy behavior and re-render every affected route eagerly on each file change, set ZFB_DEV_EAGER=1.

Environment variables

VariableValuesDescription
ZFB_DEV_EAGER1Disable lazy dev rendering. Re-renders every affected route eagerly on each file change.
ZFB_LAZY_DEV_RENDER0 or 1Precise override of the lazy dev-render switch. 1 forces lazy; 0 forces eager. Takes precedence over ZFB_DEV_EAGER when both are set.

Example

# Default — binds localhost:3000
zfb dev

# Custom port
zfb dev --port 8080

# Expose to the LAN (0.0.0.0)
zfb dev --host

# Explicit host
zfb dev --host 192.168.1.10 --port 4321

zfb build

Build the project for production. Emits static HTML (and, when an adapter is configured, a server entry) to the output directory.

zfb build [--outdir <dir>]

Flags

FlagTypeDefaultDescription
--outdirpathdistOutput directory for the production build.

Example

zfb build
zfb build --outdir public

zfb preview

Serve a previously built site locally. Run zfb build first.

zfb preview [--port <port>] [--host [<host>]] [--outdir <dir>]

Flags

FlagTypeDefaultDescription
--portu164321*Port to bind the preview server to.
--hoststringlocalhost*Host interface to bind to. Bare --host (no value) is a shortcut for 0.0.0.0.
--outdirpathdistDirectory to serve the built artifacts from.

* Falls back through: CLI flag → port/host in zfb.config.json → built-in default.

Example

zfb build && zfb preview
zfb preview --port 8080
zfb preview --host --outdir public

zfb check

Typecheck the project and validate content-collection frontmatter against their schemas.

zfb check [--skip-tsc]

This command runs two checks:

  1. TypeScript — invokes tsc --noEmit as a subprocess. Catches type errors in zfb.config.ts, collection schemas, and src/.

  2. Collection schema validation — validates every collection entry's frontmatter against the JSON Schema declared in each collection's schema field in zfb.config.json/zfb.config.ts. The build itself does not validate frontmatter, so this is the enforcement gate.

Either failure mode exits with a non-zero code.

Flags

FlagTypeDefaultDescription
--skip-tscboolfalseSkip the tsc --noEmit subprocess. Schema validation still runs. Useful when TypeScript is not installed or for schema-only CI lanes.

Example

# Full check — tsc + schema validation
zfb check

# Schema-only (skip tsc)
zfb check --skip-tsc

Tip

zfb check is the recommended way to validate content collections in CI. Wire it after zfb build to catch frontmatter violations that the build silently ignores.

Environment variables

The following environment variables affect zfb globally (not specific to one subcommand):

VariableDefaultDescription
ZFB_DEV_EAGERunsetSet to 1 to disable lazy dev rendering in zfb dev. Re-renders every affected route eagerly on each file change.
ZFB_LAZY_DEV_RENDERunsetSet to 0 or 1 for precise control over the lazy dev-render switch. Takes precedence over ZFB_DEV_EAGER when both are set.
ZFB_PLUGIN_HOOK_TIMEOUT120 (seconds)Maximum time (in seconds) any single plugin hook reply is awaited before the plugin host is force-killed and the build fails. Precedence: pluginHookTimeoutSecs in config > this env var > 120s built-in default.

Note

ZFB_PLUGIN_HOOK_TIMEOUT can also be set via pluginHookTimeoutSecs in defineConfig. The config field takes precedence over the environment variable.

Revision History

Takeshi TakatsudoCreated: 2026-06-25T05:17:25+09:00Updated: 2026-06-25T05:17:25+09:00

AI Assistant

Ask a question about the documentation.