GuidesCLI guide

CLI setup

The PWFabric CLI lets you create, develop, validate, and publish surfaces from your terminal.

1. Install the CLI

Install the CLI globally using pnpm:

pnpm add -g @pwfabric/cli
 
# Verify installation
pwfabric --version

2. Authenticate

Log in with your PWFabric account. This opens a browser window for OAuth2 authentication:

pwfabric login
 
# After authenticating, verify your identity
pwfabric whoami
# → Logged in as alice@example.com (world: my-team)

3. Create a project

Scaffold a new surface project from a template:

pwfabric create my-landing-page
 
# Choose a starter template:
#   ❯ Blank Surface
#     Landing Page
#     Portfolio
#     Blog
#     E-commerce
 
cd my-landing-page

4. Start development

Start the local development server with hot-reload:

pwfabric dev
 
# → Local:   http://localhost:3000
# → Studio:  http://localhost:3000/studio
# → API:     http://localhost:4000/health

5. Validate & publish

Validate your surface schema and publish when ready:

# Validate surface JSON against the schema
pwfabric schema:validate
 
# Publish to your World
pwfabric publish
 
# → Published my-landing-page v1.0.0
# → Live at: https://my-team.phiwebs.com/my-landing-page

Command reference

CommandDescription
pwfabric loginAuthenticate via OAuth2 browser flow
pwfabric logoutClear stored credentials
pwfabric whoamiShow current user and World
pwfabric create <name>Scaffold a new project from template
pwfabric devStart local dev server with hot-reload
pwfabric schema:validateValidate surface JSON schema
pwfabric schema:generateGenerate TypeScript types from schema
pwfabric schema:migrateRun schema migrations
pwfabric publishPublish surface to your World
pwfabric world:listList available Worlds
pwfabric world:switch <id>Switch active World context

Next steps

  • Quick start — Build your first surface in 5 minutes.
  • Custom blocks — Create your own block types with defineBlock().