Skip to content

MaxBehrens1337/Dampsoft-

Repository files navigation

DS-Insights – Praxis-Cockpit für Zahnarztpraxen 🦷

Produktionsreifes Web-Dashboard für Zahnarztpraxen mit Advanced Analytics & Integration

Version License TypeScript Docker

📋 Übersicht

DS-Insights ist eine vollständige, produktionsreife Business Intelligence Lösung für Zahnarztpraxen mit:

  • 📊 Real-time KPI Dashboards - Tagesumsatz, Termine, Auslastung
  • 📈 Advanced Analytics - Prognosen, Anomalie-Erkennung, Trends
  • 📧 E-Mail-Benachrichtigungen - Automatische Tagesberichte & Alerts
  • 📄 PDF-Export - Professionelle Reports zum Download
  • 🔌 Integration API - Anbindung an Praxisverwaltungssysteme
  • 🏆 Benchmarking - Vergleich mit anonymisierten Branchendaten
  • 🔒 Enterprise Security - Rate Limiting, Input-Validierung, HTTPS

⚡ Schnellstart - Drei Wege zur Installation

Neu: Probleme bei der Installation? Wir haben es einfacher gemacht!

🧙‍♂️ Option 1: Interaktiver Wizard (Empfohlen für Einsteiger)

Der Setup-Wizard führt Sie Schritt für Schritt durch die Installation:

# Unix/Mac/Linux
chmod +x wizard.sh
./wizard.sh

# Windows PowerShell
.\wizard.ps1

Was macht der Wizard?

  • ✅ Prüft automatisch alle Voraussetzungen
  • ✅ Fragt nach Ihren Präferenzen (Development vs. Production)
  • ✅ Konfiguriert alles interaktiv
  • ✅ Startet optional die Services direkt

🤖 Option 2: Automatisches Setup

Für erfahrene Nutzer - komplett automatisiert:

# Unix/Mac/Linux
chmod +x setup.sh
./setup.sh

# Windows PowerShell
.\setup.ps1

Läuft durch, installiert alles, und gibt Ihnen klare Anweisungen zum Starten.

📚 Option 3: Manuelle Installation

Siehe QUICKSTART.md für eine detaillierte Schritt-für-Schritt-Anleitung.

🔍 Probleme? Health Check ausführen!

# Unix/Mac/Linux
./health-check.sh

# Windows PowerShell
.\health-check.ps1

Zeigt Ihnen sofort, was funktioniert und was nicht.

Weitere Hilfe:


🚀 Features

🎯 Kernfunktionen

Für Praxisinhaber (Owner)

  • ✅ Vollzugriff auf alle Dashboards & Analytics
  • ✅ PDF-Export von Reports
  • ✅ E-Mail-Benachrichtigungen konfigurieren
  • ✅ Integration API verwalten
  • ✅ Praxis-Konfiguration & Einstellungen

Für Praxismanager (Manager)

  • ✅ Zugriff auf KPIs, Trends & Benchmarks
  • ✅ PDF-Reports exportieren
  • ✅ Erweiterte Analytics einsehen

Für Rezeption (Assistant)

  • ✅ Tages- und Wochenübersicht
  • ✅ Kritische Termine-Liste
  • ✅ No-Show-Risiko-Bewertung

🆕 Produktionsreife Features

1️⃣ PostgreSQL Datenbank

  • Production: PostgreSQL mit Connection Pooling
  • Development: SQLite für einfaches lokales Testing
  • ✅ Automatische Schema-Migration
  • ✅ Optimierte Indizes für schnelle Queries

2️⃣ Docker Deployment

  • ✅ Multi-stage Docker Builds für optimale Image-Größe
  • ✅ Docker Compose Setup: Backend + Frontend + PostgreSQL + Redis
  • ✅ Health Checks für alle Services
  • ✅ Persistent Volumes für Daten

3️⃣ Advanced Security

  • Helmet - Security Headers (CSP, HSTS, etc.)
  • Rate Limiting - Schutz vor Brute-Force
  • Input Validation - Zod-basierte Schema-Validierung
  • XSS/SQL Injection Protection
  • Redis Sessions - Skalierbare Session-Speicherung
  • CORS - Konfigurierbare Cross-Origin Policy

4️⃣ Integration API

  • REST API für externe Systeme
  • Webhook Support mit Signatur-Verifikation
  • API Key Management
  • ✅ Daten Import/Export (Termine, Patienten)
  • ✅ Kompatibel mit Praxisverwaltungssystemen

5️⃣ PDF Export

  • ✅ Dashboard-Reports als PDF
  • ✅ Benchmark-Berichte
  • ✅ Professionelles Layout mit Branding
  • ✅ Automatischer Download

6️⃣ E-Mail-Benachrichtigungen

  • ✅ Tägliche Zusammenfassungen
  • ✅ Kritische Termin-Alerts
  • ✅ Monatliche Benchmark-Reports
  • ✅ SMTP-Integration (Gmail, SendGrid, etc.)
  • ✅ HTML-Templates

7️⃣ Erweiterte Analytics

  • Umsatz-Prognosen (nächste 1-3 Monate)
  • Anomalie-Erkennung (ungewöhnliche Tage/Werte)
  • Trend-Analysen (Umsatz, No-Shows, etc.)
  • No-Show Wahrscheinlichkeit (ML-basierter Score)
  • Automatische Insights generierung

🛠️ Tech-Stack

Backend

Technologie Verwendung
Node.js 20 Runtime
TypeScript Type Safety
Express REST API Framework
PostgreSQL Production Database
SQLite Development Database
Redis Session Store & Caching
Helmet Security Headers
Express-Rate-Limit DDoS Protection
Zod Schema Validation
PDFKit PDF Generation
Nodemailer Email Delivery
bcrypt Password Hashing

Frontend

Technologie Verwendung
React 18 UI Framework
TypeScript Type Safety
Vite Build Tool
Tailwind CSS Styling
React Router Navigation
Recharts Data Visualization
Lucide React Icons

Infrastructure

Technologie Verwendung
Docker Containerization
Docker Compose Orchestration
Nginx Reverse Proxy & Static Files
PostgreSQL 16 Database
Redis 7 Caching & Sessions

📦 Installation & Deployment

💡 Tipp: Nutzen Sie die automatisierten Setup-Scripts oben für eine problemlose Installation!

Automatisierte Installation (Empfohlen)

# Interaktiver Wizard (am einfachsten)
./wizard.sh  # Unix/Mac/Linux
.\wizard.ps1 # Windows

# Oder automatisches Setup
./setup.sh   # Unix/Mac/Linux
.\setup.ps1  # Windows

Die Scripts kümmern sich um alles: Dependencies, Konfiguration, Datenbank-Setup!

Manuelle Installation

Wenn Sie die Installation lieber manuell durchführen möchten:

Option 1: Docker Compose (Production)

# 1. Repository klonen
git clone <your-repo-url>
cd Dampsoft-

# 2. Environment-Variablen konfigurieren
cp .env.production.example .env.production
# WICHTIG: Bearbeiten Sie .env.production mit sicheren Passwörtern!

# 3. Docker Compose starten
docker-compose --env-file .env.production up -d

# Fertig! Anwendung läuft auf:
# - Frontend: http://localhost (Port 80)
# - Backend: http://localhost:3001
# - PostgreSQL: localhost:5432
# - Redis: localhost:6379

Option 2: Lokale Installation (Development)

Backend starten:

cd backend
npm install
cp .env.example .env
# Optional: .env anpassen
npm run build
npm run dev

→ Backend läuft auf http://localhost:3001

Frontend starten (neues Terminal):

cd frontend
npm install
npm run dev

→ Frontend läuft auf http://localhost:5173

Installation überprüfen:

./health-check.sh  # Unix/Mac/Linux
.\health-check.ps1 # Windows

🔧 Konfiguration

Wichtige Environment-Variablen

# Datenbank-Typ wählen
DB_TYPE=postgres  # oder 'sqlite' für Development

# PostgreSQL Verbindung
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=ds_insights
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your-secure-password

# Redis für Sessions
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your-redis-password

# E-Mail (SMTP)
EMAIL_ENABLED=true
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password

# Integration API
INTEGRATION_API_ENABLED=true
WEBHOOK_SECRET=your-webhook-secret

# Sicherheit
SESSION_SECRET=min-32-chars-random-string
CORS_ORIGIN=https://yourdomain.com

Vollständige Liste siehe .env.production.example


🎯 Demo-Zugänge

Rolle E-Mail Passwort Zugriff
Praxisinhaber owner@praxis-mueller.de demo123 Vollzugriff
Praxismanager manager@praxis-mueller.de demo123 KPIs & Reports
Rezeption assistant@praxis-mueller.de demo123 Tagesübersicht

📂 Projektstruktur

ds-insights/
├── backend/                        # Backend (Node.js + Express)
│   ├── src/
│   │   ├── config/                # Konfiguration (DB, Env)
│   │   ├── controllers/           # HTTP Request Handler
│   │   ├── middleware/            # Auth, Security, Validation
│   │   ├── models/                # TypeScript Interfaces
│   │   ├── repositories/          # Datenzugriff (PostgreSQL/SQLite)
│   │   ├── services/              # Business-Logik
│   │   │   ├── KpiService.ts      # KPI-Berechnungen
│   │   │   ├── BenchmarkService.ts
│   │   │   ├── PdfService.ts      # PDF-Export
│   │   │   ├── EmailService.ts    # E-Mail
│   │   │   ├── AnalyticsService.ts # Advanced Analytics
│   │   │   └── IntegrationService.ts
│   │   ├── utils/                 # Hilfsfunktionen
│   │   └── index.ts               # Server Entry Point
│   ├── Dockerfile                 # Multi-stage Production Build
│   ├── package.json
│   └── tsconfig.json
│
├── frontend/                       # Frontend (React + Vite)
│   ├── src/
│   │   ├── components/            # UI-Komponenten
│   │   ├── contexts/              # React Context (Auth)
│   │   ├── pages/                 # Seiten (Dashboards)
│   │   │   ├── TodayPage.tsx      # Heute Dashboard
│   │   │   ├── TrendsPage.tsx     # Trends & Langfrist
│   │   │   ├── BenchmarkPage.tsx  # Benchmark-Vergleich
│   │   │   └── SettingsPage.tsx
│   │   ├── services/              # API-Calls
│   │   └── types/                 # TypeScript Typen
│   ├── Dockerfile                 # Nginx Production Build
│   ├── nginx.conf                 # Nginx-Konfiguration
│   ├── package.json
│   └── vite.config.ts
│
├── docker-compose.yml             # Orchestrierung: Backend + Frontend + DB + Redis
├── .env.production.example        # Produktions-Environment-Template
└── README.md

🔐 Sicherheitsfeatures

Implementierte Schutzmaßnahmen

  1. Authentication & Authorization

    • Session-basierte Authentifikation
    • Passwort-Hashing mit bcrypt
    • Rollenbasierte Zugriffskontrolle (RBAC)
    • Session-Speicherung in Redis (produktions)
  2. Input Validation

    • Zod-Schema-Validierung für alle Eingaben
    • XSS-Protection durch Sanitization
    • SQL Injection Prevention (Prepared Statements)
  3. Rate Limiting

    • Global: 100 Requests / 15 Min
    • Login: 5 Versuche / 15 Min
    • IP-basiertes Tracking
  4. Security Headers (Helmet)

    • Content Security Policy (CSP)
    • HSTS (HTTP Strict Transport Security)
    • X-Frame-Options, X-Content-Type-Options
  5. Weitere Maßnahmen

    • CORS-Konfiguration
    • Suspicious Activity Logging
    • Null-Byte-Removal
    • Error Handling ohne Stack Traces in Production

📡 API-Dokumentation

Authentication

POST /api/auth/login
POST /api/auth/logout
GET  /api/auth/me

Dashboards

GET /api/dashboard/today
GET /api/dashboard/weekly
GET /api/dashboard/monthly?year=2024&month=11
GET /api/dashboard/trends?from=2024-01-01&to=2024-12-31

Analytics (NEU)

GET  /api/analytics/advanced
POST /api/analytics/no-show-probability

Export (NEU)

POST /api/export/pdf/dashboard
POST /api/export/pdf/benchmark

Integration API (NEU)

POST /api/integration/import/appointments
GET  /api/integration/export/appointments
POST /api/integration/webhook
POST /api/integration/api-key/generate

Benchmark

GET /api/benchmark/overview

Practice

GET /api/practice
PUT /api/practice

🧪 Testing

cd backend
npm test              # Unit-Tests ausführen
npm run test:watch   # Watch-Modus

🚦 Production Deployment Checklist

  • .env.production mit sicheren Secrets konfiguriert
  • SESSION_SECRET mindestens 32 Zeichen lang
  • POSTGRES_PASSWORD stark und einzigartig
  • REDIS_PASSWORD gesetzt
  • CORS_ORIGIN auf Ihre Domain gesetzt
  • EMAIL_ENABLED=true und SMTP konfiguriert (optional)
  • SSL-Zertifikate vorhanden (Let's Encrypt empfohlen)
  • Reverse Proxy (Nginx/Traefik) für HTTPS
  • Firewall konfiguriert (nur Ports 80, 443 offen)
  • Backup-Strategie für PostgreSQL
  • Monitoring Setup (optional: Sentry, DataDog)

📊 Performance & Skalierung

Optimierungen

  • ✅ Multi-stage Docker Builds (kleinere Images)
  • ✅ PostgreSQL Connection Pooling (max 20 Connections)
  • ✅ Redis für Session-Caching
  • ✅ Nginx Gzip-Compression
  • ✅ Static Asset Caching (1 Jahr)
  • ✅ Database Indizes für häufige Queries

Empfohlene Ressourcen

Minimum (1-5 Praxen)

  • 2 GB RAM
  • 2 vCPUs
  • 20 GB Storage

Empfohlen (5-20 Praxen)

  • 4 GB RAM
  • 4 vCPUs
  • 50 GB Storage

🔄 Updates & Wartung

Datenbank-Backups (PostgreSQL)

# Backup erstellen
docker exec ds-insights-postgres pg_dump -U postgres ds_insights > backup_$(date +%Y%m%d).sql

# Wiederherstellen
cat backup.sql | docker exec -i ds-insights-postgres psql -U postgres ds_insights

Logs ansehen

# Alle Container
docker-compose logs -f

# Nur Backend
docker-compose logs -f backend

# Nur Frontend
docker-compose logs -f frontend

🐛 Troubleshooting

Probleme bei der Installation oder Ausführung?

Schnelldiagnose

# Automatischer Health Check
./health-check.sh  # Unix/Mac/Linux
.\health-check.ps1 # Windows

Der Health Check zeigt Ihnen sofort:

  • ✅ Was funktioniert
  • ❌ Was nicht funktioniert
  • 💡 Wie Sie es beheben können

Umfassende Problemlösungen

📖 Siehe TROUBLESHOOTING.md für detaillierte Lösungen zu:

  • Installation & Setup Problemen
  • Backend-Problemen (Port-Konflikte, Datenbank-Fehler)
  • Frontend-Problemen (Build-Fehler, API-Verbindung)
  • Datenbank-Problemen (SQLite & PostgreSQL)
  • Docker-Problemen (Container starten nicht)
  • Performance-Problemen
  • Security & Authentication
  • Allen häufigen Fehlermeldungen

Häufigste Probleme (Schnelllösung)

Backend startet nicht:

# Port-Konflikt beheben
lsof -ti:3001 | xargs kill -9  # Unix/Mac
# Oder Port in backend/.env ändern: PORT=3002

Frontend kann Backend nicht erreichen:

# 1. Backend läuft?
curl http://localhost:3001/health

# 2. API URL korrekt?
cat frontend/.env  # Sollte VITE_API_URL=http://localhost:3001 sein

Docker Container starten nicht:

# Alte Container entfernen
docker-compose down
docker-compose up -d

# Logs prüfen
docker-compose logs -f

Immer noch Probleme? → Siehe TROUBLESHOOTING.md für 95% aller Lösungen!


🤝 Support & Contributing


📝 Lizenz

MIT License - siehe LICENSE-Datei für Details


🎉 Credits

Entwickelt mit ❤️ für moderne Zahnarztpraxen

Powered by:

  • Node.js & TypeScript
  • React & Tailwind CSS
  • PostgreSQL & Redis
  • Docker & Nginx

Version 1.0.0 - Production Ready 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors