System Architecture & Monorepo Overview
Wunderkint AI CRM (wk-crm) is structured as a high-performance pnpm monorepo managed by Turborepo.
Monorepo Layout
Section titled “Monorepo Layout”wk-crm/├── apps/│ ├── web/ # Next.js 16 App Router frontend + tRPC API backend│ ├── docs/ # Starlight (Astro) documentation site│ ├── storybook/ # Storybook 8 component workbench for @wk-crm/ui│ └── whatsapp-bridge/ # Standalone WhatsApp webhooks & real-time socket bridge├── packages/│ └── ui/ # @wk-crm/ui shared Radix components & Neobrutalism theme├── db/│ └── drizzle/ # Drizzle migration files and schema definitionsBackend & Query Layer
Section titled “Backend & Query Layer”- ORM: Drizzle ORM connecting to Neon PostgreSQL.
- Schemas: 26 modular schema files located in
apps/web/lib/db/schema/. - API Layer: 28 tRPC routers located in
apps/web/lib/trpc/routers/handling type-safe RPC procedure execution.
AI Agent Infrastructure
Section titled “AI Agent Infrastructure”AI agents utilize Google Gemini via custom workflow orchestrators in apps/web/lib/ai/. All agents interface through dedicated REST endpoints under /api/ai/*.
Build & Quality Commands
Section titled “Build & Quality Commands”# Run local development server for main apppnpm dev
# Run documentation site locallypnpm docs:dev
# Run full project type checkpnpm type-check
# Build documentation sitepnpm docs:build