CLI REFERENCE

Two command-line tools: create-fabrk-app for scaffolding and fabrk for development workflows.

[CREATE-FABRK-APP]

Scaffold a new FABRK project with templates, Prisma schemas, configuration, and all FABRK packages pre-configured. Ships as an npm package.

usage
npx create-fabrk-app <project-name> [options]

Options:
  --template <name>    Template to use (basic, ai-saas, dashboard)
  --help               Show help

Examples:
  npx create-fabrk-app my-app
  npx create-fabrk-app my-saas --template ai-saas
  npx create-fabrk-app admin --template dashboard

TEMPLATES

[BASIC]
Clean starting point with @fabrk/core and optional @fabrk/design-system.
  • Prisma schema: User, Account, Session models
  • Minimal fabrk.config.ts with framework and theme sections
  • Home page with FABRK component imports
  • Good for: personal projects, learning FABRK
[AI-SAAS]
AI-powered SaaS with cost tracking, API keys, and streaming.
  • Adds @fabrk/ai, @fabrk/auth, @fabrk/config
  • Prisma schema: User, Account, Session, ApiKey, AICostLog, Subscription, CheckoutSession
  • Full config with AI budget, auth, and payments sections
  • Chat interface page with ChatInput, ChatMessageList
  • API key management with generateApiKey()
  • Good for: AI SaaS products, chatbots, API platforms
[DASHBOARD]
Admin dashboard with teams, feature flags, webhooks, and audit logging.
  • Full FABRK stack (all packages installed)
  • Prisma schema: User, Account, Session, Organization, OrgMember, FeatureFlag, AuditLog, Webhook, Job, Notification
  • Dashboard page with KPICard, BarChart, DataTable
  • Settings page with MFA, team management, notifications
  • Auto-wiring with StoreOverrides for Prisma stores
  • Good for: admin tools, internal dashboards, multi-tenant apps

WHAT GETS GENERATED

project structure (dashboard template)
my-app/
├── src/
│   └── app/
│       ├── layout.tsx           # Root layout with FabrkProvider
│       ├── page.tsx             # Landing page
│       ├── dashboard/
│       │   └── page.tsx         # Dashboard with KPIs, charts, tables
│       ├── settings/
│       │   └── page.tsx         # Settings: MFA, team, notifications
│       ├── api/
│       │   ├── webhooks/
│       │   │   └── stripe/
│       │   │       └── route.ts # Stripe webhook handler
│       │   └── keys/
│       │       └── route.ts     # API key CRUD
│       └── globals.css          # CSS variables + design tokens
├── src/lib/
│   └── fabrk.ts                 # autoWire() setup with stores
├── prisma/
│   └── schema.prisma            # Full schema with all models
├── fabrk.config.ts              # Complete FABRK config
├── package.json                 # All @fabrk/* packages
├── .env.example                 # Environment variable template
├── vite.config.ts               # Vite config with fabrk() plugin
└── tsconfig.json

[FABRK DEV CLI]

Development CLI for @fabrk/framework projects. Provides dev server, build, start, and project info commands. Run from your project root.

FABRK DEV

Start the Vite development server with FABRK tooling. Auto-discovers agents, tools, and prompts on startup.

fabrk dev [options]

Options:
  --port <number>    Port to use (default: 5173)
  --host             Expose to network

Examples:
  fabrk dev
  fabrk dev --port 4000

FABRK BUILD

Build the project for production. Runs Vite build for client and SSR bundles.

fabrk build

# Builds client + SSR bundles via Vite
# Also generates AGENTS.md for AI agent discovery

FABRK START

Start the production server with the built SSR bundle.

fabrk start [options]

Options:
  --port <number>    Port to use (default: 3000)

Examples:
  fabrk build && fabrk start
  fabrk start --port 8080

FABRK INFO

Display project information including discovered agents, tools, prompts, and active features.

fabrk info

Output:
  Project: my-app v0.3.1
  Runtime: vite
  Config:  fabrk.config.ts (valid)

  Agents:
    assistant    claude-sonnet-4-5  tools: [search-docs]

  Tools:
    search-docs  Search documentation

  Packages:
    @fabrk/framework    0.3.1
    @fabrk/components   0.3.1
    @fabrk/ai           0.3.1

  Features:
    teams:          enabled
    notifications:  enabled
    featureFlags:   enabled

[E2E TESTING]

The CLI package includes 53 end-to-end tests covering scaffolding, templates, file generation, and configuration validation. Tests verify that all templates produce valid, buildable projects.

run CLI tests
cd packages/cli
pnpm test

# 53 tests across scaffolding, generation, and validation
# Tests verify:
#   - All 3 templates scaffold correctly
#   - Generated files have correct imports
#   - fabrk.config.ts validates successfully
#   - Prisma schemas are valid
#   - package.json has correct dependencies