From 966af755b488e69cf6e7d1171ce9d1075c8229d5 Mon Sep 17 00:00:00 2001 From: Martin Porwoll Date: Sun, 7 Dec 2025 20:22:05 +0000 Subject: [PATCH] docs: update CLAUDE.md and TODO.md with recent features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add E-Mail system documentation (tenant-specific SMTP, API endpoint) - Add Redis caching section - Add complete Collections and Globals overview - Update project structure with new directories - Mark Portfolio collections and Email system as completed - Update environment variables documentation πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- CLAUDE.md | 128 ++++++++++++++++++++++++++++++++++++--- docs/anleitungen/TODO.md | 42 +++++++++---- 2 files changed, 151 insertions(+), 19 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index c9255e3..390aba3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -38,10 +38,25 @@ Internet β†’ 37.24.237.181 β†’ Caddy (443) β†’ Payload (3000) /home/payload/payload-cms/ # Projektroot β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ payload.config.ts # Haupt-Konfiguration -β”‚ └── collections/ -β”‚ β”œβ”€β”€ Users.ts -β”‚ β”œβ”€β”€ Media.ts -β”‚ └── Tenants.ts +β”‚ β”œβ”€β”€ collections/ # Alle Collections +β”‚ β”‚ β”œβ”€β”€ Users.ts +β”‚ β”‚ β”œβ”€β”€ Media.ts +β”‚ β”‚ β”œβ”€β”€ Tenants.ts +β”‚ β”‚ β”œβ”€β”€ Posts.ts +β”‚ β”‚ β”œβ”€β”€ Categories.ts +β”‚ β”‚ β”œβ”€β”€ Portfolios.ts +β”‚ β”‚ β”œβ”€β”€ PortfolioCategories.ts +β”‚ β”‚ β”œβ”€β”€ EmailLogs.ts +β”‚ β”‚ └── ... +β”‚ β”œβ”€β”€ lib/ +β”‚ β”‚ β”œβ”€β”€ email/ # E-Mail-System +β”‚ β”‚ β”‚ β”œβ”€β”€ tenant-email-service.ts +β”‚ β”‚ β”‚ └── payload-email-adapter.ts +β”‚ β”‚ β”œβ”€β”€ search.ts # Volltextsuche +β”‚ β”‚ └── redis.ts # Redis Cache Client +β”‚ └── hooks/ # Collection Hooks +β”‚ β”œβ”€β”€ sendFormNotification.ts +β”‚ └── invalidateEmailCache.ts β”œβ”€β”€ .env # Umgebungsvariablen β”œβ”€β”€ ecosystem.config.cjs # PM2 Config └── .next/ # Build Output @@ -56,6 +71,18 @@ PAYLOAD_PUBLIC_SERVER_URL=https://pl.c2sgmbh.de NEXT_PUBLIC_SERVER_URL=https://pl.c2sgmbh.de NODE_ENV=production PORT=3000 + +# E-Mail (Global Fallback) +SMTP_HOST=smtp.example.com +SMTP_PORT=587 +SMTP_SECURE=false +SMTP_USER=user@example.com +SMTP_PASS=secret +SMTP_FROM_ADDRESS=noreply@c2sgmbh.de +SMTP_FROM_NAME=Payload CMS + +# Redis Cache +REDIS_URL=redis://localhost:6379 ``` ## Multi-Tenant Plugin @@ -145,15 +172,102 @@ PGPASSWORD=Finden55 psql -h 10.10.181.101 -U payload -d payload_db -c "\dt *_loc - **Admin Panel:** https://pl.c2sgmbh.de/admin - **API:** https://pl.c2sgmbh.de/api +- **E-Mail API:** https://pl.c2sgmbh.de/api/send-email (POST, Auth erforderlich) + +## E-Mail-System + +Multi-Tenant E-Mail-System mit tenant-spezifischer SMTP-Konfiguration: + +**Architektur:** +- Globaler SMTP als Fallback (via .env) +- Tenant-spezifische SMTP in Tenants Collection +- Transporter-Caching mit automatischer Invalidierung +- EmailLogs Collection fΓΌr Audit-Trail + +**Tenant E-Mail-Konfiguration:** +``` +Tenants β†’ email β†’ fromAddress, fromName, replyTo + β†’ email β†’ useCustomSmtp (Checkbox) + β†’ email β†’ smtp β†’ host, port, secure, user, pass +``` + +**API-Endpoint `/api/send-email`:** +```bash +curl -X POST https://pl.c2sgmbh.de/api/send-email \ + -H "Content-Type: application/json" \ + -H "Cookie: payload-token=..." \ + -d '{ + "to": "empfaenger@example.com", + "subject": "Betreff", + "html": "

Inhalt

", + "tenantId": 1 + }' +``` + +**Sicherheit:** +- Authentifizierung erforderlich +- Tenant-Zugriffskontrolle (User muss Tenant-Mitglied sein) +- Rate-Limiting: 10 E-Mails/Minute pro User +- SMTP-Passwort nie in API-Responses + +## Redis Caching + +Redis wird fΓΌr API-Response-Caching und E-Mail-Transporter-Caching verwendet: + +```typescript +import { redis } from '@/lib/redis' + +// Cache setzen (TTL in Sekunden) +await redis.set('key', JSON.stringify(data), 'EX', 60) + +// Cache lesen +const cached = await redis.get('key') + +// Pattern-basierte Invalidierung +await redis.keys('posts:*').then(keys => keys.length && redis.del(...keys)) +``` ## Datenbank-Direktzugriff -````bash +```bash PGPASSWORD=Finden55 psql -h 10.10.181.101 -U payload -d payload_db # NΓΌtzliche Queries SELECT * FROM tenants; SELECT * FROM users_tenants; +SELECT * FROM email_logs ORDER BY created_at DESC LIMIT 10; \dt -- Alle Tabellen -```All -```` +``` + +## Collections Übersicht + +| Collection | Slug | Beschreibung | +|------------|------|--------------| +| Users | users | Benutzer mit isSuperAdmin Flag | +| Tenants | tenants | Mandanten mit E-Mail-Konfiguration | +| Media | media | Medien mit 11 responsive Image Sizes | +| Pages | pages | Seiten mit Blocks | +| Posts | posts | Blog/News/Presse mit Kategorien | +| Categories | categories | Kategorien fΓΌr Posts | +| Portfolios | portfolios | Portfolio-Galerien (Fotografie) | +| PortfolioCategories | portfolio-categories | Kategorien fΓΌr Portfolios | +| Testimonials | testimonials | Kundenbewertungen | +| NewsletterSubscribers | newsletter-subscribers | Newsletter mit Double Opt-In | +| SocialLinks | social-links | Social Media Links | +| Forms | forms | Formular-Builder | +| FormSubmissions | form-submissions | Formular-Einsendungen | +| EmailLogs | email-logs | E-Mail-Protokollierung | +| CookieConfigurations | cookie-configurations | Cookie-Banner Konfiguration | +| CookieInventory | cookie-inventory | Cookie-Inventar | +| ConsentLogs | consent-logs | Consent-Protokollierung | + +## Globals + +| Global | Slug | Beschreibung | +|--------|------|--------------| +| SiteSettings | site-settings | Allgemeine Website-Einstellungen | +| Navigation | navigation | NavigationsmenΓΌ | +| SEOSettings | seo-settings | SEO-Einstellungen | +| PrivacyPolicySettings | privacy-policy-settings | Datenschutz-Einstellungen | + +*Letzte Aktualisierung: 07.12.2025* diff --git a/docs/anleitungen/TODO.md b/docs/anleitungen/TODO.md index ba14fe4..a8ce7c5 100644 --- a/docs/anleitungen/TODO.md +++ b/docs/anleitungen/TODO.md @@ -86,10 +86,18 @@ - DNS-EintrΓ€ge prΓΌfen - Caddy-Konfiguration fΓΌr alle Domains -- [ ] **[!] E-Mail-Adapter einrichten** - - SMTP-Konfiguration - - Newsletter Double Opt-In E-Mails - - Kontaktformular-Benachrichtigungen +- [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 @@ -162,10 +170,11 @@ - [ ] Google Ads API Credentials in Backend .env - Dokumentation: `docs/anleitungen/ANALYTICS_IMPLEMENTATION_GUIDE.md` -- [ ] **Caching-Strategie** - - Redis-Cache fΓΌr API - - CDN-Integration (Cloudflare) - - Invalidierung bei Updates +- [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) @@ -195,9 +204,18 @@ - [ ] Leistungs-Übersicht - [ ] Karriere-Seite mit Stellenangeboten -### gunshin.de -- [ ] Portfolio-Collection -- [ ] Projekt-Galerie +### 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 @@ -281,4 +299,4 @@ --- -*Letzte Aktualisierung: 05.12.2025 (Git & GitHub Setup, isSuperAdmin Feld, Techstack-Dokumentation)* +*Letzte Aktualisierung: 07.12.2025 (E-Mail-System, Portfolio-Collections, Redis Caching)*