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.
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 dashboardTEMPLATES
@fabrk/core and optional @fabrk/design-system.- Prisma schema: User, Account, Session models
- Minimal
fabrk.config.tswith framework and theme sections - Home page with FABRK component imports
- Good for: personal projects, learning FABRK
- 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
- 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
StoreOverridesfor Prisma stores - Good for: admin tools, internal dashboards, multi-tenant apps
WHAT GETS GENERATED
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
├── tsconfig.json
└── next.config.js[FABRK DEV CLI]
Development CLI for FABRK projects. Provides dev server, build, lint, code generation, and project info commands. Run from your project root.
FABRK DEV
Start the Next.js development server with FABRK tooling. Validates your fabrk.config.ts on startup and reports any issues.
fabrk dev [options]
Options:
--port <number> Port to use (default: 3000)
--turbo Enable Turbopack for faster HMR
Examples:
fabrk dev
fabrk dev --port 4000
fabrk dev --turboFABRK BUILD
Build the project for production. Runs next build with FABRK optimizations.
fabrk build
# Equivalent to: next build
# Also validates fabrk.config.ts at build timeFABRK LINT
Check for FABRK design system compliance. Scans your source files for violations and reports them with suggestions.
fabrk lint [path]
Checks:
- Hardcoded colors (bg-blue-500, text-red-600, etc.)
- Hardcoded border-radius (rounded-lg, rounded-xl, etc.)
- Missing mode.radius on full borders
- Inline styles on components
- dangerouslySetInnerHTML usage
Fix suggestions:
bg-blue-500 → bg-primary
text-white → text-primary-foreground
rounded-lg → mode.radius
text-gray-500 → text-muted-foreground
Examples:
fabrk lint # Lint entire project
fabrk lint src/app/dashboard # Lint specific directory
fabrk lint src/components # Lint components folderFABRK GENERATE
Scaffold FABRK-compliant code with proper imports, design tokens, and terminal aesthetic already applied.
fabrk generate <type> <name>
Types:
component <Name> Generate a React component with design tokens
page <name> Generate a Next.js App Router page
api <name> Generate a Next.js API route handler
Examples:
fabrk generate component MetricsCard
fabrk generate component UserProfile
fabrk generate page settings
fabrk generate page dashboard/analytics
fabrk generate api webhooks
fabrk generate api users// fabrk generate component MetricsCard
// Creates: src/components/metrics-card.tsx
'use client'
import { cn } from '@fabrk/core'
import { mode } from '@fabrk/design-system'
import { Card } from '@fabrk/components'
interface MetricsCardProps {
title: string
children: React.ReactNode
className?: string
}
export function MetricsCard({ title, children, className }: MetricsCardProps) {
return (
<Card className={cn('border border-border p-4', mode.radius, className)}>
<h3 className={cn('text-xs font-bold text-muted-foreground uppercase mb-3', mode.font)}>
[{title}]
</h3>
{children}
</Card>
)
}FABRK INFO
Display project information including installed FABRK packages, config status, and active features.
fabrk info
Output:
Project: my-app v0.2.0
Runtime: nextjs
Config: fabrk.config.ts (valid)
Packages:
@fabrk/core 0.2.0
@fabrk/components 0.2.0
@fabrk/design-system 0.2.0
@fabrk/auth 0.2.0
@fabrk/payments 0.2.0
@fabrk/ai 0.2.0
Features:
teams: enabled
notifications: enabled
featureFlags: enabled
webhooks: enabled
jobs: 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.
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