# To-Do-Liste - Payload CMS Multi-Tenant Projekt ## Legende - [ ] Offen - [x] Erledigt - [~] In Bearbeitung - [!] Hohe Priorität - [?] Klärungsbedarf --- ## Phase 1: Grundlagen (Abgeschlossen) ### Infrastruktur - [x] Payload CMS 3.x Installation - [x] PostgreSQL-Datenbank eingerichtet - [x] PM2 Process Manager konfiguriert - [x] Caddy Reverse Proxy mit SSL - [x] Multi-Tenant Plugin aktiviert - [x] Git & GitHub Repository Setup (05.12.2025) - [x] GitHub CLI Installation - [x] Repository erstellt: https://github.com/c2s-admin/cms.c2sgmbh.git - [x] GitHub Authentifizierung konfiguriert - [x] .gitignore für sensible Dateien - [x] Git Remote (HTTPS) konfiguriert ### Basis-Collections - [x] Users Collection - [x] isSuperAdmin Feld hinzugefügt (05.12.2025) - [x] Migration erstellt: 20251202_081830_add_is_super_admin_to_users - [x] Media Collection - [x] Tenants Collection - [x] Pages Collection ### Globals - [x] SiteSettings - [x] Navigation --- ## Phase 2: Universal Features (Abgeschlossen) ### Collections - [x] Posts Collection (Blog, News, Presse, Ankündigungen) - [x] Feld `type` (blog, news, press, announcement) - [x] Feld `isFeatured` - [x] Feld `excerpt` - [x] Categories Collection - [x] Testimonials Collection - [x] Newsletter Subscribers Collection - [x] Double Opt-In Support - [x] DSGVO-konforme Felder (IP, Timestamps) - [x] Social Links Collection ### Blocks - [x] Hero Block - [x] Text Block - [x] Image Text Block - [x] Card Grid Block - [x] Quote Block - [x] CTA Block - [x] Contact Form Block - [x] Video Block - [x] Divider Block - [x] Timeline Block - [x] Posts List Block - [x] Testimonials Block - [x] Newsletter Block - [x] Process Steps Block ### Consent Management - [x] Cookie Configurations Collection - [x] Cookie Inventory Collection - [x] Consent Logs Collection - [x] Privacy Policy Settings Collection --- ## Phase 3: Offene Aufgaben ### Hohe Priorität - [x] **Tenant-Domains konfigurieren** (Erledigt: 07.12.2025) - [x] Domains in Tenants Collection eingetragen - [x] DNS-Einträge konfiguriert - [x] ~~Caddy-Konfiguration~~ (nicht benötigt im Tech-Stack) - [x] **E-Mail-System** (Erledigt: 06.12.2025) - [x] Multi-Tenant Email Adapter für Payload CMS - [x] Tenant-spezifische SMTP-Konfiguration in Tenants Collection - [x] EmailLogs Collection für Protokollierung aller E-Mails - [x] REST-Endpoint `/api/send-email` mit: - [x] Authentifizierung & Tenant-Zugriffskontrolle - [x] Rate-Limiting (10 E-Mails/Minute pro User) - [x] Form-Submission Notifications - [x] Cache-Invalidierung bei Config-Änderungen - [x] SMTP-Passwort-Schutz (nie in API-Responses) - [ ] SMTP-Credentials in `.env` konfigurieren (TODO) - [ ] Newsletter Double Opt-In E-Mails (TODO) - [ ] **[!] Frontend-Komponenten entwickeln** - React/Next.js Komponenten für alle Blocks - Newsletter-Anmelde-Formular - Cookie-Banner implementieren ### Mittlere Priorität - [x] **Bild-Optimierung** (Erledigt: 30.11.2025) - [x] Sharp Plugin konfiguriert - [x] 11 Responsive Image Sizes definiert (thumbnail, small, medium, large, xlarge, 2k, og + AVIF-Varianten) - [x] WebP/AVIF Format aktiviert - [x] Fokuspunkt-Support - [x] Zusätzliche Felder (caption, credit, tags) - Dokumentation: `docs/anleitungen/BILDOPTIMIERUNG.md` - [x] **SEO-Erweiterungen** (Erledigt: 30.11.2025) - [x] Sitemap-Generator (`/sitemap.xml`) - [x] robots.txt (`/robots.txt`) - [x] Structured Data (JSON-LD) Helpers - [x] SEO Settings Global im Admin-Panel - Dokumentation: `docs/anleitungen/SEO_ERWEITERUNG.md` - [x] **Suche implementieren** (Erledigt: 30.11.2025) - [x] Volltextsuche für Posts (`/api/search`) - [x] Filterbare Kategorie-Ansichten (`/api/posts?category=...`) - [x] Auto-Complete Funktion (`/api/search/suggestions`) - [x] Rate Limiting (30 Requests/Minute) - [x] TTL-Caching (60 Sekunden) - Dokumentation: `src/lib/search.ts` - [x] **Mehrsprachigkeit (i18n)** (Erledigt: 30.11.2025) - [x] Admin UI: Deutsch & Englisch (`@payloadcms/translations`) - [x] Content Localization: DE (default), EN mit Fallback - [x] Alle Collections lokalisiert (Pages, Posts, Categories, Testimonials) - [x] Alle 14 Blocks lokalisiert - [x] Alle Globals lokalisiert (SiteSettings, Navigation, SEOSettings) - [x] 36 `_locales` Tabellen in PostgreSQL - [x] Search API mit `locale` Parameter - [x] Frontend Locale Routing (`/[locale]/...`) - Hinweis: Datenbank wurde zurückgesetzt (war leer) ### Niedrige Priorität - [ ] **Analytics Integration** - **1. Umami Analytics (cookieless, ohne Consent)** - [ ] Umami-Server auf sv-analytics (10.10.181.103) einrichten - [ ] Website-IDs für alle 4 Tenants in Umami erstellen - [ ] `src/config/analytics.ts` mit Website-IDs anlegen - [ ] `src/components/analytics/UmamiScript.tsx` implementieren - [ ] Umami Script in Root Layout einbinden (Multi-Tenant) - [ ] `src/hooks/useAnalytics.ts` Hook für Custom Events - [ ] `src/lib/analytics.server.ts` für Server-Side Events - [ ] Event-Tracking in Newsletter-Formular integrieren - [ ] Event-Tracking in CTA-Buttons integrieren - [ ] TrackedButton & TrackedDownload Komponenten erstellen - **2. Google Ads Conversion (mit Consent)** - [ ] `src/components/analytics/GoogleConsentMode.tsx` implementieren - [ ] Google Consent Mode v2 mit Orestbida Cookie-Banner integrieren - [ ] `src/hooks/useGclid.ts` Hook für GCLID-Erfassung - [ ] `src/lib/google-ads.ts` Client-Side Conversion Tracking - [ ] `src/lib/google-ads.server.ts` Server-Side Conversion API - [ ] Enhanced Conversions mit gehashten E-Mails - **3. Cookie Inventory** - [ ] Google Ads Cookies (_gcl_au, _gcl_aw, IDE) zur Cookie Inventory Collection hinzufügen - **4. Environment Variables** - [ ] NEXT_PUBLIC_UMAMI_HOST in .env.local - [ ] NEXT_PUBLIC_GOOGLE_ADS_ID in .env.local (pro Tenant) - [ ] UMAMI_HOST, UMAMI_WEBSITE_ID in Backend .env - [ ] Google Ads API Credentials in Backend .env - Dokumentation: `docs/anleitungen/ANALYTICS_IMPLEMENTATION_GUIDE.md` - [x] **Redis Caching** (Erledigt: 05.12.2025) - [x] Redis-Cache für API-Responses - [x] TTL-basierte Invalidierung - [x] Pattern-basierte Cache-Invalidierung - [ ] CDN-Integration (Cloudflare) (TODO) - [~] **Backup-System** - [x] Manuelle Datenbank-Backups (pg_dump) - [x] SQL-Dateien in .gitignore - [x] Backup via Git (temporär für Migration) - [ ] Automatische Datenbank-Backups (Cron) - [ ] Media-Backup zu S3/MinIO - [ ] Disaster Recovery Plan - [ ] Backup-Rotation (30 Tage Retention) - [ ] **Monitoring & Logging** (→ siehe Phase 4: Produktionsreife) - Sentry Error Tracking - Prometheus Metrics - Grafana Dashboard --- ## Phase 4: Produktionsreife (Audit-basiert) > Basierend auf Audit-Analyse vom 07.12.2025 ### [!] Hohe Priorität - Stabilität & Sicherheit #### Monitoring & Alerting - [x] **AuditLogs Collection** (Erledigt: 07.12.2025) - [x] Collection erstellen für: Tenant-Änderungen, Admin-Login, kritische Aktionen - [x] Automatisches Logging via Collection Hooks (Users, Tenants) - [x] Sensitive Data Masking (Passwörter, Secrets) - [ ] Retention Policy (90 Tage) - Cron-Job TODO - [x] **Email-Fehler Alerting** (Erledigt: 07.12.2025) - [x] Hook bei wiederholten `failed`-Status in EmailLogs - [x] Multi-Channel Alert Service (E-Mail, Slack, Discord, Console) - [x] Konfigurierbare Alert-Level (info, warning, error, critical) - [ ] Dashboard-Widget für Email-Status im Admin - [x] **Email-Logs Admin-Verbesserungen** (Erledigt: 07.12.2025) - [x] Filter nach Status (pending/sent/failed) im Admin - [x] Export-Endpoint für Email-Logs (CSV/JSON) - `/api/email-logs/export` - [x] Statistik-Endpoint (letzte 24h/7d/30d) - `/api/email-logs/stats` #### Backup & Recovery - [ ] **Automatisierte Datenbank-Backups** - [ ] Cron-Job für tägliche pg_dump - [ ] Offsite-Storage (S3/MinIO) - [ ] Backup-Rotation (30 Tage Retention) - [ ] Dokumentierter Restore-Prozess - [ ] **Media-Backup** - [ ] S3/MinIO Integration für Media-Uploads - [ ] Versionierung aktivieren - [ ] Sync-Script für Offsite-Backup #### Security Hardening - [x] **API-Schutz erweitern** (Erledigt: 07.12.2025) - [x] Globales Rate-Limiting für alle öffentlichen Endpoints - Zentraler Rate-Limiter Service (`src/lib/security/rate-limiter.ts`) - Vordefinierte Limiter: publicApi (60/min), auth (5/15min), email (10/min), search (30/min), form (5/10min) - Redis-Support für verteilte Systeme mit In-Memory-Fallback - [x] IP-Allowlist Option für `/api/send-email` - Konfiguration via `SEND_EMAIL_ALLOWED_IPS` env - Unterstützt IPs, CIDRs und Wildcards - Globale Blocklist via `BLOCKED_IPS` env - [x] CSRF-Schutz für Browser-basierte API-Calls - Double Submit Cookie Pattern - Origin-Header-Validierung - Token-Endpoint: `GET /api/csrf-token` - [x] **Sensitive Data Masking** (Erledigt: 07.12.2025) - [x] Zentraler Data-Masking-Service (`src/lib/security/data-masking.ts`) - [x] Automatische Maskierung von Passwörtern, Tokens, API-Keys - [x] Safe-Logger-Factory für konsistentes Logging - [x] Rekursive Object-Maskierung für Audit-Logs - [x] **Secrets Scanning** (Erledigt: 07.12.2025) - [x] Pre-commit Hook für Secret-Detection (`scripts/detect-secrets.sh`) - [x] GitHub Actions Workflow für Gitleaks und CodeQL - [x] Gitleaks-Konfiguration (`.gitleaks.toml`) - [x] Dependency Vulnerability Scanning ### Mittlere Priorität - Performance & Skalierung #### Search Performance - [ ] **Full-Text-Search aktivieren** - [ ] `USE_FTS=true` in Production setzen - [ ] PostgreSQL `to_tsvector`-Indices erstellen - [ ] Performance-Test mit Produktionsdaten - [ ] **Redis-Migration für Caches** - [ ] Search-Cache von In-Memory auf Redis migrieren - [ ] Rate-Limit-Maps auf Redis migrieren - [ ] Suggestions-Cache auf Redis #### Background Jobs - [ ] **Queue-System implementieren** - [ ] BullMQ oder Agenda.js evaluieren - [ ] E-Mail-Versand über Queue (non-blocking) - [ ] PDF-Generierung über Queue - [ ] Job-Dashboard im Admin #### Database Optimization - [ ] **Index-Audit** - [ ] Composite-Indices für lokalisierte Felder (slug + locale) - [ ] Query-Performance-Analyse - [ ] EXPLAIN ANALYZE für häufige Queries - [ ] **Connection Pooling** - [ ] PgBouncer evaluieren für Multi-Instanz-Betrieb #### Build & Infrastructure - [ ] **Memory-Problem lösen** - [ ] Swap auf Server aktivieren (2-4GB) - [ ] Alternativ: Build auf separatem Runner - [ ] **PM2 Cluster Mode** - [ ] Multi-Instanz Konfiguration testen - [ ] Shared State via Redis sicherstellen ### Niedrige Priorität - Developer Experience & UX #### Testing & CI/CD - [x] **Security Test Suite** (Erledigt: 08.12.2025) - [x] Unit Tests für Rate-Limiter (`tests/unit/security/rate-limiter.unit.spec.ts`) - [x] Unit Tests für CSRF Protection (`tests/unit/security/csrf.unit.spec.ts`) - [x] Unit Tests für IP-Allowlist (`tests/unit/security/ip-allowlist.unit.spec.ts`) - [x] Unit Tests für Data-Masking (`tests/unit/security/data-masking.unit.spec.ts`) - [x] API Integration Tests (`tests/int/security-api.int.spec.ts`) - [x] Test Utilities (`tests/helpers/security-test-utils.ts`) - [x] Dedicated Script: `pnpm test:security` - [x] CI Integration in `.github/workflows/security.yml` - [ ] **Test-Suite erweitern** - [ ] Test-DB mit Migrationen aufsetzen - [ ] Skipped Tests aktivieren (email-logs, i18n) - [ ] Coverage-Report generieren - [ ] **CI/CD Pipeline** - [x] GitHub Actions Workflow erstellt (security.yml) - [ ] Automatisches Lint/Test/Build Workflow - [x] Secrets-Scanning in Pipeline - [ ] Staging-Deployment #### Admin UX - [ ] **Tenant-Wechsel UI** - [ ] Dropdown in Admin-Leiste für schnellen Tenant-Wechsel - [ ] Tenant-Kontext in Breadcrumbs anzeigen - [ ] **Email-Konfiguration UX** - [ ] Formularvalidierung für SMTP-Settings - [ ] Tooltips für SPF/DKIM-Hinweise - [ ] "Test-Email senden" Button - [ ] **Tenant Self-Service** - [ ] API für Tenant-Admins zum Testen der SMTP-Settings - [ ] Email-Logs Einsicht für eigenen Tenant - [ ] Eigene Statistiken Dashboard #### Data Retention - [ ] **Automatische Datenbereinigung** - [ ] Cron-Job für Email-Log Cleanup (älter als X Tage) - [ ] Consent-Logs Archivierung - [ ] Media-Orphan-Cleanup --- ## Phase 5: Tenant-spezifische Features ### porwoll.de - [ ] Immobilien-Collection (falls benötigt) - [ ] Objektsuche - [ ] Kontaktformular mit Objekt-Referenz ### complexcaresolutions.de (C2S) - [ ] Team-Collection - [ ] Leistungs-Übersicht - [ ] Karriere-Seite mit Stellenangeboten ### gunshin.de / Fotografin-Portfolio - [x] Portfolio-Categories Collection (Erledigt: 06.12.2025) - [x] Name, Slug, Beschreibung (lokalisiert) - [x] Cover-Bild, Reihenfolge, Aktiv-Status - [x] Portfolios Collection (Erledigt: 06.12.2025) - [x] Titel, Beschreibung, Excerpt (lokalisiert) - [x] Kategorie-Beziehung - [x] Cover-Bild + Galerie-Bilder mit Captions - [x] Projekt-Details (Kunde, Ort, Datum, Ausrüstung) - [x] Status (draft/published/archived) - [x] isFeatured, SEO-Felder - [ ] Projekt-Galerie Frontend - [ ] Referenzen-Slider ### zweitmein.ng - [ ] Produkt-Collection (falls E-Commerce) - [ ] FAQ-Collection - [ ] Preistabellen --- ## Technische Schulden - [ ] TypeScript Strict Mode aktivieren - [ ] Unit Tests für Access Control - [ ] E2E Tests für kritische Flows - [ ] API-Dokumentation automatisch generieren (OpenAPI) - [ ] Code-Review für Security-relevante Bereiche - [ ] Performance-Audit der Datenbank-Queries --- ## Dokumentation - [x] CLAUDE.md (Projekt-Übersicht) - [x] UNIVERSAL_FEATURES.md (Collections & Blocks) - [x] API_ANLEITUNG.md (REST API Guide) - [x] TODO.md (Diese Datei) - [x] BILDOPTIMIERUNG.md (Sharp & Image Sizes) - [x] SEO_ERWEITERUNG.md (SEO Features) - [x] ANALYTICS_IMPLEMENTATION_GUIDE.md (Umami & Google Ads) - [x] Techstack_Dokumentation_12_2025.md (Infrastruktur & Deployment) - [x] SECURITY.md (Sicherheitsrichtlinien) (Erledigt: 08.12.2025) - [ ] DEPLOYMENT.md (Deployment-Prozess) - [ ] FRONTEND_INTEGRATION.md (Next.js Guide) --- ## Regelmäßige Wartung ### Wöchentlich - [ ] PM2 Logs prüfen - [ ] Datenbank-Größe überwachen - [ ] Media-Storage prüfen ### Monatlich - [ ] Dependencies aktualisieren (`pnpm update`) - [ ] Sicherheitsupdates prüfen (`pnpm audit`) - [ ] Backup-Restore testen ### Quartalsweise - [ ] Performance-Review - [ ] Security-Audit - [ ] Dokumentation aktualisieren --- ## Notizen ### Bekannte Probleme 1. **Tenant-Isolation bei localhost:** API gibt 403 zurück, wenn kein Tenant zur Domain passt. Das ist gewolltes Verhalten für Multi-Tenant-Sicherheit. 2. **GraphQL Playground deaktiviert:** Route wurde entfernt. Bei Bedarf wieder aktivieren. 3. **PM2 Cluster Mode:** Aktuell 1 Instanz. Für Skalierung `instances: "max"` setzen. ### Nächste Schritte (Priorisiert) 1. ~~**[KRITISCH]** AuditLogs Collection implementieren~~ ✅ Erledigt 2. **[KRITISCH]** Automatisierte Backups einrichten 3. **[HOCH]** Full-Text-Search aktivieren (USE_FTS=true) 4. **[HOCH]** Rate-Limits auf Redis migrieren (In-Memory-Fallback funktioniert) 5. ~~**[MITTEL]** CI/CD Pipeline mit GitHub Actions~~ ✅ security.yml erstellt 6. **[MITTEL]** Frontend-Entwicklung starten 7. **[NIEDRIG]** Admin UX Verbesserungen --- ## Kontakte & Ressourcen - **Payload CMS Docs:** https://payloadcms.com/docs - **GitHub Issues:** https://github.com/payloadcms/payload/issues - **Discord Community:** https://discord.com/invite/payload --- *Letzte Aktualisierung: 08.12.2025 (Security Test Suite implementiert)*