→Monorepo — Turborepo + Bun workspaces orchestrating 5 apps and 4 shared packages (@wheelbase/ui, /utils, /types, /config) with subpath exports for tree-shakeable type imports.
→Frontend (Main App) — Next.js 16 App Router, React 19, TypeScript, tRPC for end-to-end type-safe API layer (20+ routers, 150+ procedures), TanStack Query for server state with optimistic updates, Zustand for global state, Shadcn/ui component library.
→Go VIN Decoder — Gin HTTP framework with a self-contained VIN decoder backed by a ~2GB local SQLite database (NHTSA data, ~1.6M pattern rows, ~8.7M valid-character rows). Decoding pipeline: extract model year from position 10 with 30-year cycle logic, WMI lookup for manufacturer/make, multi-pass VDS pattern matching (positions 4–8) to decode body style, engine, drive type, and model. In-memory caches, custom pattern parser (no regex), check-digit validation, auto-correction for single-character errors, and ranked candidate resolution.
→Go Runlist Upload — Streaming CSV processing with constant memory usage (csv.Reader row-by-row, not ReadAll), dynamic column-to-field mapping via ImportFlow configurations fetched from Supabase, client-side UUID generation for batching, 500-record batch inserts with atomic-like guarantees — if RunlistCar link insertion fails, the service auto-deletes the just-inserted cars to prevent orphaned records. Strict JSON structure enforcement (no omitempty) to satisfy PostgREST bulk insert requirements.
→AI System — Natural language → DSL query builder with tenant-scoped execution, risk classification for write operations (low/high), approval token workflow for destructive actions, context document versioning with draft/publish, streaming chat via OpenRouter proxy, and full query/write telemetry.
→Real-time Collaboration (Vault) — TipTap editor with extensions (code blocks, tables, task lists, KaTeX math, Mermaid diagrams), Yjs CRDT for conflict-free concurrent editing, Supabase Realtime as transport layer, 2-second debounced auto-save, version history with restore.
→Multi-Tenancy & Security — PostgreSQL Row-Level Security on all tables, tenant isolation via tenant_id scoping, role-based access control, tenant/dealership switching via cookies + API routes, custom feature preferences per tenant.
→Database — 30+ PostgreSQL tables across inventory, auctions, reconditioning, workflow, AI, document vault, and demand insights domains — with audit trails (status history tables), JSONB fields, and Supabase Edge Functions.
→Infrastructure — Docker Compose for multi-service deployment (frontend, landing, backend), multi-stage Go build with CGO for SQLite, MinIO object storage for the VIN database (~2GB, downloaded on container startup), Remotion for programmatic video generation.