INSIGHT-MVP/repos/INSIGHT-Shared/contracts/module-interface.md
Thomas Reitz 36196457ea feat(infra): vollständige Ansible-Struktur Phase 1
- Alle Ansible-Rollen erstellt: common, disk_setup, docker, postgresql,
  pgbouncer, redis, nginx, zabbix_agent
- ansible.cfg mit Pipeline-Optimierung
- hosts.yml mit echten IPs (DBS01=.20, APS01=.21, WEB01=.22)
- group_vars für alle Server (dbs, aps, web)
- Zabbix-Server auf sentinel.xinion.de gesetzt
- vault.yml.example als Vorlage für Secrets
- site.yml nutzt import_playbook (DBS01→APS01→WEB01)
- BRIEFING.md für alle 4 Repos angelegt (Platform, Apps, Infra, Shared)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:23:29 +01:00

84 lines
2.3 KiB
Markdown

# 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