# InsightModule — Contract > Version: 1.0 (Entwurf) > Dieser Contract definiert wie sich ein App-Modul in die INSIGHT-Platform-Shell einbindet. ## TypeScript Interface ```typescript export interface InsightRoute { path: string component: React.ComponentType exact?: boolean } export interface InsightNavItem { label: string path: string icon?: string children?: InsightNavItem[] } export interface InsightModule { /** Eindeutige ID des Moduls (z.B. 'crm', 'hr') */ id: string /** Anzeigename in der Navigation */ name: string /** Icon-Name (aus Icon-Bibliothek der Platform) */ icon?: string /** Welche moduleRole wird benötigt? (aus JWT moduleRoles) */ requiredRole: string /** React-Routen die registriert werden */ routes: InsightRoute[] /** Navigationspunkte in der Sidebar */ navigation: InsightNavItem[] /** Optionaler Dashboard-Widget für die Startseite */ dashboardWidget?: React.ComponentType } ``` ## Implementierung (Beispiel CRM) ```typescript // INSIGHT-Apps/packages/crm-frontend/src/index.ts import { CrmDashboard } from './pages/CrmDashboard' import { DealsPage } from './pages/DealsPage' import { ContactsPage } from './pages/ContactsPage' export const CrmModule: InsightModule = { id: 'crm', name: 'CRM', icon: 'briefcase', requiredRole: 'crm', routes: [ { path: '/crm', component: CrmDashboard, exact: true }, { path: '/crm/deals', component: DealsPage }, { path: '/crm/contacts', component: ContactsPage }, ], navigation: [ { label: 'Dashboard', path: '/crm', icon: 'home' }, { label: 'Deals', path: '/crm/deals', icon: 'dollar' }, { label: 'Kontakte', path: '/crm/contacts', icon: 'users' }, ], } ``` ## Registrierung in der Platform-Shell ```typescript // INSIGHT-Platform/packages/frontend/src/shell/module-registry.ts import { CrmModule } from '@insight/crm-frontend' export const registeredModules: InsightModule[] = [ CrmModule, // weitere Module hier eintragen ] ``` ## Regeln - `id` muss eindeutig und lowercase sein - `requiredRole` muss einer gültigen moduleRole entsprechen (definiert in INSIGHT-Platform) - Jede Route muss innerhalb des Modul-Pfads liegen (z.B. `/crm/*`) - Komponenten dürfen den Platform-Auth-Context nutzen (`useAuth()` Hook) - Kein direkter Datenbankzugriff aus Frontend-Komponenten