# 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) - [x] Newsletter Double Opt-In E-Mails (Erledigt: 10.12.2025) - [x] E-Mail-Templates für Bestätigung, Willkommen, Abmeldung - [x] Newsletter-Service mit Token-Validierung - [x] API-Endpoints: subscribe, confirm, unsubscribe - [x] Automatischer E-Mail-Versand via Hook - [ ] **[!] 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) - [x] Automatische Datenbank-Backups (Cron) (Erledigt: 11.12.2025) - [x] Backup-Rotation (30 Tage Retention) - im Skript integriert - [ ] Media-Backup zu S3/MinIO - [ ] Disaster Recovery Plan - [ ] **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 - [x] **Automatisierte Datenbank-Backups** (Erledigt: 11.12.2025) - [x] Cron-Job für tägliche pg_dump - Skript: `/home/payload/backups/postgres/backup-db.sh` - Cron: Täglich um 03:00 Uhr - Log: `/home/payload/logs/backup-cron.log` - [x] Backup-Rotation (30 Tage Retention) - lokal und S3 - [x] Offsite-Storage (Hetzner Object Storage) - Endpoint: `fsn1.your-objectstorage.com` - Bucket: `s3://c2s/backups/postgres/` - Credentials: `~/.s3cfg` (chmod 600) - [x] Dokumentierter Restore-Prozess (Erledigt: 11.12.2025) - Restore-Skript: `scripts/backup/restore-db.sh` - Interaktive Auswahl aus lokalen/S3-Backups - Automatisches Stoppen/Starten der Anwendung - Disaster Recovery Checkliste in README - [ ] **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 - [x] **Full-Text-Search aktivieren** (Erledigt: 09.12.2025) - [x] `USE_FTS=true` in Production gesetzt - [x] PostgreSQL `to_tsvector`-Indices erstellt: - `posts_locales_fts_title_idx` (GIN auf title) - `posts_locales_fts_excerpt_idx` (GIN auf excerpt) - `posts_locales_fts_combined_idx` (GIN auf title + excerpt) - `pages_locales_fts_title_idx` (GIN auf title) - `categories_locales_fts_name_idx` (GIN auf name) - [x] Deutsche Sprachkonfiguration (`german` config) - [x] Relevanz-Ranking mit `ts_rank()` - [x] Prefix-Suche mit `:*` Operator - [x] Fallback auf ILIKE bei `USE_FTS=false` - [ ] **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 - [x] **Queue-System implementieren** (Erledigt: 09.12.2025) - [x] BullMQ oder Agenda.js evaluieren → **Empfehlung: BullMQ** - [x] E-Mail-Versand über Queue (non-blocking) - Queue-Service: `src/lib/queue/queue-service.ts` - Email-Job: `src/lib/queue/jobs/email-job.ts` - Email-Worker: `src/lib/queue/workers/email-worker.ts` - API-Integration: `queued: true` Option in `/api/send-email` - [x] PDF-Generierung über Queue (Erledigt: 09.12.2025) - PDF-Job: `src/lib/queue/jobs/pdf-job.ts` - PDF-Service: `src/lib/pdf/pdf-service.ts` (Playwright-basiert) - PDF-Worker: `src/lib/queue/workers/pdf-worker.ts` - API-Endpoint: `/api/generate-pdf` (POST für Generierung, GET für Job-Status) - Unterstützt HTML-zu-PDF und URL-zu-PDF - PM2-Integration mit konfigurierbaren Workern - [x] Job-Dashboard im Admin - Queue-Status: `GET /api/admin/queues` (SuperAdmin only) - Queue-Jobs: `GET /api/admin/queues/[name]/jobs` - Queue-Actions: `POST /api/admin/queues` (pause, resume, clean, drain) **Evaluation BullMQ vs Agenda.js:** | Kriterium | BullMQ | Agenda.js | |-----------|--------|-----------| | **Database** | Redis ✅ (bereits vorhanden) | MongoDB ❌ (neue Dependency) | | **TypeScript** | Native ✅ | Begrenzt ⚠️ | | **Priority Jobs** | Ja ✅ | Nein ❌ | | **Rate Limiting** | Ja ✅ | Nein ❌ | | **Delayed Jobs** | Ja ✅ | Ja ✅ | | **Repeatable Jobs** | Ja ✅ | Ja ✅ | | **UI Dashboard** | @bull-board ✅ | Keine Built-in ❌ | | **Weekly Downloads** | 1.6M | 120K | | **Maintenance** | Aktiv | Weniger aktiv | **Entscheidung: BullMQ** wegen: 1. Redis bereits im Stack (keine neue DB) 2. Native TypeScript-Unterstützung 3. Priority Jobs & Rate Limiting für Multi-Tenant 4. @bull-board für Admin-Dashboard 5. Höhere Aktivität und Downloads **Implementierungsplan:** 1. `pnpm add bullmq @bull-board/api @bull-board/express` 2. Queue-Service (`src/lib/queue/queue-service.ts`) 3. Job-Definitionen (`src/lib/queue/jobs/`) 4. Worker-Script (`scripts/run-queue-worker.ts`) 5. PM2-Integration (separater Prozess) 6. Admin-Dashboard Route (`/admin/jobs`) **Betroffene Dateien für E-Mail-Queue:** - `src/lib/email/tenant-email-service.ts` - `src/app/(payload)/api/send-email/route.ts` - `src/app/(payload)/api/test-email/route.ts` - `src/lib/alerting/alert-service.ts` - `src/hooks/sendFormNotification.ts` #### Database Optimization - [x] **Index-Audit** (Erledigt: 09.12.2025) - [x] Composite-Indices für lokalisierte Felder (slug + locale) - `posts_locales_slug_locale_idx` - `pages_locales_slug_locale_idx` - `categories_locales_slug_locale_idx` - [x] Query-Performance-Analyse - [x] EXPLAIN ANALYZE für häufige Queries - [x] Zusätzliche Performance-Indexes erstellt: - `posts_status_tenant_idx` (status + tenant) - `posts_type_tenant_idx` (type + tenant) - `posts_published_at_idx` (chronologische Sortierung) - `posts_is_featured_tenant_idx` (partial index) - `email_logs_status_tenant_idx`, `email_logs_status_created_at_idx` - `audit_logs_action_created_at_idx` - `newsletter_subscribers_status_tenant_idx` - `consent_logs_created_at_desc_idx` - [ ] **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` - [x] **Test-Suite erweitern** (Erledigt: 09.12.2025) - [x] Test-DB mit Migrationen aufsetzen (Locale-Tabellen bereits vorhanden) - [x] Skipped Tests aktivieren (search, i18n) - alle 9 Tests nun aktiv - [x] Coverage-Report generieren (`pnpm test:coverage`) - Vitest v8 Coverage Provider konfiguriert - HTML/LCOV/Text Reports in `./coverage/` - Thresholds: 35% lines, 50% functions, 65% branches - Aktuell: 37.29% lines, 55.55% functions, 71.61% branches - [x] **Audit-Fixes** (Erledigt: 10.12.2025) - [x] Vitest auf 3.2.4 aktualisiert (Version-Warnung entfernt) - [x] `payload.create`/`payload.update` Mock in `tests/int/security-api.int.spec.ts` ergänzt - [x] 205 Tests laufen fehlerfrei, Coverage-Report ohne Abbrüche - [x] Kein "`payload.create is not a function`" Hinweis mehr im Test-Output - [ ] **CI/CD Pipeline** - [x] GitHub Actions Workflow erstellt (security.yml) - [ ] Automatisches Lint/Test/Build Workflow - [x] Secrets-Scanning in Pipeline - [ ] Staging-Deployment #### Admin UX - [x] **Tenant-Wechsel UI** (Erledigt: 08.12.2025) - [x] Dropdown in Admin-Leiste für schnellen Tenant-Wechsel (Multi-Tenant Plugin integriert) - [x] Tenant-Kontext in Breadcrumbs anzeigen (Custom TenantBreadcrumb Komponente) - [x] Deutsche Übersetzungen für Tenant-Selector hinzugefügt - [x] **Email-Konfiguration UX** (Erledigt: 08.12.2025) - [x] Formularvalidierung für SMTP-Settings (Host-Format, Port-Bereich, Pflichtfelder) - [x] Tooltips für SPF/DKIM-Hinweise (aufklappbare Info-Komponente mit Beispielen) - [x] "Test-Email senden" Button (Custom UI-Komponente + API-Endpoint) - [x] **Tenant Self-Service** (Erledigt: 08.12.2025) - [x] API für Tenant-Admins zum Testen der SMTP-Settings (`/api/test-email`) - [x] Email-Logs Einsicht für eigenen Tenant (Tenant-basierter Zugriff bereits vorhanden) - [x] Eigene Statistiken Dashboard (`/admin/tenant-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 - [x] API-Dokumentation automatisch generieren (OpenAPI) (Erledigt: 10.12.2025) - [x] payload-oapi Plugin installiert und konfiguriert - [x] OpenAPI 3.1 Spezifikation unter `/api/openapi.json` - [x] Swagger UI unter `/api/docs` - [ ] 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~~ ✅ Erledigt (11.12.2025) 3. ~~**[HOCH]** Full-Text-Search aktivieren (USE_FTS=true)~~ ✅ Erledigt 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: 11.12.2025* --- ## Changelog ### 11.12.2025 - **Automatisierte Datenbank-Backups:** Cron-Job für tägliche pg_dump eingerichtet - Backup-Skript: `/home/payload/backups/postgres/backup-db.sh` - Tägliche Ausführung um 03:00 Uhr via Cron - Automatische Rotation: Backups älter als 30 Tage werden gelöscht - Komprimierte Backups mit gzip (~42KB pro Backup) - Integritätsprüfung nach jedem Backup - Detaillierte Logs in `/home/payload/backups/postgres/backup.log` - **Offsite-Backup zu Hetzner Object Storage:** - s3cmd installiert und konfiguriert (`~/.s3cfg`, chmod 600) - Automatischer Upload nach jedem Backup zu `s3://c2s/backups/postgres/` - 30-Tage-Retention auch auf S3 (alte Backups werden automatisch gelöscht) - Endpoint: `fsn1.your-objectstorage.com` - **Dokumentierter Restore-Prozess:** - Interaktives Restore-Skript: `scripts/backup/restore-db.sh` - Unterstützt lokale und S3-Backups - Automatisches Stoppen/Starten von PM2 - Backup-Verifizierung vor Restore - Disaster Recovery Checkliste in `scripts/backup/README.md` ### 09.12.2025 - **Admin Login Fix:** Custom Login-Route unterstützt nun `_payload` JSON-Feld aus multipart/form-data (Payload Admin Panel Format) - **Dokumentation bereinigt:** Obsolete PROMPT_*.md Instruktionsdateien gelöscht - **CLAUDE.md aktualisiert:** Security-Features, Test Suite, AuditLogs dokumentiert - **Index-Audit:** 12 neue Performance-Indexes für PostgreSQL erstellt - Composite-Indexes für slug+locale auf posts_locales, pages_locales, categories_locales - Status/Tenant-Indexes für posts, email_logs, newsletter_subscribers - Partial Index für Featured Posts - Chronologische Sortierung für published_at, created_at ### 10.12.2025 - **Audit-Fixes:** Vitest auf 3.2.4 aktualisiert, Payload-Mocks im Security-Test ergänzt - **OpenAPI-Dokumentation:** payload-oapi Plugin für automatische API-Dokumentation - OpenAPI 3.1 Spezifikation unter `/api/openapi.json` - Swagger UI unter `/api/docs` - **Newsletter Double Opt-In:** DSGVO-konformes Newsletter-System - E-Mail-Templates: Bestätigung, Willkommen, Abmeldung (`src/lib/email/newsletter-templates.ts`) - Newsletter-Service mit Token-Validierung (`src/lib/email/newsletter-service.ts`) - API-Endpoints: `/api/newsletter/subscribe`, `/confirm`, `/unsubscribe` - Automatischer Hook für E-Mail-Versand bei Anmeldung - Token-Ablauf nach 48 Stunden ### 09.12.2025 (Fortsetzung) - **Full-Text-Search:** PostgreSQL FTS mit GIN-Indexes aktiviert - 5 FTS-Indexes auf posts_locales, pages_locales, categories_locales - Deutsche Sprachkonfiguration (`german` config) - Relevanz-Ranking mit `ts_rank()` - Feature-Flag `USE_FTS=true` in .env - **Queue-System Evaluation:** BullMQ vs Agenda.js evaluiert - **Empfehlung: BullMQ** (Redis-basiert, TypeScript-native, @bull-board UI) - Implementierungsplan dokumentiert - Betroffene Dateien identifiziert - **BullMQ Implementation:** Vollständiges Queue-System implementiert - Queue-Service mit Redis-Connection und Job-Optionen - Email-Job mit Priority, Delay und Batch-Support - Email-Worker für asynchrone Verarbeitung - Worker-Script für PM2 (`scripts/run-queue-worker.ts`) - PM2-Konfiguration für separaten Worker-Prozess - Admin-API für Queue-Monitoring (`/api/admin/queues`) - Send-Email API mit `queued: true` Option - **Audit-Fixes (BullMQ):** FTS und Dependencies bereinigt - FTS SQL-Fix: `p.published_at` zu SELECT hinzugefügt (PostgreSQL DISTINCT-Regel) - Guard für fehlende `payload.db.drizzle` in Tests - Ungenutzte `@bull-board/*` Packages entfernt (53 Dependencies weniger) - **PDF-Queue-System:** Vollständige PDF-Generierung über BullMQ - PDF-Job-Definition mit Priority, Delay und Batch-Support - PDF-Service mit Playwright (HTML-zu-PDF, URL-zu-PDF) - PDF-Worker für asynchrone Verarbeitung - REST-API `/api/generate-pdf` mit Auth, CSRF, Rate-Limiting - PM2-Integration mit konfigurierbaren Workern (`QUEUE_ENABLE_PDF`)