PACKAGES

12 modular packages covering every aspect of full-stack development. Install only what you need.

[DEPENDENCY ARCHITECTURE]

Dependencies flow from foundational packages outward. Install only the packages you need — each is independently versioned and published to npm.

dependency flow
@fabrk/config (foundational — Zod schemas, no deps)
@fabrk/design-system (foundational — themes, no deps)
    |
    v
@fabrk/core (depends on config, design-system)
    |
    v
@fabrk/payments, @fabrk/auth, @fabrk/email,
@fabrk/storage, @fabrk/security (depend on core)
    |
    v
@fabrk/ai (depends on core)
@fabrk/components (depends on core, design-system)
@fabrk/store-prisma (depends on core)
    |
    v
Templates & Examples (depend on all packages)

[ALL PACKAGES]

[@fabrk/config]

Type-safe configuration builder with Zod validation. 12 config sections covering every feature. Foundational package with zero dependencies.

install
pnpm add @fabrk/config
EXPORTS
  • >defineFabrkConfig() — Main config builder with autocomplete
  • >fabrkConfigSchema — Complete Zod schema for validation
  • >Individual schemas: frameworkConfigSchema, themeConfigSchema, aiConfigSchema, etc.
  • >Types: FabrkConfig, FabrkConfigInput, FrameworkConfig, ThemeConfig, AIConfig
  • >PaymentsConfig, AuthConfig, EmailConfig, StorageConfig, SecurityConfig
example
import { defineFabrkConfig } from '@fabrk/config'

export default defineFabrkConfig({
  framework: { runtime: 'nextjs', typescript: true, srcDir: 'src' },
  theme: { system: 'terminal', colorScheme: 'green', radius: 'sharp' },
  ai: { costTracking: true, budget: { daily: 50 } },
  notifications: { enabled: true },
  teams: { enabled: true, maxMembers: 50 },
})

[@fabrk/design-system]

Foundational design system with 18 themes. Design tokens, CSS variables, and the mode system. Runtime-dynamic theme switching. Zero dependencies.

install
pnpm add @fabrk/design-system
EXPORTS
  • >mode — Design mode object (radius, font, shadow, color, spacing, typography)
  • >themes — All 18 built-in themes
  • >designTokens — Semantic color tokens (bg-primary, text-foreground, etc.)
  • >primitives — Raw token values (colors, space, fonts)
  • >applyTheme() — Runtime theme switching via CSS variables
  • >getThemeNames() — List all available themes
  • >ThemeProvider, useThemeContext(), ThemeScript — Theme context & SSR
  • >Chart colors: getChartColors(), getChartColor()
  • >Formatters: formatButtonText(), formatLabelText(), formatCardHeader()
example
import { mode } from '@fabrk/design-system'

// mode.radius        — border radius class (e.g., 'rounded-dynamic')
// mode.font          — font family class (e.g., 'font-body')
// mode.textTransform — text casing ('uppercase' | 'normal')

// Full borders ALWAYS get mode.radius
<Card className={cn("border border-border", mode.radius)}>

// Partial borders NEVER get mode.radius
<div className="border-t border-border">

[@fabrk/core]

Framework runtime — plugin system, hooks, providers, middleware, feature managers, auto-wiring, and validation. Depends on config and design-system.

install
pnpm add @fabrk/core
EXPORTS
  • >createFabrk() / initFabrk() — Initialize framework runtime
  • >autoWire(config, adapters?, stores?) — Create adapters from config
  • >applyDevDefaults(config) — Apply zero-config dev defaults
  • >FabrkProvider — React context provider
  • >useTeam(), useNotifications(), useFeatureFlag() — Feature hooks
  • >useWebhooks(), useJobs() — System hooks
  • >createNotificationManager(), createTeamManager() — Feature managers
  • >createFeatureFlagManager(), createWebhookManager(), createJobQueue()
  • >InMemoryTeamStore, InMemoryNotificationStore, InMemoryFlagStore
  • >Middleware presets: auth, rateLimit, cors, csrf
  • >Validation: checkHardcodedColors(), validateFile(), generateReport()
  • >cn() — Tailwind class merge utility
  • >StoreOverrides type — Inject Prisma stores into autoWire()
example
import { autoWire, applyDevDefaults, cn } from '@fabrk/core'
import config from '../fabrk.config'

// Auto-wire all adapters from config
const fabrk = autoWire(applyDevDefaults(config))

// Use hooks in components
function Dashboard() {
  const { enabled, manager } = useTeam()
  const { enabled: showBeta } = useFeatureFlag('beta-ui')
  if (showBeta) return <BetaDashboard />
  return <StandardDashboard />
}

[@fabrk/components]

105+ pre-built UI components with terminal aesthetic. Forms, charts, data display, AI chat, admin, security, organization, feedback, SEO, and more.

install
pnpm add @fabrk/components
EXPORTS
  • >Forms: Button, Input, InputGroup, InputNumber, InputOTP, InputPassword, InputSearch, Textarea, Select, Checkbox, RadioGroup, Switch, Slider, DatePicker, Calendar, Form, Label
  • >Layout: Card, Container, Separator, ScrollArea, Sidebar, Tabs, StyledTabs, Accordion
  • >Charts: BarChart, LineChart, AreaChart, PieChart, DonutChart, FunnelChart, Gauge, Sparkline
  • >Data: DataTable, Table, KPICard, StatCard, Badge, Tag, Avatar, Heatmap, JSONViewer, Pagination, EmptyState, Breadcrumb
  • >Feedback: Alert, AlertDialog, Dialog, Sheet, Toaster, Loading, TerminalSpinner, Progress, AsciiProgressBar, StatusPulse, Typewriter, StarRating, NPSSurvey, FeedbackWidget, ErrorBoundary
  • >Navigation: Command, DropdownMenu, Popover, Tooltip, SegmentedControl
  • >AI: ChatInput, ChatMessageList, ChatSidebar, TokenCounter, UsageBar, LogStream
  • >Admin: AuditLog, AdminMetricsCard, SystemHealthWidget, NotificationCenter, NotificationBadge, NotificationList
  • >Security: MfaCard, MfaSetupDialog, BackupCodesModal, CookieConsent
  • >Org: OrgSwitcher, MemberCard, TeamActivityFeed
  • >Marketing: PricingCard, UpgradeCTA, OnboardingChecklist, SchemaScript, SimpleIcon
example
import {
  Button, Card, Badge, KPICard, BarChart,
  DataTable, ChatInput, MfaCard, PricingCard
} from '@fabrk/components'
import { cn } from '@fabrk/core'
import { mode } from '@fabrk/design-system'

function MetricsPage() {
  return (
    <div className="grid gap-4">
      <KPICard title="REVENUE" value="$12,340" trend={12.5} />
      <Card className={cn("p-4 border border-border", mode.radius)}>
        <BarChart data={chartData} />
      </Card>
      <Badge variant="default">[ACTIVE]</Badge>
      <Button>> VIEW DETAILS</Button>
    </div>
  )
}

[@fabrk/ai]

AI toolkit — LLM providers, cost tracking with stores, embeddings, streaming, prompt management, content moderation, and testing utilities.

install
pnpm add @fabrk/ai
EXPORTS
  • >LLM: getLLMClient(), OpenAIClient, AnthropicClient, OllamaClient
  • >Chat: chatWithOpenAI(), chatWithClaude(), chat()
  • >Cost: AICostTracker, InMemoryCostStore, MODEL_PRICING, CostStore interface
  • >Embeddings: getEmbeddingProvider(), cosineSimilarity(), findNearest()
  • >Streaming: parseStreamChunks(), createTextStream(), concatStreams()
  • >Prompts: PromptBuilder, createPromptTemplate(), composePrompts()
  • >Content: moderateContent(), generateImage(), textToSpeech(), speechToText()
example
import { getLLMClient, AICostTracker, InMemoryCostStore } from '@fabrk/ai'

const client = getLLMClient({ provider: 'anthropic', model: 'claude-sonnet-4-5-20250514' })
const tracker = new AICostTracker(new InMemoryCostStore())

const response = await client.chat([
  { role: 'user', content: 'Explain quantum computing in 3 sentences.' },
])

// Track cost automatically
await tracker.track({
  userId: 'user_123', model: 'claude-sonnet-4-5-20250514',
  provider: 'anthropic', inputTokens: 12, outputTokens: 85, feature: 'chat',
})

[@fabrk/payments]

Payment adapters for Stripe, Polar, and Lemon Squeezy. Provider-agnostic interface for checkout, webhooks, customer management, and subscriptions.

install
pnpm add @fabrk/payments
EXPORTS
  • >StripePaymentAdapter — Checkout, webhooks, customer management
  • >PolarPaymentAdapter — Polar.sh integration
  • >LemonSqueezyPaymentAdapter — Lemon Squeezy integration
  • >InMemoryPaymentStore — Dev/testing store
  • >Types: PaymentStore, CheckoutOptions, CheckoutResult, SubscriptionStatus
example
import { StripePaymentAdapter } from '@fabrk/payments'

const payments = new StripePaymentAdapter({
  secretKey: process.env.STRIPE_SECRET_KEY!,
})

// Create a checkout session
const checkout = await payments.createCheckout({
  priceId: 'price_xxx',
  customerId: user.stripeCustomerId,
  successUrl: '/success',
  cancelUrl: '/cancel',
})

// Handle webhooks
const event = await payments.handleWebhook(body, signature)

[@fabrk/auth]

Authentication — NextAuth adapter with real session retrieval, API keys (SHA-256 hashed, fabrk_ prefix), MFA (TOTP RFC 6238 + backup codes).

install
pnpm add @fabrk/auth
EXPORTS
  • >NextAuthAdapter — Session management with authInstance config
  • >API Keys: generateApiKey(), hashApiKey(), validateApiKey()
  • >MFA: generateTOTP(), verifyTOTP(), generateBackupCodes(), verifyBackupCode()
  • >Middleware: authMiddleware()
  • >InMemoryAuthStore — Dev/testing store
  • >Types: AuthStore, ApiKeyRecord, TOTPSecret
example
import { generateApiKey, hashApiKey, verifyTOTP } from '@fabrk/auth'

// Generate API key (fabrk_live_xxx format)
const { key, hash } = await generateApiKey('live')
// key = "fabrk_live_a1b2c3..." (show to user once)
// hash = "sha256:..." (store in database)

// Validate API key from request
const isValid = await validateApiKey(requestKey, storedHash)

// Verify MFA TOTP token
const valid = verifyTOTP(token, secret)  // RFC 6238 compliant

[@fabrk/email]

Email delivery with Resend adapter and console adapter for development. 4 built-in templates: verification, reset, welcome, invite.

install
pnpm add @fabrk/email
EXPORTS
  • >ResendEmailAdapter — Production email delivery via Resend API
  • >ConsoleEmailAdapter — Dev mode (logs to terminal instead of sending)
  • >Templates: verification, reset, welcome, invite
  • >Types: EmailAdapter, EmailOptions, EmailTemplate
example
import { ResendEmailAdapter, ConsoleEmailAdapter } from '@fabrk/email'

// Production
const email = new ResendEmailAdapter({
  apiKey: process.env.RESEND_API_KEY!,
  from: 'noreply@yourdomain.com',
})

// Development (logs to terminal)
const devEmail = new ConsoleEmailAdapter()

// Send a template
await email.sendTemplate('welcome', {
  to: 'user@example.com',
  data: { name: 'Jason', loginUrl: 'https://app.example.com' },
})

[@fabrk/storage]

File storage — S3, Cloudflare R2 (S3-compatible), and local filesystem adapters. File validation and signed URL generation.

install
pnpm add @fabrk/storage
EXPORTS
  • >S3StorageAdapter — AWS S3 uploads and signed URLs
  • >R2StorageAdapter — Cloudflare R2 (S3-compatible API)
  • >LocalStorageAdapter — Filesystem storage for development
  • >File validation: validateFileSize(), validateFileType()
  • >Signed URL generation for secure downloads
  • >Types: StorageAdapter, UploadOptions, StorageResult
example
import { S3StorageAdapter, LocalStorageAdapter } from '@fabrk/storage'

// Production: S3
const storage = new S3StorageAdapter({
  bucket: process.env.S3_BUCKET!,
  region: 'us-east-1',
})

// Development: local filesystem
const devStorage = new LocalStorageAdapter({ basePath: './uploads' })

// Upload a file
const url = await storage.upload(file, {
  path: 'uploads/',
  maxSize: 10 * 1024 * 1024, // 10MB
})

// Generate signed download URL
const signedUrl = await storage.getSignedUrl(key, { expiresIn: 3600 })

[@fabrk/security]

Security — CSRF tokens, CSP headers, rate limiting (in-memory + Upstash), audit logging with tamper-proof hashing, GDPR helpers, bot protection, CORS.

install
pnpm add @fabrk/security
EXPORTS
  • >CSRF: generateCsrfToken(), verifyCsrfToken()
  • >CSP: generateNonce(), buildCSP()
  • >Rate limiting: MemoryRateLimiter, UpstashRateLimiter
  • >Audit: AuditLogger with tamper-proof chain hashing
  • >GDPR: compliance helpers, data export, data deletion
  • >Bot protection: detectBot(), challengeBot()
  • >CORS: configureCors(), CorsOptions
  • >Security headers: applySecurityHeaders()
example
import {
  generateCsrfToken, AuditLogger, MemoryRateLimiter
} from '@fabrk/security'

// CSRF protection
const csrf = generateCsrfToken()

// Rate limiting (100 requests per minute)
const limiter = new MemoryRateLimiter({ max: 100, window: '1m' })
const allowed = await limiter.check(ip)

// Tamper-proof audit logging
const audit = new AuditLogger()
await audit.log({
  action: 'user.login',
  userId: 'user_123',
  ip: '192.168.1.1',
  metadata: { method: 'oauth', provider: 'google' },
})

[@fabrk/store-prisma]

7 Prisma store adapters that implement core store interfaces. Connects FABRK features to a real PostgreSQL database via Prisma ORM.

install
pnpm add @fabrk/store-prisma
EXPORTS
  • >PrismaTeamStore — Team/org CRUD with member management
  • >PrismaApiKeyStore — API key storage and validation
  • >PrismaAuditStore — Tamper-proof audit log persistence
  • >PrismaNotificationStore — Notification CRUD and read status
  • >PrismaJobStore — Job queue persistence and status tracking
  • >PrismaWebhookStore — Webhook endpoint management
  • >PrismaFeatureFlagStore — Feature flag CRUD and evaluation
  • >Example Prisma schema included in package
example
import {
  PrismaTeamStore, PrismaAuditStore,
  PrismaApiKeyStore, PrismaFeatureFlagStore
} from '@fabrk/store-prisma'
import { autoWire } from '@fabrk/core'
import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

// Inject Prisma stores via StoreOverrides
const fabrk = autoWire(config, undefined, {
  teamStore: new PrismaTeamStore(prisma),
  auditStore: new PrismaAuditStore(prisma),
  apiKeyStore: new PrismaApiKeyStore(prisma),
  featureFlagStore: new PrismaFeatureFlagStore(prisma),
})