diff --git a/20250119_Logo_Botkozept.svg b/20250119_Logo_Botkozept.svg
deleted file mode 100644
index 8318377..0000000
--- a/20250119_Logo_Botkozept.svg
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
diff --git a/BotKonzept-Customer-Registration-Workflow.json b/BotKonzept-Customer-Registration-Workflow.json
new file mode 100644
index 0000000..1a43454
--- /dev/null
+++ b/BotKonzept-Customer-Registration-Workflow.json
@@ -0,0 +1,312 @@
+{
+ "name": "BotKonzept - Customer Registration & Trial Management",
+ "nodes": [
+ {
+ "parameters": {
+ "httpMethod": "POST",
+ "path": "botkonzept-registration",
+ "responseMode": "responseNode",
+ "options": {}
+ },
+ "id": "webhook-registration",
+ "name": "Registration Webhook",
+ "type": "n8n-nodes-base.webhook",
+ "typeVersion": 1.1,
+ "position": [250, 300],
+ "webhookId": "botkonzept-registration"
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "string": [
+ {
+ "value1": "={{$json.body.email}}",
+ "operation": "isNotEmpty"
+ },
+ {
+ "value1": "={{$json.body.firstName}}",
+ "operation": "isNotEmpty"
+ },
+ {
+ "value1": "={{$json.body.lastName}}",
+ "operation": "isNotEmpty"
+ }
+ ]
+ }
+ },
+ "id": "validate-input",
+ "name": "Validate Input",
+ "type": "n8n-nodes-base.if",
+ "typeVersion": 1,
+ "position": [450, 300]
+ },
+ {
+ "parameters": {
+ "operation": "insert",
+ "schema": "public",
+ "table": "customers",
+ "columns": "email,first_name,last_name,company,status,created_at,trial_end_date",
+ "additionalFields": {
+ "returnFields": "*"
+ }
+ },
+ "id": "create-customer",
+ "name": "Create Customer in DB",
+ "type": "n8n-nodes-base.postgres",
+ "typeVersion": 2.4,
+ "position": [650, 200],
+ "credentials": {
+ "postgres": {
+ "id": "supabase-local",
+ "name": "Supabase Local"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "authentication": "privateKey",
+ "command": "=/root/customer-installer/install.sh --storage local-zfs --bridge vmbr0 --ip dhcp --vlan 90 --apt-proxy http://192.168.45.2:3142 --n8n-owner-email {{ $json.email }} --n8n-owner-pass \"{{ $('Generate-Password').item.json.password }}\"",
+ "cwd": "/root/customer-installer/"
+ },
+ "id": "create-instance",
+ "name": "Create Customer Instance",
+ "type": "n8n-nodes-base.ssh",
+ "typeVersion": 1,
+ "position": [850, 200],
+ "credentials": {
+ "sshPrivateKey": {
+ "id": "pve20-ssh",
+ "name": "PVE20"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "jsCode": "// Parse installation output\nconst stdout = $input.item.json.stdout;\nconst installData = JSON.parse(stdout);\n\n// Add customer info\ninstallData.customer = {\n id: $('Create Customer in DB').item.json.id,\n email: $('Create Customer in DB').item.json.email,\n firstName: $('Create Customer in DB').item.json.first_name,\n lastName: $('Create Customer in DB').item.json.last_name,\n company: $('Create Customer in DB').item.json.company\n};\n\nreturn installData;"
+ },
+ "id": "parse-install-output",
+ "name": "Parse Install Output",
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [1050, 200]
+ },
+ {
+ "parameters": {
+ "operation": "insert",
+ "schema": "public",
+ "table": "instances",
+ "columns": "customer_id,ctid,hostname,ip,fqdn,status,credentials,created_at,trial_end_date",
+ "additionalFields": {}
+ },
+ "id": "save-instance",
+ "name": "Save Instance to DB",
+ "type": "n8n-nodes-base.postgres",
+ "typeVersion": 2.4,
+ "position": [1250, 200],
+ "credentials": {
+ "postgres": {
+ "id": "supabase-local",
+ "name": "Supabase Local"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "fromEmail": "noreply@botkonzept.de",
+ "toEmail": "={{ $json.customer.email }}",
+ "subject": "Willkommen bei BotKonzept - Ihre Instanz ist bereit! 🎉",
+ "emailType": "html",
+ "message": "=\n\n
\n \n \n\n\n \n \n \n
\n
Hallo {{ $json.customer.firstName }},
\n \n
vielen Dank für Ihre Registrierung! Ihre persönliche KI-Chatbot-Instanz wurde erfolgreich erstellt und ist jetzt einsatzbereit.
\n \n
\n \n
🚀 Nächste Schritte:
\n
\n - Einloggen: Klicken Sie auf den Link oben und loggen Sie sich ein
\n - Dokumente hochladen: Laden Sie Ihre PDFs, FAQs oder andere Dokumente hoch
\n - Chatbot testen: Testen Sie Ihren Chatbot direkt im Dashboard
\n - Code einbinden: Kopieren Sie den Widget-Code auf Ihre Website
\n
\n \n
Jetzt Dashboard öffnen →\n \n
\n
💰 Frühbucher-Angebot:
\n
Upgraden Sie in den nächsten 3 Tagen und erhalten Sie 30% Rabatt auf Ihr erstes Jahr!
\n
\n \n
Trial-Zeitraum: 7 Tage (bis {{ $json.trial_end_date }})
\n \n
Bei Fragen stehen wir Ihnen jederzeit zur Verfügung!
\n \n
Viel Erfolg mit Ihrem KI-Chatbot!
\n Ihr BotKonzept-Team
\n
\n \n \n
\n\n",
+ "options": {
+ "allowUnauthorizedCerts": false
+ }
+ },
+ "id": "send-welcome-email",
+ "name": "Send Welcome Email",
+ "type": "n8n-nodes-base.emailSend",
+ "typeVersion": 2.1,
+ "position": [1450, 200],
+ "credentials": {
+ "smtp": {
+ "id": "postfix-ses",
+ "name": "Postfix SES"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "operation": "insert",
+ "schema": "public",
+ "table": "emails_sent",
+ "columns": "customer_id,email_type,sent_at",
+ "additionalFields": {}
+ },
+ "id": "log-email",
+ "name": "Log Email Sent",
+ "type": "n8n-nodes-base.postgres",
+ "typeVersion": 2.4,
+ "position": [1650, 200],
+ "credentials": {
+ "postgres": {
+ "id": "supabase-local",
+ "name": "Supabase Local"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "respondWith": "json",
+ "responseBody": "={{ { \"success\": true, \"message\": \"Registrierung erfolgreich! Sie erhalten in Kürze eine E-Mail mit Ihren Zugangsdaten.\", \"customerId\": $json.customer.id, \"instanceUrl\": $json.urls.n8n_external } }}",
+ "options": {
+ "responseCode": 200
+ }
+ },
+ "id": "success-response",
+ "name": "Success Response",
+ "type": "n8n-nodes-base.respondToWebhook",
+ "typeVersion": 1,
+ "position": [1850, 200]
+ },
+ {
+ "parameters": {
+ "respondWith": "json",
+ "responseBody": "={{ { \"success\": false, \"error\": \"Ungültige Eingabedaten. Bitte überprüfen Sie Ihre Angaben.\" } }}",
+ "options": {
+ "responseCode": 400
+ }
+ },
+ "id": "error-response",
+ "name": "Error Response",
+ "type": "n8n-nodes-base.respondToWebhook",
+ "typeVersion": 1,
+ "position": [650, 400]
+ },
+ {
+ "parameters": {
+ "jsCode": "// Generate secure password\nconst length = 16;\nconst charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';\nlet password = '';\n\nfor (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * charset.length);\n password += charset[randomIndex];\n}\n\n// Calculate trial end date (7 days from now)\nconst trialEndDate = new Date();\ntrialEndDate.setDate(trialEndDate.getDate() + 7);\n\nreturn {\n password: password,\n trialEndDate: trialEndDate.toISOString(),\n email: $json.body.email,\n firstName: $json.body.firstName,\n lastName: $json.body.lastName,\n company: $json.body.company || null\n};"
+ },
+ "id": "generate-password",
+ "name": "Generate Password & Trial Date",
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [650, 100]
+ }
+ ],
+ "connections": {
+ "Registration Webhook": {
+ "main": [
+ [
+ {
+ "node": "Validate Input",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Validate Input": {
+ "main": [
+ [
+ {
+ "node": "Generate Password & Trial Date",
+ "type": "main",
+ "index": 0
+ }
+ ],
+ [
+ {
+ "node": "Error Response",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Generate Password & Trial Date": {
+ "main": [
+ [
+ {
+ "node": "Create Customer in DB",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Create Customer in DB": {
+ "main": [
+ [
+ {
+ "node": "Create Customer Instance",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Create Customer Instance": {
+ "main": [
+ [
+ {
+ "node": "Parse Install Output",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Parse Install Output": {
+ "main": [
+ [
+ {
+ "node": "Save Instance to DB",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Save Instance to DB": {
+ "main": [
+ [
+ {
+ "node": "Send Welcome Email",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Send Welcome Email": {
+ "main": [
+ [
+ {
+ "node": "Log Email Sent",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Log Email Sent": {
+ "main": [
+ [
+ {
+ "node": "Success Response",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "pinData": {},
+ "settings": {
+ "executionOrder": "v1"
+ },
+ "staticData": null,
+ "tags": [],
+ "triggerCount": 0,
+ "updatedAt": "2025-01-25T00:00:00.000Z",
+ "versionId": "1"
+}
diff --git a/BotKonzept-Trial-Management-Workflow.json b/BotKonzept-Trial-Management-Workflow.json
new file mode 100644
index 0000000..b154f6a
--- /dev/null
+++ b/BotKonzept-Trial-Management-Workflow.json
@@ -0,0 +1,122 @@
+{
+ "name": "BotKonzept - Trial Management & Email Automation",
+ "nodes": [
+ {
+ "parameters": {
+ "rule": {
+ "interval": [
+ {
+ "field": "cronExpression",
+ "expression": "0 9 * * *"
+ }
+ ]
+ }
+ },
+ "id": "daily-cron",
+ "name": "Daily at 9 AM",
+ "type": "n8n-nodes-base.scheduleTrigger",
+ "typeVersion": 1.1,
+ "position": [250, 300]
+ },
+ {
+ "parameters": {
+ "operation": "executeQuery",
+ "query": "SELECT c.id as customer_id, c.email, c.first_name, c.last_name, c.company, c.created_at, c.status, i.ctid, i.hostname, i.fqdn, i.trial_end_date, i.credentials, EXTRACT(DAY FROM (NOW() - c.created_at)) as days_since_registration FROM customers c JOIN instances i ON c.id = i.customer_id WHERE c.status = 'trial' AND i.status = 'active' AND c.created_at >= NOW() - INTERVAL '8 days'",
+ "additionalFields": {}
+ },
+ "id": "get-trial-customers",
+ "name": "Get Trial Customers",
+ "type": "n8n-nodes-base.postgres",
+ "typeVersion": 2.4,
+ "position": [450, 300],
+ "credentials": {
+ "postgres": {
+ "id": "supabase-local",
+ "name": "Supabase Local"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "number": [
+ {
+ "value1": "={{$json.days_since_registration}}",
+ "operation": "equal",
+ "value2": 3
+ }
+ ]
+ }
+ },
+ "id": "check-day-3",
+ "name": "Day 3?",
+ "type": "n8n-nodes-base.if",
+ "typeVersion": 1,
+ "position": [650, 200]
+ },
+ {
+ "parameters": {
+ "operation": "insert",
+ "schema": "public",
+ "table": "emails_sent",
+ "columns": "customer_id,email_type,sent_at",
+ "additionalFields": {}
+ },
+ "id": "log-email-sent",
+ "name": "Log Email Sent",
+ "type": "n8n-nodes-base.postgres",
+ "typeVersion": 2.4,
+ "position": [1450, 200],
+ "credentials": {
+ "postgres": {
+ "id": "supabase-local",
+ "name": "Supabase Local"
+ }
+ }
+ }
+ ],
+ "connections": {
+ "Daily at 9 AM": {
+ "main": [
+ [
+ {
+ "node": "Get Trial Customers",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Get Trial Customers": {
+ "main": [
+ [
+ {
+ "node": "Day 3?",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Day 3?": {
+ "main": [
+ [
+ {
+ "node": "Log Email Sent",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "pinData": {},
+ "settings": {
+ "executionOrder": "v1"
+ },
+ "staticData": null,
+ "tags": [],
+ "triggerCount": 0,
+ "updatedAt": "2025-01-25T00:00:00.000Z",
+ "versionId": "1"
+}
diff --git a/REGISTRATION_SETUP_GUIDE.md b/REGISTRATION_SETUP_GUIDE.md
new file mode 100644
index 0000000..1fa3c2a
--- /dev/null
+++ b/REGISTRATION_SETUP_GUIDE.md
@@ -0,0 +1,440 @@
+# 🚀 BotKonzept - Registrierungs-Setup Guide
+
+## 📋 Übersicht
+
+Dieser Guide erklärt, wie Sie die Benutzerregistrierung für BotKonzept zum Laufen bringen.
+
+---
+
+## ✅ Was bereits vorhanden ist
+
+### 1. Frontend (customer-frontend)
+- ✅ Registrierungsformular (`index.html`)
+- ✅ Formular-Validierung (`js/main.js`)
+- ✅ Webhook-URL: `https://n8n.userman.de/webhook/botkonzept-registration`
+
+### 2. Backend (customer-installer)
+- ✅ `install.sh` - Erstellt LXC-Container automatisch
+- ✅ `setup_nginx_proxy.sh` - Konfiguriert Reverse Proxy
+- ✅ Datenbank-Schema (`sql/botkonzept_schema.sql`)
+
+### 3. n8n Workflows
+- ✅ `BotKonzept-Customer-Registration-Workflow.json`
+- ✅ `BotKonzept-Trial-Management-Workflow.json`
+
+---
+
+## 🔧 Setup-Schritte
+
+### Schritt 1: Datenbank einrichten
+
+```bash
+# Auf Ihrem Supabase/PostgreSQL Server
+psql -U postgres -d botkonzept < customer-installer/sql/botkonzept_schema.sql
+```
+
+**Oder in Supabase Dashboard:**
+1. Gehen Sie zu SQL Editor
+2. Kopieren Sie den Inhalt von `sql/botkonzept_schema.sql`
+3. Führen Sie das SQL aus
+
+**Tabellen die erstellt werden:**
+- `customers` - Kundendaten
+- `instances` - LXC-Instanzen
+- `emails_sent` - E-Mail-Tracking
+- `subscriptions` - Abonnements
+- `payments` - Zahlungen
+- `usage_stats` - Nutzungsstatistiken
+- `audit_log` - Audit-Trail
+
+---
+
+### Schritt 2: n8n Credentials einrichten
+
+Sie benötigen folgende Credentials in n8n:
+
+#### 2.1 PostgreSQL/Supabase Credential
+**Name:** `Supabase Local`
+**Typ:** Postgres
+**Konfiguration:**
+```
+Host: localhost (oder Ihr Supabase Host)
+Port: 5432
+Database: botkonzept
+User: postgres (oder service_role)
+Password: [Ihr Passwort]
+SSL: Enabled (für Supabase)
+```
+
+#### 2.2 SSH Credential für PVE20
+**Name:** `PVE20`
+**Typ:** SSH (Private Key)
+**Konfiguration:**
+```
+Host: 192.168.45.20 (oder Ihre PVE20 IP)
+Port: 22
+Username: root
+Private Key: [Ihr SSH Private Key]
+```
+
+**SSH Key generieren (falls noch nicht vorhanden):**
+```bash
+# Auf dem n8n Server
+ssh-keygen -t ed25519 -C "n8n@botkonzept"
+
+# Public Key auf PVE20 kopieren
+ssh-copy-id root@192.168.45.20
+```
+
+#### 2.3 SMTP Credential für E-Mails
+**Name:** `Postfix SES`
+**Typ:** SMTP
+**Konfiguration:**
+
+**Option A: Amazon SES**
+```
+Host: email-smtp.eu-central-1.amazonaws.com
+Port: 587
+User: [Ihr SMTP Username]
+Password: [Ihr SMTP Password]
+From Email: noreply@botkonzept.de
+```
+
+**Option B: Postfix (lokal)**
+```
+Host: localhost
+Port: 25
+From Email: noreply@botkonzept.de
+```
+
+**Option C: Gmail (für Tests)**
+```
+Host: smtp.gmail.com
+Port: 587
+User: your-email@gmail.com
+Password: [App-spezifisches Passwort]
+From Email: your-email@gmail.com
+```
+
+---
+
+### Schritt 3: n8n Workflows importieren
+
+#### 3.1 Customer Registration Workflow
+
+1. Öffnen Sie n8n: `https://n8n.userman.de`
+2. Klicken Sie auf **"+"** → **"Import from File"**
+3. Wählen Sie `BotKonzept-Customer-Registration-Workflow.json`
+4. **Wichtig:** Passen Sie folgende Nodes an:
+
+**Node: "Create Customer in DB"**
+- Credential: `Supabase Local` auswählen
+- Query anpassen falls nötig
+
+**Node: "Create Customer Instance"**
+- Credential: `PVE20` auswählen
+- Command prüfen:
+```bash
+/root/customer-installer/install.sh \
+ --storage local-zfs \
+ --bridge vmbr0 \
+ --ip dhcp \
+ --vlan 90 \
+ --apt-proxy http://192.168.45.2:3142 \
+ --n8n-owner-email {{ $json.email }} \
+ --n8n-owner-pass "{{ $('Generate Password & Trial Date').item.json.password }}"
+```
+
+**Node: "Send Welcome Email"**
+- Credential: `Postfix SES` auswählen
+- From Email anpassen: `noreply@botkonzept.de`
+
+5. Klicken Sie auf **"Save"**
+6. Klicken Sie auf **"Activate"** (oben rechts)
+
+#### 3.2 Trial Management Workflow
+
+1. Importieren Sie `BotKonzept-Trial-Management-Workflow.json`
+2. Passen Sie die Credentials an
+3. Aktivieren Sie den Workflow
+
+---
+
+### Schritt 4: Webhook-URL testen
+
+#### 4.1 Webhook-URL ermitteln
+
+Nach dem Import sollte die Webhook-URL sein:
+```
+https://n8n.userman.de/webhook/botkonzept-registration
+```
+
+**Prüfen Sie die URL:**
+1. Öffnen Sie den Workflow
+2. Klicken Sie auf den Node "Registration Webhook"
+3. Kopieren Sie die "Production URL"
+
+#### 4.2 Test mit curl
+
+```bash
+curl -X POST https://n8n.userman.de/webhook/botkonzept-registration \
+ -H "Content-Type: application/json" \
+ -d '{
+ "firstName": "Max",
+ "lastName": "Mustermann",
+ "email": "test@example.com",
+ "company": "Test GmbH",
+ "website": "https://example.com",
+ "newsletter": true
+ }'
+```
+
+**Erwartete Antwort:**
+```json
+{
+ "success": true,
+ "message": "Registrierung erfolgreich! Sie erhalten in Kürze eine E-Mail mit Ihren Zugangsdaten.",
+ "customerId": "uuid-hier",
+ "instanceUrl": "https://sb-XXXXX.userman.de"
+}
+```
+
+---
+
+## 🐛 Häufige Probleme & Lösungen
+
+### Problem 1: "Credential not found"
+
+**Lösung:**
+- Stellen Sie sicher, dass alle Credentials in n8n angelegt sind
+- Namen müssen exakt übereinstimmen: `Supabase Local`, `PVE20`, `Postfix SES`
+
+### Problem 2: SSH-Verbindung schlägt fehl
+
+**Lösung:**
+```bash
+# Auf n8n Server
+ssh root@192.168.45.20
+
+# Falls Fehler:
+# 1. SSH Key generieren
+ssh-keygen -t ed25519 -C "n8n@botkonzept"
+
+# 2. Public Key kopieren
+ssh-copy-id root@192.168.45.20
+
+# 3. Testen
+ssh root@192.168.45.20 "ls /root/customer-installer/"
+```
+
+### Problem 3: install.sh nicht gefunden
+
+**Lösung:**
+```bash
+# Auf PVE20
+cd /root
+git clone https://backoffice.userman.de/MediaMetz/customer-installer.git
+
+# Oder Pfad im Workflow anpassen
+```
+
+### Problem 4: Datenbank-Fehler
+
+**Lösung:**
+```bash
+# Prüfen ob Tabellen existieren
+psql -U postgres -d botkonzept -c "\dt"
+
+# Falls nicht, Schema erneut ausführen
+psql -U postgres -d botkonzept < sql/botkonzept_schema.sql
+```
+
+### Problem 5: E-Mail wird nicht versendet
+
+**Lösung:**
+
+**Für Amazon SES:**
+1. Verifizieren Sie die Absender-E-Mail in AWS SES
+2. Prüfen Sie SMTP-Credentials
+3. Stellen Sie sicher, dass Sie aus dem Sandbox-Modus raus sind
+
+**Für Postfix:**
+```bash
+# Auf dem Server
+systemctl status postfix
+journalctl -u postfix -f
+
+# Test-E-Mail senden
+echo "Test" | mail -s "Test" test@example.com
+```
+
+### Problem 6: Workflow wird nicht ausgeführt
+
+**Lösung:**
+1. Prüfen Sie ob Workflow aktiviert ist (grüner Toggle oben rechts)
+2. Schauen Sie in die Execution History (linke Sidebar → Executions)
+3. Prüfen Sie die Logs jedes Nodes
+
+---
+
+## 📊 Workflow-Ablauf im Detail
+
+### Registration Workflow
+
+```
+1. Webhook empfängt POST-Request
+ ↓
+2. Validierung (E-Mail, Name, etc.)
+ ↓
+3. Passwort generieren (16 Zeichen)
+ ↓
+4. Kunde in DB anlegen (customers Tabelle)
+ ↓
+5. SSH zu PVE20 → install.sh ausführen
+ ↓
+6. JSON-Output parsen (CTID, URLs, Credentials)
+ ↓
+7. Instanz in DB speichern (instances Tabelle)
+ ↓
+8. Willkommens-E-Mail senden
+ ↓
+9. E-Mail-Versand loggen (emails_sent Tabelle)
+ ↓
+10. Success-Response an Frontend
+```
+
+**Dauer:** Ca. 2-5 Minuten (abhängig von LXC-Erstellung)
+
+### Trial Management Workflow
+
+```
+1. Cron-Trigger (täglich 9:00 Uhr)
+ ↓
+2. Alle Trial-Kunden abrufen (0-8 Tage alt)
+ ↓
+3. Für jeden Kunden:
+ - Tag 3? → 30% Rabatt-E-Mail
+ - Tag 5? → 15% Rabatt-E-Mail
+ - Tag 7? → Letzte Chance-E-Mail
+ - Tag 8? → Instanz löschen + Goodbye-E-Mail
+ ↓
+4. E-Mail-Versand loggen
+```
+
+---
+
+## 🧪 Testing-Checkliste
+
+### Frontend-Test
+- [ ] Formular öffnen: `http://192.168.0.20:8000`
+- [ ] Alle Felder ausfüllen
+- [ ] Absenden klicken
+- [ ] Erfolgsmeldung erscheint
+
+### Backend-Test
+- [ ] n8n Execution History prüfen
+- [ ] Datenbank prüfen: `SELECT * FROM customers ORDER BY created_at DESC LIMIT 1;`
+- [ ] PVE20 prüfen: `pct list | grep sb-`
+- [ ] E-Mail erhalten?
+
+### End-to-End-Test
+- [ ] Registrierung durchführen
+- [ ] E-Mail mit Zugangsdaten erhalten
+- [ ] In n8n Dashboard einloggen
+- [ ] PDF hochladen
+- [ ] Chatbot testen
+
+---
+
+## 📈 Monitoring
+
+### n8n Executions überwachen
+
+```bash
+# In n8n UI
+Sidebar → Executions → Filter: "Failed"
+```
+
+### Datenbank-Queries
+
+```sql
+-- Neue Registrierungen heute
+SELECT COUNT(*) FROM customers WHERE DATE(created_at) = CURRENT_DATE;
+
+-- Aktive Trials
+SELECT COUNT(*) FROM customers WHERE status = 'trial';
+
+-- Versendete E-Mails heute
+SELECT email_type, COUNT(*)
+FROM emails_sent
+WHERE DATE(sent_at) = CURRENT_DATE
+GROUP BY email_type;
+
+-- Trials die bald ablaufen
+SELECT * FROM trials_expiring_soon;
+```
+
+### Logs prüfen
+
+```bash
+# n8n Logs
+docker logs -f n8n
+
+# install.sh Logs
+ls -lh /root/customer-installer/logs/
+
+# Postfix Logs
+journalctl -u postfix -f
+```
+
+---
+
+## 🔐 Sicherheit
+
+### Wichtige Punkte
+
+1. **Credentials verschlüsseln**
+ - n8n verschlüsselt Credentials automatisch
+ - Encryption Key sichern: `N8N_ENCRYPTION_KEY`
+
+2. **SSH Keys schützen**
+ ```bash
+ chmod 600 ~/.ssh/id_ed25519
+ ```
+
+3. **Datenbank-Zugriff**
+ - Verwenden Sie `service_role` Key für n8n
+ - Niemals `anon` Key für Backend-Operationen
+
+4. **E-Mail-Sicherheit**
+ - SPF, DKIM, DMARC konfigurieren
+ - Absender-Domain verifizieren
+
+---
+
+## 📚 Weitere Ressourcen
+
+- **n8n Dokumentation:** https://docs.n8n.io
+- **Supabase Docs:** https://supabase.com/docs
+- **Proxmox Docs:** https://pve.proxmox.com/wiki/Main_Page
+
+---
+
+## 🆘 Support
+
+Bei Problemen:
+
+1. **Logs prüfen** (siehe Monitoring-Sektion)
+2. **n8n Execution History** ansehen
+3. **Datenbank-Queries** ausführen
+4. **Workflow Schritt für Schritt testen**
+
+**Kontakt:**
+- E-Mail: support@botkonzept.de
+- Dokumentation: Dieses Dokument
+
+---
+
+**Version:** 1.0.0
+**Letzte Aktualisierung:** 26.01.2025
+**Autor:** MediaMetz
diff --git a/REGISTRATION_TROUBLESHOOTING.md b/REGISTRATION_TROUBLESHOOTING.md
new file mode 100644
index 0000000..b97bbca
--- /dev/null
+++ b/REGISTRATION_TROUBLESHOOTING.md
@@ -0,0 +1,581 @@
+# 🔧 BotKonzept - Registrierung Troubleshooting
+
+## Häufige Probleme und Lösungen
+
+---
+
+## 🚨 Problem 1: Workflow wird nicht ausgeführt
+
+### Symptome
+- Frontend zeigt "Verbindungsfehler"
+- Keine Execution in n8n History
+- Timeout-Fehler
+
+### Diagnose
+```bash
+# 1. Prüfen ob n8n läuft
+curl -I https://n8n.userman.de
+
+# 2. Webhook-URL testen
+curl -X POST https://n8n.userman.de/webhook/botkonzept-registration \
+ -H "Content-Type: application/json" \
+ -d '{"firstName":"Test","lastName":"User","email":"test@test.de"}'
+```
+
+### Lösungen
+
+#### A) Workflow nicht aktiviert
+1. Öffnen Sie n8n
+2. Öffnen Sie den Workflow
+3. Klicken Sie auf den **Toggle oben rechts** (muss grün sein)
+4. Speichern Sie den Workflow
+
+#### B) Webhook-Pfad falsch
+1. Öffnen Sie den Workflow
+2. Klicken Sie auf "Registration Webhook" Node
+3. Prüfen Sie den Pfad: Sollte `botkonzept-registration` sein
+4. Kopieren Sie die "Production URL"
+5. Aktualisieren Sie `customer-frontend/js/main.js`:
+```javascript
+const CONFIG = {
+ WEBHOOK_URL: 'https://n8n.userman.de/webhook/botkonzept-registration',
+ // ...
+};
+```
+
+#### C) n8n nicht erreichbar
+```bash
+# Auf dem n8n Server
+docker ps | grep n8n
+docker logs n8n
+
+# Falls Container nicht läuft
+docker start n8n
+```
+
+---
+
+## 🚨 Problem 2: "Credential not found" Fehler
+
+### Symptome
+- Workflow stoppt bei einem Node
+- Fehler: "Credential 'Supabase Local' not found"
+- Execution zeigt roten Fehler
+
+### Lösung
+
+#### Schritt 1: Credentials prüfen
+1. n8n → Sidebar → **Credentials**
+2. Prüfen Sie ob folgende existieren:
+ - `Supabase Local` (Postgres)
+ - `PVE20` (SSH)
+ - `Postfix SES` (SMTP)
+
+#### Schritt 2: Credential erstellen (falls fehlend)
+
+**Supabase Local:**
+```
+Name: Supabase Local
+Type: Postgres
+Host: localhost (oder Ihr Supabase Host)
+Port: 5432
+Database: botkonzept
+User: postgres
+Password: [Ihr Passwort]
+SSL: Enabled
+```
+
+**PVE20:**
+```
+Name: PVE20
+Type: SSH (Private Key)
+Host: 192.168.45.20
+Port: 22
+Username: root
+Private Key: [Fügen Sie Ihren Private Key ein]
+```
+
+**Postfix SES:**
+```
+Name: Postfix SES
+Type: SMTP
+Host: email-smtp.eu-central-1.amazonaws.com
+Port: 587
+User: [SMTP Username]
+Password: [SMTP Password]
+From: noreply@botkonzept.de
+```
+
+#### Schritt 3: Credential im Workflow zuweisen
+1. Öffnen Sie den betroffenen Node
+2. Klicken Sie auf "Credential to connect with"
+3. Wählen Sie das richtige Credential
+4. Speichern Sie den Workflow
+
+---
+
+## 🚨 Problem 3: SSH-Verbindung zu PVE20 schlägt fehl
+
+### Symptome
+- Node "Create Customer Instance" schlägt fehl
+- Fehler: "Connection refused" oder "Permission denied"
+
+### Diagnose
+```bash
+# Auf dem n8n Server (im Container)
+docker exec -it n8n sh
+
+# SSH-Verbindung testen
+ssh root@192.168.45.20 "echo 'Connection OK'"
+```
+
+### Lösungen
+
+#### A) SSH Key nicht konfiguriert
+```bash
+# Auf dem n8n Server (Host, nicht Container)
+ssh-keygen -t ed25519 -C "n8n@botkonzept" -f ~/.ssh/n8n_key
+
+# Public Key auf PVE20 kopieren
+ssh-copy-id -i ~/.ssh/n8n_key.pub root@192.168.45.20
+
+# Private Key anzeigen (für n8n Credential)
+cat ~/.ssh/n8n_key
+```
+
+#### B) SSH Key im Container nicht verfügbar
+```bash
+# SSH Key als Volume mounten
+docker run -d \
+ --name n8n \
+ -v ~/.ssh:/home/node/.ssh:ro \
+ -v n8n_data:/home/node/.n8n \
+ -p 5678:5678 \
+ n8nio/n8n
+```
+
+#### C) Firewall blockiert
+```bash
+# Auf PVE20
+iptables -L -n | grep 22
+
+# Falls blockiert, Regel hinzufügen
+iptables -A INPUT -p tcp --dport 22 -j ACCEPT
+```
+
+---
+
+## 🚨 Problem 4: install.sh schlägt fehl
+
+### Symptome
+- SSH-Verbindung OK, aber install.sh gibt Fehler
+- Fehler: "No such file or directory"
+- Fehler: "Permission denied"
+
+### Diagnose
+```bash
+# Auf PVE20
+ls -lh /root/customer-installer/install.sh
+
+# Ausführbar?
+chmod +x /root/customer-installer/install.sh
+
+# Manuell testen
+cd /root/customer-installer
+./install.sh --help
+```
+
+### Lösungen
+
+#### A) Repository nicht geklont
+```bash
+# Auf PVE20
+cd /root
+git clone https://backoffice.userman.de/MediaMetz/customer-installer.git
+cd customer-installer
+chmod +x install.sh
+```
+
+#### B) Pfad im Workflow falsch
+1. Öffnen Sie den Node "Create Customer Instance"
+2. Prüfen Sie den Command:
+```bash
+/root/customer-installer/install.sh --storage local-zfs ...
+```
+3. Passen Sie den Pfad an falls nötig
+
+#### C) Abhängigkeiten fehlen
+```bash
+# Auf PVE20
+apt-get update
+apt-get install -y jq curl python3
+```
+
+---
+
+## 🚨 Problem 5: Datenbank-Fehler
+
+### Symptome
+- Fehler: "relation 'customers' does not exist"
+- Fehler: "permission denied for table customers"
+- Fehler: "connection refused"
+
+### Diagnose
+```bash
+# Verbindung testen
+psql -h localhost -U postgres -d botkonzept -c "SELECT 1;"
+
+# Tabellen prüfen
+psql -h localhost -U postgres -d botkonzept -c "\dt"
+```
+
+### Lösungen
+
+#### A) Schema nicht erstellt
+```bash
+# Schema erstellen
+psql -U postgres -d botkonzept < /root/customer-installer/sql/botkonzept_schema.sql
+
+# Prüfen
+psql -U postgres -d botkonzept -c "\dt"
+```
+
+#### B) Datenbank existiert nicht
+```bash
+# Datenbank erstellen
+createdb -U postgres botkonzept
+
+# Schema importieren
+psql -U postgres -d botkonzept < /root/customer-installer/sql/botkonzept_schema.sql
+```
+
+#### C) Berechtigungen fehlen
+```sql
+-- Als postgres User
+GRANT ALL ON ALL TABLES IN SCHEMA public TO service_role;
+GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO service_role;
+```
+
+#### D) Supabase: Falsche Credentials
+1. Gehen Sie zu Supabase Dashboard
+2. Settings → Database
+3. Kopieren Sie die Connection String
+4. Aktualisieren Sie das n8n Credential
+
+---
+
+## 🚨 Problem 6: E-Mail wird nicht versendet
+
+### Symptome
+- Workflow läuft durch, aber keine E-Mail
+- Fehler: "SMTP connection failed"
+- E-Mail landet im Spam
+
+### Diagnose
+```bash
+# SMTP-Verbindung testen
+telnet email-smtp.eu-central-1.amazonaws.com 587
+
+# Postfix Status (falls lokal)
+systemctl status postfix
+journalctl -u postfix -n 50
+```
+
+### Lösungen
+
+#### A) Amazon SES: E-Mail nicht verifiziert
+1. Gehen Sie zu AWS SES Console
+2. Verified Identities → Verify new email
+3. Bestätigen Sie die E-Mail
+4. Warten Sie auf Verifizierung
+
+#### B) Amazon SES: Sandbox-Modus
+1. AWS SES Console → Account Dashboard
+2. Request production access
+3. Füllen Sie das Formular aus
+4. Warten Sie auf Genehmigung (24-48h)
+
+**Workaround für Tests:**
+- Verifizieren Sie auch die Empfänger-E-Mail
+- Oder verwenden Sie Gmail für Tests
+
+#### C) SMTP-Credentials falsch
+1. AWS IAM → Users → Ihr SMTP User
+2. Security Credentials → Create SMTP credentials
+3. Kopieren Sie Username und Password
+4. Aktualisieren Sie n8n SMTP Credential
+
+#### D) SPF/DKIM nicht konfiguriert
+```bash
+# DNS-Records prüfen
+dig TXT botkonzept.de
+dig TXT _dmarc.botkonzept.de
+
+# Fehlende Records hinzufügen (bei Ihrem DNS-Provider)
+```
+
+**Benötigte DNS-Records:**
+```
+# SPF
+botkonzept.de. IN TXT "v=spf1 include:amazonses.com ~all"
+
+# DKIM (von AWS SES bereitgestellt)
+[selector]._domainkey.botkonzept.de. IN CNAME [value-from-ses]
+
+# DMARC
+_dmarc.botkonzept.de. IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@botkonzept.de"
+```
+
+---
+
+## 🚨 Problem 7: JSON-Parsing-Fehler
+
+### Symptome
+- Fehler: "Unexpected token in JSON"
+- Node "Parse Install Output" schlägt fehl
+
+### Diagnose
+```bash
+# install.sh manuell ausführen und Output prüfen
+cd /root/customer-installer
+./install.sh --storage local-zfs --bridge vmbr0 --ip dhcp --vlan 90 2>&1 | tee test-output.log
+
+# Ist der Output valides JSON?
+cat test-output.log | jq .
+```
+
+### Lösungen
+
+#### A) install.sh gibt Fehler aus
+- Prüfen Sie die Logs in `/root/customer-installer/logs/`
+- Beheben Sie die Fehler in install.sh
+- Testen Sie erneut
+
+#### B) Output enthält zusätzliche Zeilen
+1. Öffnen Sie `install.sh`
+2. Stellen Sie sicher, dass nur JSON auf stdout ausgegeben wird
+3. Alle anderen Ausgaben sollten nach stderr gehen
+
+#### C) DEBUG-Modus aktiviert
+1. Prüfen Sie ob `DEBUG=1` gesetzt ist
+2. Für Produktion: `DEBUG=0` verwenden
+3. Im Workflow: Command ohne `--debug` ausführen
+
+---
+
+## 🚨 Problem 8: Workflow zu langsam / Timeout
+
+### Symptome
+- Frontend zeigt Timeout nach 30 Sekunden
+- Workflow läuft noch, aber Frontend gibt auf
+
+### Lösung
+
+#### A) Timeout im Frontend erhöhen
+```javascript
+// In customer-frontend/js/main.js
+const response = await fetch(CONFIG.WEBHOOK_URL, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(formData),
+ signal: AbortSignal.timeout(300000), // 5 Minuten
+});
+```
+
+#### B) Asynchrone Verarbeitung
+Ändern Sie den Workflow:
+1. Webhook gibt sofort Response zurück
+2. Instanz-Erstellung läuft im Hintergrund
+3. E-Mail wird gesendet wenn fertig
+
+**Workflow-Änderung:**
+- Nach "Create Customer in DB" → Sofort Response
+- Rest des Workflows läuft asynchron weiter
+
+---
+
+## 🚨 Problem 9: Doppelte Registrierungen
+
+### Symptome
+- Kunde registriert sich mehrmals
+- Mehrere Einträge in `customers` Tabelle
+- Mehrere LXC-Container
+
+### Lösung
+
+#### A) E-Mail-Unique-Constraint prüfen
+```sql
+-- Prüfen ob Constraint existiert
+SELECT conname, contype
+FROM pg_constraint
+WHERE conrelid = 'customers'::regclass;
+
+-- Falls nicht, hinzufügen
+ALTER TABLE customers ADD CONSTRAINT customers_email_unique UNIQUE (email);
+```
+
+#### B) Workflow anpassen
+Fügen Sie einen Check-Node hinzu:
+```javascript
+// Vor "Create Customer in DB"
+const email = $json.body.email;
+const existing = await $('Postgres').execute({
+ query: 'SELECT id FROM customers WHERE email = $1',
+ values: [email]
+});
+
+if (existing.length > 0) {
+ throw new Error('E-Mail bereits registriert');
+}
+```
+
+---
+
+## 🚨 Problem 10: Trial-Management läuft nicht
+
+### Symptome
+- Keine E-Mails an Tag 3, 5, 7
+- Cron-Workflow wird nicht ausgeführt
+
+### Diagnose
+```bash
+# In n8n: Executions filtern nach "Trial Management"
+# Prüfen ob täglich um 9:00 Uhr ausgeführt wird
+```
+
+### Lösungen
+
+#### A) Workflow nicht aktiviert
+1. Öffnen Sie "BotKonzept - Trial Management"
+2. Aktivieren Sie den Workflow (Toggle oben rechts)
+
+#### B) Cron-Expression falsch
+1. Öffnen Sie den Node "Daily at 9 AM"
+2. Prüfen Sie die Expression: `0 9 * * *`
+3. Testen Sie mit: https://crontab.guru/#0_9_*_*_*
+
+#### C) Keine Trial-Kunden vorhanden
+```sql
+-- Prüfen
+SELECT * FROM customers WHERE status = 'trial';
+
+-- Test-Kunde erstellen
+INSERT INTO customers (email, first_name, last_name, status, created_at)
+VALUES ('test@example.com', 'Test', 'User', 'trial', NOW() - INTERVAL '3 days');
+```
+
+---
+
+## 📊 Debugging-Checkliste
+
+Wenn ein Problem auftritt, gehen Sie diese Checkliste durch:
+
+### 1. Frontend
+- [ ] Browser-Konsole prüfen (F12)
+- [ ] Network-Tab prüfen (Request/Response)
+- [ ] Webhook-URL korrekt?
+
+### 2. n8n
+- [ ] Workflow aktiviert?
+- [ ] Execution History prüfen
+- [ ] Jeden Node einzeln testen
+- [ ] Credentials korrekt?
+
+### 3. Datenbank
+- [ ] Verbindung OK?
+- [ ] Tabellen existieren?
+- [ ] Berechtigungen OK?
+- [ ] Daten werden gespeichert?
+
+### 4. PVE20
+- [ ] SSH-Verbindung OK?
+- [ ] install.sh existiert?
+- [ ] install.sh ausführbar?
+- [ ] Manueller Test OK?
+
+### 5. E-Mail
+- [ ] SMTP-Verbindung OK?
+- [ ] Absender verifiziert?
+- [ ] Spam-Ordner prüfen?
+- [ ] DNS-Records korrekt?
+
+---
+
+## 🔍 Logs & Debugging
+
+### n8n Logs
+```bash
+# Container Logs
+docker logs -f n8n
+
+# Execution Logs
+# In n8n UI: Sidebar → Executions → Click on execution
+```
+
+### install.sh Logs
+```bash
+# Auf PVE20
+ls -lh /root/customer-installer/logs/
+tail -f /root/customer-installer/logs/install_*.log
+```
+
+### PostgreSQL Logs
+```bash
+# Auf DB Server
+tail -f /var/log/postgresql/postgresql-*.log
+
+# Oder in Supabase Dashboard: Logs
+```
+
+### E-Mail Logs
+```bash
+# Postfix
+journalctl -u postfix -f
+
+# Amazon SES
+# AWS Console → SES → Sending Statistics
+```
+
+---
+
+## 🆘 Wenn nichts hilft
+
+### Schritt-für-Schritt-Debugging
+
+1. **Workflow deaktivieren**
+2. **Jeden Node einzeln testen:**
+ ```
+ - Webhook → Test mit curl
+ - Validate Input → Manuell ausführen
+ - Generate Password → Output prüfen
+ - Create Customer → DB prüfen
+ - SSH → Manuell auf PVE20 testen
+ - Parse Output → JSON validieren
+ - Save Instance → DB prüfen
+ - Send Email → Test-E-Mail
+ ```
+3. **Logs sammeln:**
+ - n8n Execution
+ - install.sh Log
+ - PostgreSQL Log
+ - E-Mail Log
+4. **Support kontaktieren** mit allen Logs
+
+---
+
+## 📞 Support-Kontakt
+
+**E-Mail:** support@botkonzept.de
+
+**Bitte inkludieren:**
+- Fehlermeldung (vollständig)
+- n8n Execution ID
+- Logs (n8n, install.sh, DB)
+- Was Sie bereits versucht haben
+
+---
+
+**Version:** 1.0.0
+**Letzte Aktualisierung:** 26.01.2025