# HiveGrid Codebase Feature-Inventur Quelle: `/Users/raffaelsheikh/Documents/GitHub/archive/hivegrid-cloud` Stand: Repo-Snapshot (letzte Commits Mai 2026, Codebasis verworfen wegen Komplexitaet/Spaghetti). > Diese Inventur listet was die Codebasis in Form von Code, Routes, Schemas und Modul-Verzeichnissen enthielt — **nicht** was reibungslos funktionierte. Reifegrad-Einschaetzung beruht auf Vorhandensein/Tiefe der Files, nicht auf Lauffaehigkeit. --- ## Tech-Stack-Kurzuebersicht React Router v7 (Remix-basiert, SSR + Client Hydration) auf Node.js 20 / pnpm 10. ORM: Prisma mit Multi-File-Schema (~50 `.prisma`-Dateien). DB: PostgreSQL 16 mit pgvector. Cache/Queue: Redis 7 + BullMQ. Frontend: Tailwind CSS, Headless UI, Subframe-UI-Components, Lucide/Heroicons, react-i18next. AI: AI SDK (Anthropic, OpenAI, OpenRouter, Scaleway, Whisper). Tests: Vitest + Playwright (inkl. VRT). Deployment: PM2 mit 4 Prozessen (`web`, `api`, `worker`, `scheduler`), Caddy als Reverse Proxy, Scaleway-Infrastruktur, Docker Compose. Multi-Tenant via Postgres Row-Level-Security (Dual-DB-URLs). Observability: Sentry. Geplante Mobile-App: Expo (nur Skeleton vorhanden, nicht ausgebaut). --- ## Domaenen-Modell (Entities) **Account / Auth / Tenant** - `User` — globale Login-Identitaet (email/password, oauth) - `AdminUser` — globaler Plattform-Admin (super-admin) - `Tenant` — Mandant (Handwerksbetrieb), inkl. `TenantType` - `TenantUser` — Mitgliedschaft eines Users in einem Tenant (Rolle, Status) - `TenantUserInvitation` — Email-Einladung - `Registration`, `Blacklist`, `TenantIpAddress`, `AccountDeletionRequest` - `Role`, `Permission`, `RolePermission`, `UserRole`, `Group`, `GroupUser` — RBAC - `ApiKey`, `ApiKeyLog` — API-Key-Auth fuer extern **CRM** - `Company` — Firmen-Stammdaten (B2B-Kunde) - `Contact` — Personen (Privat/Ansprechpartner), `ContactHistory` (Aktivitaeten) - `Pipeline`, `PipelineStage` — konfigurierbare Sales-Pipelines - `Deal`, `DealActivity` — Deal-Karten + Aktivitaets-Log - `DealForm` — verknuepfte Form-Submissions - `HiveNumberSeq` — fortlaufende CRM-Nummern **Projekt-/Auftragsmanagement** - `ProjectPipeline`, `ProjectPipelineStage` — Auftragspipelines - `Project`, `ProjectActivity`, `ProjectMember` — Auftraege + Beteiligte - `AcceptanceProtocol` — digitales Abnahmeprotokoll - `Task` — Aufgaben (mit Zuweisung, Deadline) - `ProjectTemplate` — Projekt-Vorlagen - `ProjectForm` — am Projekt haengende Formulare - `ScheduleEntry` — Plantafel-/Termin-Eintrag **Automation Engine** - `AutomationRule`, `AutomationExecution`, `AutomationCredential` **Termine / Booking** - `BookingPage`, `BookingPageProvider` — Calendly-aehnliche oeffentliche Buchungsseite - `Appointment` — Termin - `AvailabilityRule`, `AvailabilityException` — Verfuegbarkeiten **Kalender-Integration** - `CalendarEvent`, `CalendarEventMapping`, `CalendarSyncCursor`, `CalendarWebhookEvent` (Google + Microsoft) **Email** - `TenantInboundAddress`, `Email`, `EmailRead`, `EmailCc`, `EmailAttachment`, `EmailSender` — Inbound-Mailbox - `Campaign`, `OutboundEmail`, `OutboundEmailOpen`, `OutboundEmailClick` — Email-Marketing - `EmailIntegrationMailbox`, `EmailIntegrationMessage`, `EmailIntegrationSyncCursor`, `EmailIntegrationWebhookEvent` — externe Mail-Sync (Gmail/Outlook) - `TenantSendingDomain` — eigener Absender-Domain mit DKIM **Dokument-Signatur (PandaDoc/DocuSign)** - `SignatureProviderConnection`, `DealSignatureDocument`, `DealSignatureSigner`, `DealSignatureStatusTransition`, `SignatureWebhookEvent` **Telefonie (Aircall/Sipgate)** - `TelephonyConnection`, `TelephonyCallSession`, `TelephonyWebhookEvent` **WhatsApp** - `WhatsAppBusinessAccount`, `WhatsAppChatMessage`, `WhatsAppOptIn`, `WhatsAppTemplate`, `WhatsAppQuickReply`, `WhatsAppMessageLog` (Meta WABA + Unipile) **Team-Chat (intern)** - `TeamChat`, `TeamChatMember`, `TeamChatMessage`, `TeamChatPinnedMessage`, `TeamChatReaction` **Form Builder** - `Form`, `FormSubmission`, `FormLink`, `FormsTag`, `FormTag`, `FormAction`, `FormActionLog`, `FormLog`, `FormFile` **Kundenportal** - `Portal`, `PortalUser`, `PortalPage`, `PortalUserRegistration` - `CustomerPortalAccount`, `CustomerPortalMagicLinkToken`, `CustomerPortalSession`, `CustomerPortalProjectAccess`, `CustomerPortalProjectDocument` - `PortalSubscription*` — Abo-Verwaltung im Portal **HR-Hub / Mitarbeiterplattform** - `HrAnnouncement` (+ `Read`/`Reaction`/`Comment`) - `HrRequest`, `HrRequestTemplate` — generische Antragsformulare - `HrEmployeeDocument` — Mitarbeiter-Dokumente - `HrLocation` — Standorte - `HrResource`, `HrQuickLink` - `HrSurvey`, `HrSurveySubmission` — Umfragen - `EmployeePayslip`, `EmployeeUploadReminder`, `EmployeeUploadReminderDispatch` - `EmployeePasswordSafeEntry`, `EmployeePasswordSafeVault` - `EmployeeVacationRequest`, `EmployeeSickLeaveReport` **Knowledge Base / Wiki** - `KnowledgeBase`, `KnowledgeBaseCategory`, `KnowledgeBaseCategorySection` - `KnowledgeBaseArticle`, `KnowledgeBaseArticleEntityLink`, `KnowledgeBaseRelatedArticle` - `KnowledgeBaseViews`, `KnowledgeBaseArticleViews`/`Upvotes`/`Downvotes` **Help-Desk / Support** - `Feedback`, `Survey`, `SurveyItem`, `SurveySubmission`, `SurveySubmissionResult` - `SupportChatThread`, `SupportChatMessage` **Files / Storage** - `File`, `FileUploadProgress`, `FileChunk` **Analytics** - `AnalyticsSettings`, `AnalyticsUniqueVisitor`, `AnalyticsPageView`, `AnalyticsEvent` **KI / AI** - `Chat`, `ChatMessage`, `ChatMessagePart` — Conversations mit AI-Assistent - `AiSettings`, `TenantAgentSettings`, `AiCredits`, `AiTokenUsage` - `HelpArticleEmbedding`, `TenantEmbedding` — RAG-Vectors (pgvector) - `GeneratedObject` — strukturierte AI-Outputs **Tenant-Assistant ("HiveMind")** - `TenantAssistantConversation`, `TenantAssistantGroundingReference` - `UserAIMemory`, `TenantAIKnowledge` - `HiveMindScheduledAction`, `HiveMindActionLog`, `HiveMindCustomTool`, `HiveMindInsight` **Prompt-Flows** - `PromptFlowGroup`, `PromptFlow`, `PromptFlowInputVariable`, `PromptTemplate`, `PromptFlowOutput`, `PromptFlowOutputMapping`, `PromptFlowExecution`, `PromptTemplateResult` **Apps Engine / App-Catalog** - `App`, `DataConnection`, `AppSyncRun`, `AppSyncRunLog`, `AppSyncItem` - `CommunityApp`, `CommunityAppInstall` — Community-Marketplace - `TemplateMarketplaceDefinition`, `TemplateMarketplacePurchase`, `TemplateMarketplaceInstall` **KWP-Integration (Handwerks-ERP)** - `KwpProjectQueue`, `KwpProjectNumberSequence`, `KwpProjectNumberReservation` - `KwpApiKey`, `KwpSettings`, `KwpRegistry`, `KwpErrorReport`, `KwpDocument` **Subscriptions / Billing** - `SubscriptionProduct`, `SubscriptionPrice`, `SubscriptionFeature` - `SubscriptionUsageBasedPrice`, `SubscriptionUsageBasedTier` - `TenantSubscription`, `TenantSubscriptionProduct`, `TenantSubscriptionProductPrice`, `TenantSubscriptionUsageRecord` - `CheckoutSessionStatus`, `Credit` **API & Webhooks** - `IntegrationApiRequest`, `WebhookSubscription`, `WebhookDelivery`, `WebhookDeliveryAttempt`, `IncomingWebhookIngestion` - `Event`, `EventWebhookAttempt` — interne Event-Bus-artige Persistenz **Onboarding / Demo** - `Onboarding`, `OnboardingFilter`, `OnboardingStep`, `OnboardingSession`, `OnboardingSessionAction`, `OnboardingSessionFilterMatch`, `OnboardingSessionStep` - `OnboardingDemoProvisioning`, `OnboardingInvitationDispatch` **Sonstiges** - `Page`, `PageBlock`, `PageMetaTag` — CMS/Marketing-Seiten - `Site`, `MySiteDemoSubmission` - `BlogCategory`, `BlogTag`, `BlogPost`, `BlogPostTag` — Blog - `Widget`, `DashboardLayout` — konfigurierbare Dashboards - `AuditLog` — Audit-Trail - `FeatureFlag`, `FeatureFlagFilter` - `NotificationPreference`, `NotificationDevice` (Push) - `IpAddress`, `IpAddressLog` - `GdprExportJob` — DSGVO-Datenexport --- ## Feature-Module (sortiert nach Bedeutung) ### CRM-Kern (Kontakte, Companies, Deals, Pipelines) - **User-Sicht:** Kontakt- und Firmenverzeichnis, Deal-Pipeline mit Kanban + Listen-View, Deal-Detailseite mit Aktivitaets-Historie, Lead-Inbox, Statistiken zu Leads, Lead-CSV-Import. - **Routes:** `/$tenant/contacts` (Index, New, Detail), `/$tenant/contacts/companies` (Index, Detail, New), `/$tenant/deals` (Index/Kanban, Liste, Detail, New, Archive), `/$tenant/leads` (Inbox, Statistiken, Import). - **Operationen:** CRUD Kontakte/Firmen, CRM-Sequenznummern, Deal-Stage-Aenderung mit Side-Effects (Automationen), Aktivitaets-Logging, Duplikat-Erkennung (`api.contacts.duplicates`), Kontakt-Suche (`api.contacts.search`), Activity-Timeline. - **Reifegrad:** vollstaendig. ### Projekt-/Auftragsmanagement - **User-Sicht:** Projektpipeline (Kanban), Projekt-Detail mit Members/Schedule/Tasks/Forms, Abnahmeprotokoll-Erstellung, Plantafel (Ressourcen-/Termin-Planung), Archivansicht. - **Routes:** `/$tenant/projects` (Index, Detail, New, Archive, Plantafel, Acceptance, Acceptance/new). - **Operationen:** Projekt-Erstellung aus gewonnenem Deal (Handoff-Service), kombinierte Activity-Timeline, Abnahmeprotokoll mit Kunden-Signatur, Projektmitglieder-Verwaltung, Projekt-Templates, Projekt-Archivierung. - **Reifegrad:** vollstaendig (Plantafel, Acceptance, Handoff sind alle implementiert). ### Automation Engine ("Workflow Studio") - **User-Sicht:** Tab-basierte Studio-UI (Workflows-Liste / Flow-Editor / API+Webhooks / Execution Logs), Flow-Canvas (visuell), Workflow-Templates, Trigger->Action-Regeln. - **Routes:** `/$tenant/automations`, Audit-/Execution-Logs. - **Operationen:** Trigger-/Action-Registry mit ~50 Triggern und ~45 Actions (siehe Liste unten), Loop-Guard, Metering, BullMQ-Queue + Worker, Scheduled-Rule-Worker, Stage-Stuck-Eskalation (cron im Scheduler), Credentials-Verwaltung pro Tenant. - **Reifegrad:** sehr ausgepraegt (eine der reifsten Module). ### Team-Chat - **User-Sicht:** Chat-Index mit Threads, Chat-Detail, neuer Chat, Pinned Messages, Reactions, Threads (`chat.$id.thread.$threadId`). - **Routes:** `/$tenant/chat`, `/$tenant/chat/$id`, `/$tenant/chat/new`, Thread-Detail. - **Operationen:** Channel-Mitgliederverwaltung, Datei-Upload im Chat, Link-Preview, Media-Service, WebSocket-Server (`app/modules/chat/ws`). - **Reifegrad:** vollstaendig (mit Pinned, Reactions, Threads). ### Email-Inbox & Email-Marketing - **User-Sicht:** Tenant-Mailbox (eingehende Mails verknuepft mit Kontakten/Deals), Marketing-Kampagnen-Builder, Sender-Verwaltung, Activity-Tracking (Open/Click). - **Routes:** `/$tenant/emails`, `/$tenant/emails/$id`, `/$tenant/email-marketing` (Index, Activity, Senders, Campaigns Index/Detail/New). - **Operationen:** Inbound-Webhooks (MailerSend, Postmark), eigene Sending-Domain mit DKIM (`email-domain`), Outbound-Tracking, Campaign-Scheduling-Cron (`api.email-marketing.cron`), Linking zu Kontakten/Deals. - **Reifegrad:** vollstaendig. ### WhatsApp-Integration - **User-Sicht:** WhatsApp-Inbox (`/$tenant/whatsapp`), Chat pro Telefonnummer (`/$tenant/whatsapp/$phone`), Connect-Flow. - **Operationen:** Provider-Abstraktion (Meta WABA + Unipile), Templates, Quick-Replies, Opt-Ins, Avatare/Media-Endpoints, Webhook-Handling, Sync-Service. - **Reifegrad:** vollstaendig (zwei Provider, Templates, Sync). ### Telefonie-Integration - **User-Sicht:** Click-to-Call aus Deal/Contact, Anruf-Logs in Activity-Stream, Settings fuer Telefonie unter Settings/Integrations. - **Operationen:** Aircall- und Sipgate-Adapter, Webhook-Handler, Call-Log-Sync, automatisches Verknuepfen von Anrufen mit Kontakten/Deals. - **Reifegrad:** vollstaendig. ### Signatur-Integration (PandaDoc / DocuSign) - **User-Sicht:** Angebot/PDF in Deal hochladen -> Signatur-Anfrage erstellen, Signer-Status verfolgen, automatischer Stage-Wechsel bei Unterzeichnung. - **Operationen:** PandaDoc- + DocuSign-Provider, Webhook-Verarbeitung, Status-Transition-Logging, Multi-Signer-Support. - **Reifegrad:** vollstaendig. ### Booking / Termin-Buchung (Calendly-aehnlich) - **User-Sicht:** Oeffentliche Booking-Page (`/public/booking/$slug`), Verfuegbarkeit pflegen (`/$tenant/availability`), Buchungen managen (`/$tenant/bookings`, `/$tenant/bookings/$id`), Mitarbeiter-Kalender (`/$tenant/calendar`). - **Operationen:** AvailabilityRule + Exception, Multi-Provider (mehrere Mitarbeiter pro Booking-Page), Stepper-UI, Slot-Picker, Kalender-Sync (Google/Microsoft). - **Reifegrad:** vollstaendig. ### Form Builder - **User-Sicht:** Forms-Index, neuer Form, Editor (Drag&Drop), Sharing/Embed, Submissions-Ansicht, Fill-View, Public Forms (`/f/$tenantSlug/$formSlug`), Submitted-Bestaetigung. - **Operationen:** Form-Charts, Form-Tags, Form-Actions (Workflow nach Submit), Form-Files, Form-Logs, Form-Submission-Trigger fuer Automationen. - **Reifegrad:** vollstaendig. ### Knowledge Base / Wiki - **User-Sicht:** Tenant-Wiki (`/$tenant/wiki`, `/$tenant/wiki/$slug`), Knowledge-Base (`/$tenant/knowledge-base`), oeffentliche Help-Center-Seiten (`/help/$slug/...articles/categories`). - **Operationen:** Kategorien + Sections, Artikel-Embeddings (RAG-Suche), Up-/Downvotes, Article-Views-Tracking, Article-Entity-Linking (Verknuepfung mit Deals/Projekten). - **Reifegrad:** vollstaendig. ### Tenant-Assistant ("HiveMind") / KI-Agent - **User-Sicht:** AI-Assistent (`/$tenant/hivemind`), Custom-Tools-Verwaltung (`/$tenant/settings/hivemind-custom-tools`), Team-Log (`/$tenant/settings/hivemind-team-log`), Hivemind-Settings. - **Operationen:** Conversation-Speicher, User- und Tenant-AI-Memory, Grounding-References (RAG), Custom-Tools mit Executor (Tenant kann eigene Tools bauen), Scheduled-Actions, Insights-Generation (cron im Scheduler), Reminder-Sweeper, Suggestion-Engine, Screen-Context (UI-Kontext fuer den Agent), Fuzzy-Resolver (Entity-Lookup). - **Reifegrad:** sehr ausgepraegt (eigene Engine inkl. Scheduler-Hooks). ### KI-Infrastruktur (Generic) - LLM-Gateway mit Multi-Provider (Anthropic, OpenAI, OpenRouter, Scaleway), Token-Tracking, Token-Limits, Whisper-Transkription, Generated-Objects (strukturierte Outputs), Tenant-Embeddings, RAG-Context, Prompt-Flows (visueller Prompt-Editor). - API-Endpoints: `api.ai.chat`, `api.ai.generate`, `api.ai.generate-object`, `api.ai.transcribe`, `api.ai.suggestions`, `api.ai.insights`, `api.ai.upload`, OpenAI-kompatibler Endpoint. - **Reifegrad:** vollstaendig. ### HR-Hub / Mitarbeiterplattform - **User-Sicht:** HR-Hub mit Tabs: Announcements, Documents, My-Documents, Leave (Urlaub/Krank), Locations, Password-Safe, Payslips, Quick-Links, Resources, Surveys, Requests, Request-Templates. - **Operationen:** Vacation-Request-Workflow (Antrag -> Genehmigung), Sick-Leave-Reporting, Payslip-Upload durch Buero, Upload-Reminders mit Cron (Mitarbeiter werden erinnert, Dokumente einzureichen), Password-Safe-Vaults (Team-Passwoerter), HR-Surveys, Generic-Request-Templates. - **Reifegrad:** vollstaendig (sehr breit). ### Customer-Portal (Endkunden-Login) - **User-Sicht:** Portal-Login (`/portal/$tenant/login`), Dashboard (`/portal/$tenant`), Dokumente (`/portal/$tenant/documents`). - **Operationen:** Magic-Link-Auth + Password-Auth, Project-Access-Verwaltung (welcher Endkunde sieht welches Projekt), Sales-Phase-Access (Portal schon im Vertriebsprozess oeffnen), Dokument-Freigabe konfigurierbar, Endkunden-File-Upload (`api.portal.files.upload-url`). - **Reifegrad:** vollstaendig. ### Dashboard / Reporting - **User-Sicht:** Tenant-Dashboard (`/$tenant/dashboard`) mit konfigurierbaren Widgets pro Rolle (GF, Vertriebler, PL). - **Widgets:** Pipeline-KPIs, Deal-Trend, Revenue-Overview, Sales-Performance, Project-Overview, Task-Completion, Greetings. - **Operationen:** Layout-Persistenz pro User/Tenant, Delta-Berechnung (Vergleich Vormonat), rollenbasierte Default-Layouts. - **Reifegrad:** vollstaendig. ### Tasks - **User-Sicht:** Task-Liste (`/$tenant/tasks`), inline-Tasks aus Chat-Nachrichten markierbar. - **Operationen:** Task-CRUD, Zuweisung, Deadlines. - **Reifegrad:** vollstaendig. ### Files / Dokumente - **User-Sicht:** Files-Browser (`/$tenant/files`), Datei-Preview/Download. - **Operationen:** Upload mit Chunked-Progress, Storage-Adapter (lokal/S3-aehnlich), Preview-Generation. - **Reifegrad:** vollstaendig. ### Analytics (Pipeline / Sales / Projects / Export) - **User-Sicht:** `/$tenant/analytics` Hub, Sub-Pages: pipeline, sales, projects, export, plus Detail-View. - **Operationen:** aggregierte Auswertungen aus den Pipelines, CSV/Export-Funktion. - **Reifegrad:** vollstaendig. ### Audit-Log - **User-Sicht:** Audit-Trail (`/$tenant/audit`), in Admin: `/admin/audit-trails`. - **Operationen:** Audit-Diff (Vorher/Nachher), Filter nach Person/Modul/Zeit. - **Reifegrad:** vollstaendig. ### Notifications - **User-Sicht:** Notification-Center (`/$tenant/notifications`), Praeferenzen (`/$tenant/settings/notifications`). - **Operationen:** In-App + Email + Mobile-Push (Novu-Hook im Worker), pro-User-Praeferenzen, Mobile-Device-Registration (`api.notifications.mobile-device`), Ruhezeiten konfigurierbar. - **Reifegrad:** vollstaendig. ### Search - **User-Sicht:** Globale Suche (`/$tenant/search`). - **Operationen:** Unified-Search ueber Entitaeten (Contacts/Deals/Projects/Files/Articles), Search-Token-Generation (`api.search.token`). - **Reifegrad:** vollstaendig (Tests vorhanden). ### KWP-Integration (Handwerks-ERP) - **User-Sicht:** KWP-Settings (`/$tenant/settings/integrations/kwp`), KWP-Hub (`/$tenant/kwp`), externer kwpsync.exe Windows-Client (separates Verzeichnis `kwpsync/`). - **Operationen:** Bidirektionale Anbindung — HiveGrid-Cloud stellt Queue + API bereit (`api.kwp-bundle.$token`), kwpsync.exe (Windows x64) pollt alle 30s, schreibt in MSSQL. Projektnummer-Sequenz + Reservierungen, Builder fuer KWP-Payloads, Validation, Marketplace-Integration, Error-Reports, Document-Sync, Auto-Queue. - **Reifegrad:** vollstaendig (mit Tests). ### Calendar-Integration (Google + Microsoft) - **User-Sicht:** Booking/Calendar nutzt externen Kalender; OAuth-Anbindung in Settings. - **Operationen:** Google + Microsoft Adapter, Sync-Cursor + Webhook-Events, Mapping zwischen HiveGrid-Appointments und externen Calendar-Events, Sync-Service. - **Reifegrad:** vollstaendig. ### Email-Integration (Gmail + Outlook) - **Operationen:** OAuth2-basierter Gmail/Outlook-Adapter, Mailbox-Sync, Linking eingehender Mails an Kontakte/Deals. - **Reifegrad:** vollstaendig. ### Accounting-Integration - **Operationen:** Adapter fuer LexOffice, sevDesk, FastBill (Rechnung erstellen, Synchronisation). - **Reifegrad:** vollstaendig (mit Tests). ### Storage-/Drive-/Productivity-Integrationen - **Drive:** Google Drive, Microsoft OneDrive, Dropbox. - **Productivity:** Asana, Jira, Trello, Monday, MeisterTask, Notion. - **Marketing/CRM:** HubSpot, Mailchimp, ActiveCampaign, Brevo. - **Communication:** Slack, MS Teams, Zoom. - **Forms:** JotForm, Typeform. - **Ads:** Facebook Leads, Google Ads (Lead Form). - **Payments:** Stripe Connect, SumUp. - **Maps:** Google Maps (Geocoding). - **Dev:** GitHub. - **Reifegrad:** Adapter (server.ts) jeweils vorhanden, ueberwiegend ueber das Automation-Registry konsumiert (Trigger/Action-Knoten); UI-Integrationsseiten: nur teilweise ausgebaut. ### Public REST API (`api.v1.*`) - **Endpoints:** `/api/v1/contacts`, `/api/v1/deals`, `/api/v1/projects`, `/api/v1/users`, `/api/v1/integrations/events`, `/api/v1/webhooks/incoming`. - **Operationen:** API-Key-Auth + Logs, OpenAPI/Swagger (`/swagger`, `postman_collection.json`), Rate-Limiting via Metering, eingehende Webhook-Subscriptions. - **Reifegrad:** vollstaendig. ### Webhooks (eingehend + ausgehend) - Subscriptions, Delivery, Delivery-Attempts, Incoming-Ingestion. Verschiedene Provider-Webhooks: Mailersend, Postmark, Aircall, Sipgate, DocuSign, PandaDoc, Calendly, Stripe, SumUp, Calendar (Google/Microsoft), WhatsApp. ### Onboarding - **User-Sicht:** Tenant-Onboarding-Wizard (`/onboarding/$id`, `/$tenant/onboarding`), Branchen-/Rollen-Filter. - **Operationen:** Onboarding-Sessions mit Steps + Actions, Demo-Provisioning (Beispiel-Daten ausrollen), Filter-Matches, Invitation-Dispatch, Setup-Service. - **Reifegrad:** vollstaendig (eigenes Modul mit Blocks/Components). ### Subscriptions / Billing (Stripe) - **User-Sicht:** `/pricing`, `/subscribe/$tenant`, Success-Page, in-app Subscription/Billing/Usage Pages. - **Operationen:** Stripe-Checkout, Subscription-Lifecycle, Seats-Verwaltung, Dunning, Webhook, Trial-Lifecycle, Downgrade-Logik mit Read-Only-Middleware, Service-Metering, Usage-Tracker, AI-Credits. - **Reifegrad:** vollstaendig. ### Admin (Plattform-Admin) - **Routes:** `/admin/dashboard`, `/admin/accounts` (Index, Detail, Subscriptions, Roles & Permissions, Users, Blacklist, IP-Adressen), `/admin/email-marketing`, `/admin/help-desk` (Feedback, Inbound-Emails), `/admin/knowledge-base` (Articles, Bases, Import, Danger), `/admin/feature-flags` (Flags, Settings), `/admin/onboarding`, `/admin/notifications`, `/admin/metrics`, `/admin/audit-trails`, `/admin/community-apps`, `/admin/chat`, `/admin/ai` (Chats, Generations), `/admin/api` (Keys, Logs, Credits, Docs), `/admin/events`, `/admin/health`, `/admin/setup`, `/admin/forms`, `/admin/settings/...` (Authentication, Cache, Cookies, Profile, Analytics, Internationalization, Transactional Emails, Accounts/Types, General, Danger). - **Reifegrad:** sehr breit, vollstaendig. ### Tenant-Settings - **Routes:** Settings-Hub mit Sub-Pages: account, profile, members (incl. groups), groups, roles, billing, subscription, branding, theme, language, ai-credits, hivemind (+ custom-tools, team-log), notifications, debug, privacy, integrations (kwp, telephony, email, email-domain, signature, webhooks, whatsapp), api (keys, docs, logs), pipelines (Sales-Pipelines konfigurieren), project-pipelines, forms (+ Form-Editor), logs, usage. - **Reifegrad:** vollstaendig. ### Help-Desk / Support (intern) - **User-Sicht:** Support-Page (`/$tenant/support`), Help-Center-Page (`/$tenant/help-center`). - **Operationen:** Support-Chat, Threads, Feedback-Submissions, Surveys. - **Reifegrad:** vollstaendig. ### Feature-Flags - Tenant-/User-spezifische Flags, Filter, Admin-Verwaltung. ### GDPR - Daten-Export-Jobs (`GdprExportJob`), Privacy-Settings. ### Apps Engine / Community-Marketplace / Template-Marketplace - Generische "App"-Definition mit DataConnections, AppSyncRuns. CommunityApps inkl. Install-Flow im Admin. Template-Marketplace fuer Project-/Form-Templates. - **Reifegrad:** Admin-UI vorhanden, Tenant-Sicht eher rudimentaer. ### Blog / Pages / Sites (CMS) - Page/PageBlock/PageMetaTag, Site, BlogPost/Tag/Category, MySiteDemoSubmission (`/dev/components-catalog`, generic Pages). - **Reifegrad:** Schema vorhanden, vermutlich fuer Marketing/Public-Pages, in den Tenant-Routes eher Stub. ### Mobile-App - **Verzeichnis:** `apps/mobile/` enthaelt nur Expo-Skeleton (`.expo/`-Ordner). - **Reifegrad:** Stub (laut Feature-Catalogue P0 mit XL-Aufwand geplant, in Code nicht vorhanden). --- ## Integrationen | System | Tiefe | |---|---| | **KWP** (Handwerks-ERP) | Tiefe Integration: Cloud-API + separater Windows-Client (kwpsync.exe), MSSQL-Sync, Projektnummer-Sequenzen, Document-Sync, Error-Reports, Auto-Queue. | | **Taifun** (Handwerks-ERP) | **Nicht implementiert** (laut Feature-Catalogue geplant, im Code nicht gefunden). | | **Aircall / Sipgate** | Telefonie: Click-to-Call, Webhook, Call-Log-Sync, Voicemail-/Transkript-Verknuepfung. | | **PandaDoc / DocuSign** | Dokument-Signatur: Send + Webhook + Status-Transition, Multi-Signer. | | **Google Calendar / Microsoft Calendar** | Bidirektionale Sync mit Cursor + Webhooks. | | **Gmail / Outlook** | Email-Sync mit OAuth2, Linking an CRM. | | **WhatsApp (Meta WABA + Unipile)** | 2 Provider, Templates, Quick-Replies, Opt-Ins, Sync. | | **Stripe** | Subscriptions, Checkout, Webhook, Dunning, Connect (Marketplace-Auszahlungen). | | **SumUp** | Payment-Adapter. | | **LexOffice / sevDesk / FastBill** | Buchhaltungs-Adapter (Rechnung erstellen, Sync). | | **Datev** | Action: `datev-export-data` (Datenexport). | | **MailerSend / Postmark / Resend** | Outbound + Inbound-Email. | | **Slack / Microsoft Teams** | Send-Message-Action, Trigger fuer empfangene Nachrichten. | | **Zoom** | Meeting-Erstellung. | | **Google Drive / OneDrive / SharePoint / Dropbox** | File-Storage-Aktionen + Trigger. | | **HubSpot / Mailchimp / ActiveCampaign / Brevo** | CRM-/Marketing-Sync (Contact-Add, Trigger bei neuem Contact). | | **Asana / Jira / Trello / Monday / MeisterTask / Notion** | Task-/Issue-Erstellung + Trigger. | | **JotForm / Typeform / Google Forms / Calendly / Facebook Leads / Google Ads Lead Form** | Lead-Eingangs-Trigger. | | **GitHub** | Issue-Erstellung + Trigger bei neuem Issue. | | **Anthropic / OpenAI / OpenRouter / Scaleway** | LLM-Provider, OpenAI-kompatibler eigener Endpoint. | | **Google Maps** | Geocoding-Action. | | **Novu** | Push-Notification-Versand (Worker-Hook). | | **Sentry** | Observability. | | **OAuth-Provider** | Google + GitHub als Login-Methode. | --- ## Automation Engine **Konzept:** Trigger-->(Conditions)-->Action(s) mit visuellem Flow-Editor (Canvas-basiert), Templates, Workflow-Liste, Execution-Log, separates "API & Webhooks"-Tab. **Trigger (~50, im Registry):** - CRM: `contact-created`, `contact-updated`, `contact-deleted`, `deal-created`, `deal-updated`, `deal-stage-changed`, `deal-won`, `deal-lost` - Projekt/Task: `project-created`, `project-stage-changed`, `project-stage-stuck`, `project-completed`, `task-created`, `task-completed` - Forms/HR: `form-submitted`, `hr-request-submitted` - Schedule: `schedule.trigger` (Cron-like Time-Based) - Telefonie: `aircall-call-completed`, `sipgate-call-completed` - Email: `gmail-email-received`, `outlook-email-received`, `mailersend-email-delivered`, `mailersend-email-bounced` - WhatsApp: `whatsapp-message-received` - Slack: `slack-message-received` - Lead-Eingang: `facebook-leads-lead-received`, `google-ads-lead-form-submitted`, `google-forms-response-submitted`, `jotform-submission-received`, `typeform-response-submitted` - Calendar/Booking: `calendly-event-scheduled`, `zoom-meeting-created` - Signatur: `docusign-envelope-sent`, `docusign-envelope-completed`, `pandadoc-document-completed` - Payments/Buchhaltung: `stripe-payment-received`, `sumup-payment-received`, `lexoffice-invoice-created`, `sevdesk-invoice-created` - Externe Tools: `asana-task-created`, `github-issue-created`, `jira-issue-created`, `meistertask-task-created`, `monday-item-created`, `notion-page-created`, `trello-card-created`, `dropbox-file-uploaded` - Marketing: `activecampaign-contact-added`, `brevo-contact-added`, `hubspot-contact-created`, `mailchimp-subscriber-added` **Actions (~45):** - Intern: `create-project-from-deal`, `update-deal-stage`, `create-task`, `notify-projektleiter`, `escalate-pipeline`, `add-tag`, `send-email`, `send-chat-message`, `send-notification`, `send-whatsapp-message`, `delay`, `request-google-review`, `http-request`, `webhook-send` - AI: `anthropic-generate-text`, `openai-generate-text`, `openrouter-generate-text` - Email-Provider: `gmail-send-email`, `outlook-send-email`, `mailersend-send-email`, `resend-send-email` - CRM/Marketing: `hubspot-create-contact`, `mailchimp-add-subscriber`, `activecampaign-add-contact`, `brevo-add-contact` - Productivity: `asana-create-task`, `jira-create-issue`, `trello-create-card`, `monday-create-item`, `meistertask-create-task`, `notion-create-page`, `github-create-issue` - Files: `google-drive-upload`, `onedrive-upload`, `sharepoint-upload-file`, `dropbox-upload-file` - Buchhaltung: `lexoffice-create-invoice`, `sevdesk-create-invoice`, `fastbill-create-invoice`, `datev-export-data` - Communication: `slack-send-message`, `teams-send-message`, `zoom-create-meeting`, `google-calendar-create-event` - Maps: `google-maps-geocode` **Infrastruktur:** - BullMQ-basierter Automation-Worker, separater Scheduled-Rule-Worker, Loop-Guard (Endlosschleifen-Schutz), Metering (Trigger-Volumen-Modell wie Zapier), Tenant-spezifische Credentials, Templates ("schon vorgefertigte Workflows"), Stage-Stuck-Eskalation laeuft im Scheduler-Tick (alle 10 Min). - Eigene i18n-Files fuer Automation-Knoten (`automation-i18n-de.json` / `-en.json`). --- ## Auth / Multi-Tenancy / Rollen **Auth-Methoden:** - Email + Passwort - OAuth: Google + GitHub - Magic-Link (fuer Customer-Portal) - API-Keys (mit Logs) - JWT (`jwt-auth.server.ts`) **Multi-Tenancy:** - **Tenant-Slug in URL:** `/$tenant/...` Route-Praefix - **Row-Level-Security:** Postgres RLS via Dual-DB-Connection (`DATABASE_URL` Superuser fuer Migrations vs. `DATABASE_URL_APP` mit App-Role + RLS Policies). Eigener Tenant-Context-Helper (`tenantPrisma(tenantId)`). - Subdomain-/Custom-Domain-Auflistung per Tenant moeglich (siehe `tenant/url.server.ts`, Caddy-Konfigs). - IP-Whitelisting pro Tenant (`TenantIpAddress`). - Custom Branding pro Tenant. **RBAC:** - Vorkonfigurierte Rollen (laut `docs/03-ROLES-AND-PERMISSIONS.md`): Geschaeftsfuehrer/Admin, Vertriebsleiter, Vertriebler, Projektleiter/Bauleiter, Buero/Backoffice, Marketing, Monteur. - Frei anlegbare eigene Rollen (Settings -> Roles, Settings -> Groups). - Permissions als technische Granularitaet im Schema (`Role`, `Permission`, `RolePermission`, `UserRole`). - Feature-Gating: `requireTenantFeatureAccess()` als Loader-First-Call (Convention, siehe `PROJECT.md`). - Globale Admin-Rolle (`AdminUser`) mit eigenem `/admin`-Bereich. **Customer-Portal:** - Eigene `PortalUser`/`CustomerPortalAccount`-Tabelle, getrennt vom internen `User`. - Magic-Link + Password. - Project-Access-Granularitaet (welcher Endkunde sieht welche Projekte/Dokumente). **Subscriptions/Trial:** - Trial-Lifecycle, Downgrade -> Read-Only-Middleware (verhindert schreibende Aktionen wenn Plan abgelaufen). **Audit:** - Vollstaendiger Audit-Trail mit Vorher-/Nachher-Diff. --- ## Auffaellige Luecken & halbfertige Bereiche - **Mobile-App:** Im Repo nur leerer Expo-Skeleton (`apps/mobile/.expo/`). Im Feature-Katalog als P0-Pflicht definiert ("Native Mobile App PFLICHT"), aber **gar nicht implementiert**. Push-Notifications-Backend ist da (Novu, NotificationDevice), Mobile-Device-Registration-Endpoint existiert — Client fehlt. - **Taifun-ERP:** Im Feature-Katalog (`14.4`) explizit als Pflicht-Integration genannt, im Code aber **nicht vorhanden** — nur KWP ist implementiert. - **Blog/CMS/Sites:** Schemas (`Page`, `PageBlock`, `BlogPost`, `Site`) existieren, sichtbare Tenant-Routes dafuer kaum vorhanden — vermutlich fuer das Customer-Portal-Upgrade ("Blog-Funktion" laut Feature-Catalogue 8.10, P2) angefangen. - **Community-Apps / Template-Marketplace:** Admin-UI vorhanden, Tenant-Sichtbarkeit (z.B. Browser fuer Templates aus Tenant-Sicht) eher rudimentaer. `app-catalog`-Modul wirkt als Vorbereitung. - **AppsEngine (`App`, `DataConnection`, `AppSyncRun*`):** Generisches Sync-Framework — wirkt wie Vorbereitung fuer Drittanbieter-Apps; konkret genutzt fuer KWP, sonst eher leer. - **Plantafel:** Eigene Route `/$tenant/projects/plantafel` und Service vorhanden — Implementierungstiefe nicht klar, Plantafel-bezogenes ScheduleEntry-Modell ist da. - **Ai-Gen Objects/Forms:** Ordner `app/modules/ai-gen/objects/forms` und `_template` deuten auf "AI generiert komplette Formulare" — sieht angefangen aber begrenzt aus. - **Wiki vs. Knowledge-Base:** Zwei parallele Module (`/$tenant/wiki/...` MDX-basiert vs. `/$tenant/knowledge-base/...` DB-gestuetzt). Unklar welches vorne war — das Wiki-Routes-Verzeichnis ist sehr klein, Wahrscheinlich abgeloest durch Knowledge-Base. - **`templates.tsx` im Tenant-Bereich:** Datei existiert mit nur 213 Bytes — Stub. - **Pricing-Page:** `/pricing` existiert als Public-Route — vermutlich Marketing-Stub. - **Hivemind-Custom-Tools:** Sehr ambitionierter Bereich (User definiert Tools, AI-Agent fuehrt aus) — wirkt experimentell. - **GDPR-Export-Job:** Schema existiert, UI duerftig (vermutlich nur Admin-getriggert). - **Help-Center oeffentlich (`/help/$slug/...`):** Multi-Language-Unterstuetzung (`($lang)`-Param) angedeutet — Implementierungstiefe unklar. - **Sehr hoher Refactor-Druck dokumentiert:** `PROJECT.md` (M002 Codebase-Cleanup) erwaehnt 15 Routes >600 LOC, ~30% UI noch English-only, viel `any`/`console.log`/`ts-ignore` Cleanup. Das ist genau der Spaghetti-Code-Grund fuer die Verwerfung. --- ## Feature-Cheatsheet (alphabetisch) - **Abnahmeprotokoll** — digitale Abnahme-Checkliste fuer Projekte, mit Foto-Upload und Kunden-Signatur am Smartphone. - **Activity-Stream** — kombinierte Timeline aus Calls, Mails, Chat-Nachrichten, Stage-Wechseln pro Deal/Projekt/Kontakt. - **Admin-Bereich (Plattform)** — globale Tenant-/User-Verwaltung, Subscription-Auswertung, Feature-Flags, Knowledge-Base-Verwaltung, Help-Desk, Setup-Wizards, Health-Checks, AI-Logs. - **Aircall-/Sipgate-Telefonie** — Click-to-Call, automatisches Logging im Deal, Webhook-Integration. - **Analytics-Dashboard (Tenant)** — Pipeline-, Sales-, Project-, Export-Auswertungen. - **Angebots-PDF-Upload + Signatur-Anfrage** — PandaDoc/DocuSign-getrieben, Status-Auto-Sync zu Deal-Stage. - **API (REST v1)** — Public API mit OpenAPI/Swagger, API-Keys, Logs, Rate-Limit, Postman-Collection. - **API-Key-Verwaltung** — pro Tenant (Settings/API/Keys) und global (Admin/API/Keys). - **Apps Engine (Generic Sync)** — Framework fuer Datenverbindungen + Sync-Runs (KWP nutzt es). - **Audit-Log** — Aktivitaets-Trail mit Diff, filterbar nach Person/Modul. - **Auth (OAuth/Email/Magic-Link)** — Google + GitHub OAuth, Email/Pwd, Magic-Link fuers Portal, JWT, API-Keys. - **Automation Studio** — Visueller Flow-Editor, ~50 Trigger, ~45 Actions, Templates, Loop-Guard, Trigger-Metering. - **Booking-Pages (Calendly-Style)** — oeffentliche Buchungsseite mit Multi-Provider, Verfuegbarkeitsregeln/Ausnahmen. - **Branding/Theme** — pro Tenant konfigurierbares Branding und Theme. - **Buchhaltungs-Integrationen** — LexOffice, sevDesk, FastBill, Datev (Export). - **Calendar-Sync** — Google + Microsoft, bidirektional mit Webhooks. - **CMS-Pages/Blog (rudimentaer)** — Page/Block/Blog-Schemas vorhanden. - **Chat (intern, Team)** — Channels, DMs, Pinned, Reactions, Threads, Datei-Uploads, WebSockets. - **Community-Apps Marketplace** — Admin-Verwaltung von Drittanbieter-Apps. - **Customer-Portal** — Endkunden-Login, Dokument-Einsicht, Datei-Upload, Projekt-Status, Magic-Link-Auth. - **Dashboard-Widgets** — konfigurierbare Tiles (Pipeline-KPIs, Deal-Trend, Revenue, Sales-Performance, Project-Overview, Task-Completion). - **Deals & Sales-Pipeline** — Kanban + Liste + Detail, Stages, Activities, Archive, Form-Linkage. - **Demo-Provisioning** — Beispiel-Daten beim Onboarding. - **DSGVO-Export** — `GdprExportJob` per Tenant. - **Email-Marketing** — Kampagnen, Segmente, Sender, Activity (Open/Click), Cron-Versand. - **Email-Inbox (Tenant)** — Eingehende Mails verknuepft mit Kontakten/Deals, eigene Sending-Domain mit DKIM, Inbound-Webhooks (MailerSend/Postmark). - **Email-Sync (Gmail/Outlook)** — OAuth2-basierter Mailbox-Sync. - **Embed-Forms** — eingebettetes Formular auf Handwerker-Website per Code-Snippet. - **Feature-Flags** — pro Tenant/User, Filter, Admin-UI. - **Files / Dokumente** — Browser, Upload mit Chunked-Progress, Preview. - **Form Builder** — Drag-&-Drop Forms, Submissions, Sharing/Embed, Form-Actions, Foto-Checklisten. - **Geocoding** — Google-Maps-Integration als Action. - **Globale Suche** — Cross-Entity Unified-Search. - **Help-Center (oeffentlich)** — Public Help-Pages mit Multi-Language. - **HiveMind (Tenant-AI-Agent)** — RAG-basierter Assistent mit Custom-Tools, Insights, Reminders, Scheduled-Actions, Screen-Context. - **HR-Hub** — Announcements, Documents, Leave (Urlaub/Krank), Locations, Password-Safe, Payslips, Quick-Links, Resources, Surveys, Requests. - **Inbound-Webhooks** — generisches Ingestion-System fuer externe Events. - **Internationalisierung** — i18n via react-i18next (DE+EN), Admin-Settings fuer i18n. - **KI-Suche / RAG** — Embeddings ueber Tenant-Entitaeten und Help-Articles via pgvector. - **KI-Workflows / Prompt-Flows** — Visueller Prompt-Editor mit Input-Variablen, Templates, Output-Mapping. - **Knowledge-Base** — Categories/Sections/Articles mit Embeddings, Up-/Downvotes, View-Tracking. - **KWP-ERP-Sync** — Cloud-Queue + Windows-kwpsync.exe Client gegen MSSQL, Projektnummer-Reservierung, Document-Sync. - **Leads** — Inbox, Statistiken, CSV-Import. - **LLM-Gateway** — Multi-Provider (Anthropic, OpenAI, OpenRouter, Scaleway), Token-Tracking, Limits, AI-Credits. - **Magic-Link-Auth** — fuer Customer-Portal. - **Mehrsprachigkeit** — DE/EN am Start, Sprache pro User. - **Mobile-Push** — Novu-basiert, Device-Registration, Praeferenzen (inkl. Ruhezeiten). - **Notification-Center** — In-App + Email + Push, pro-User-Praeferenzen. - **OAuth2-Framework** — generischer Provider-Helper (Google, Microsoft, GitHub, weitere). - **Onboarding-Wizard** — branchenbasiert, mit Filtern, Steps, Demo-Daten. - **Page-Blocks (CMS)** — Block-basiertes Page-Editor (rudimentaer). - **Password-Safe (HR)** — Team-Password-Vault. - **Payslips (Lohnabrechnung)** — Buero laedt hoch, Mitarbeiter sieht ein. - **Pipeline-Eskalation** — automatische Erinnerung wenn Deal/Projekt zu lange in Stage haengt. - **Plantafel** — Ressourcen-/Termin-Planung fuer Projekte (Schedule-Entries). - **Portale (mehrere Endkunden-Portale je Tenant)** — `Portal`-Modell + Subscriptions im Portal. - **Projects & Auftragspipeline** — Kanban, Detail, Members, Acceptance, Archive, Plantafel, Templates. - **Push-Notifications** — Mobile + Email + In-App. - **Quick-Links (HR)** — kuratierte Schnellzugriffe. - **Roles & Permissions** — Settings-UI fuer Rollen-Verwaltung, fertige Templates. - **Schedule-Entries** — Termin-/Plantafel-Eintraege. - **Search-Token** — sichere Suche mit kurzlebigen Tokens. - **Sites / MySite** — Tenant-spezifische Public-Sites (Schema vorhanden, Implementation rudimentaer). - **Slack/Teams/Zoom/Calendly-Integrationen** — Action+Trigger-Knoten. - **Stripe-Subscriptions + Checkout + Dunning + Trial** — vollstaendiger Billing-Flow. - **Stripe-Connect / SumUp** — Marketplace-Auszahlungen / Payment-Processing. - **Support / Help-Desk** — Support-Chat-Threads, Feedback, Surveys (admin + tenant). - **Tasks** — Aufgaben aus Chat-Nachrichten ableitbar, mit Zuweisung+Deadline. - **Telephony-Click-to-Call** — Aircall + Sipgate. - **Template-Marketplace** — kaufbare Project-/Form-Templates. - **Tenant-Branding** — Logo, Farben, Theme. - **Tenant-Switcher** — UI fuer Mehrfach-Tenant-Mitgliedschaften. - **Trial + Downgrade-Read-Only** — verhindert Schreibaktionen nach Plan-Ablauf. - **Upload-Reminders (HR)** — Mitarbeiter werden zyklisch erinnert, Dokumente einzureichen. - **Urlaub & Krankmeldung** — Form-basierte Workflows, Genehmigung, Kalender. - **Usage-Tracking / Metering** — pro Tenant, fuer Subscription-Quota und AI-Credits. - **Verfuegbarkeitsregeln** — Booking-Page-Verfuegbarkeit + Ausnahmen. - **Wiki (MDX)** — content-basiert (parallel zur DB-getriebenen Knowledge-Base). - **Webhooks (eingehend + ausgehend)** — Subscriptions, Delivery-Tracking, Retries. - **WhatsApp Business** — Meta WABA + Unipile, Templates, Quick-Replies, Sync, Webhook. - **Whisper-Transkription** — Audio-Transkription (z.B. fuer Anrufe / Sprachnachrichten). - **Widgets-Engine** — anpassbare Dashboard-Tiles pro Rolle.