# CRM Routing Map

**Date:** 2026-07-26  
**Pattern:** Thin `app/crm/**/page.tsx` → `modules/crm/features/**`

## Root

| Route | File | Module export |
|-------|------|---------------|
| `/crm` | — | Redirect via hub link |
| `/crm/hub` | `app/crm/hub/page.tsx` | `CrmHub` from `pages/hub` |

## Sales portal layout

`app/crm/sales/layout.tsx` → `createPortalLayout("sales")`

## Sales routes

| URL | Feature module |
|-----|----------------|
| `/crm/sales/dashboard/overview` | `features/sales/dashboards` → `OverviewDashboard` |
| `/crm/sales/dashboard/sales` | `SalesDashboard` |
| `/crm/sales/dashboard/pipeline` | `PipelineDashboard` |
| `/crm/sales/dashboard/leads` | `LeadDashboard` |
| `/crm/sales/dashboard/activities` | `ActivityDashboard` |
| `/crm/sales/dashboard/calendar` | `CalendarDashboard` |
| `/crm/sales/customers` | `features/sales/customers` |
| `/crm/sales/companies` | `features/sales/companies` |
| `/crm/sales/contacts` | `features/sales/contacts` |
| `/crm/sales/leads` | `features/sales/leads` |
| `/crm/sales/deals` | `features/sales/deals` |
| `/crm/sales/kanban` | `features/sales/kanban` |
| `/crm/sales/pipelines` | `features/sales/pipelines` |
| `/crm/sales/quotes` | `features/sales/quotes` |
| `/crm/sales/activities` | `features/sales/activities` |
| `/crm/sales/tasks` | `features/sales/tasks` |
| `/crm/sales/meetings` | `features/sales/meetings` |
| `/crm/sales/calls` | `features/sales/calls` |
| `/crm/sales/emails` | `features/sales/emails` |
| `/crm/sales/notes` | `features/sales/notes` |
| `/crm/sales/timeline` | `features/sales/timeline` |
| `/crm/sales/documents` | `features/sales/documents` |
| `/crm/sales/campaigns` | `features/sales/scoped` → `CampaignsPage` |
| `/crm/sales/segments` | `SegmentsPage` |
| `/crm/sales/tags` | `features/sales/tags` |
| `/crm/sales/custom-fields` | `features/sales/custom-fields` |
| `/crm/sales/import` | `ImportPage` |
| `/crm/sales/export` | `features/sales/export` |
| `/crm/sales/reports` | `features/sales/reports` |
| `/crm/sales/analytics` | `features/sales/analytics` |
| `/crm/sales/automation` | `AutomationPage` |
| `/crm/sales/notifications` | `features/sales/admin` → `NotificationsPage` |
| `/crm/sales/roles` | `RolesPage` |
| `/crm/sales/permissions` | `PermissionsPage` |
| `/crm/sales/integrations` | `IntegrationsPage` |
| `/crm/sales/api-keys` | `ApiKeysPage` |
| `/crm/sales/audit-logs` | `AuditLogsPage` |
| `/crm/sales/settings` | `SettingsPage` |
| `/crm/sales/health` | `HealthPage` |
| `/crm/sales/capabilities` | `CapabilitiesPage` |

## Segment files (each route)

Every route directory includes:

- `page.tsx` — re-export only
- `loading.tsx` — `LoadingState`
- `error.tsx` — `ErrorState` + reset

Root: `app/crm/layout.tsx`, `app/crm/not-found.tsx`

## BFF

| Browser path | Upstream |
|--------------|----------|
| `/api/crm/*` | `CRM_SERVICE_URL` / `localhost:8003` |

## Generator

Regenerate routes: `node scripts/generate-crm-routes.mjs`
