# WFDASH Migration Audit (2026-05-25) ## Current State - Legacy app: Django monolith in `/D:/NEWBUILD/WFDASH_django`. - New app: Next.js + PocketBase in `/D:/NEWBUILD/wfnextjs`. - Database direction: PocketBase collections already mirror core CRM entities. - Operations direction: workflow automation moving to n8n. ## Django Scope Found - 40+ model classes across modules, including: quotes, orders, driver_list, delivery_notes, stock, repairs, husqvarna service, POS, AI orders, reporting/portal modules. - Heavy background/process setup: Celery, Redis, email monitors, webhook integrations, debug middleware, multiple app copies/archives. - Hosting complexity indicators: - very broad `INSTALLED_APPS` - multiple legacy snapshots (`*_old`, date-stamped modules) - mixed concerns (UI, automation, integrations, monitoring) in one runtime. ## Next.js Scope Found - Strong foundation for CRM core modules (customers, companies, suppliers, quotes, orders). - PocketBase collection integration already implemented in UI helpers. - Missing before agent rollout: - dedicated server API layer - MCP-compatible tool gateway - migration governance docs and field naming standards. ## PocketBase Findings (from attached schema) Core collections present: - `customers`, `companies`, `suppliers`, `quotes`, `quote_items`, `orders`, `order_items`, `purchase_orders`. `order_items` already includes advanced lifecycle fields and driver/delivery states. Current mixed naming exists (`driver_status`) while new desired naming is `drv_*`. ## Recommended Migration Strategy 1. Freeze feature growth in Django except critical fixes. 2. Define "parity slices" by workflow, not by old apps. 3. Migrate in this order: 1. Quote to Order conversion lifecycle 2. Order item operations + driver loop 3. Purchase order + supplier communications 4. Monitoring and alerts via n8n 5. Optional legacy modules (repairs/POS/service) only if still needed 4. Keep PocketBase as source of truth for transactional state. 5. Move automations to n8n and keep Next.js API minimal and deterministic. ## Immediate Deliverables Added in This Repo - `/D:/NEWBUILD/wfnextjs/src/app/api/v1/*` REST starter routes for agents. - `/D:/NEWBUILD/wfnextjs/src/app/api/mcp/route.ts` MCP-style JSON-RPC gateway. - Normalizer accepting both `driver_status` and `drv_status` for transition safety.