# panoratech/panora architecture

> Architecture diagram of the GitHub repository panoratech/panora, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/panoratech/panora
- Repository: https://github.com/panoratech/panora

## Overview

##### Main Components
The system consists of several key components that should be represented:

a) Frontend Layer:
- Dashboard Application (apps/webapp)
- Magic Link Application (apps/magic-link)
- Embedded Catalog (apps/embedded-catalog)
- Frontend SDK (apps/frontend-sdk)

b) Backend Layer (packages/api):
- Core Services (@core)
- Vertical-specific Services:
- CRM
- Ticketing
- Accounting
- File Storage
- Marketing Automation
- E-commerce

c) Database Layer:
- PostgreSQL (indicated by prisma schema)

d) Integration Layer:
- Multiple third-party service connectors
- Webhook handlers
- Authentication providers

##### Architecture Patterns to Highlight

a) Modular Architecture:
- Clear separation between different verticals (CRM, Ticketing, etc.)
- Shared core services
- Demonstrate the plugin-based connector system

b) Service Communication:
- API Gateway pattern for external requests
- Event-driven architecture for webhooks
- Queue-based processing for async operations

##### Specific Elements

**[Frontend Applications]**
- ↓ ↑
**[API Gateway / Load Balancer]**
- ↓ ↑
**[Core Services]**
- Authentication
- Webhook Management
- Connection Strategies
- Field Mapping
- Sync Services
- ↓ ↑
**[Vertical-Specific Services]**
- CRM
- Ticketing
- Accounting
- etc.
- ↓ ↑
**[Integration Layer]**
- Connector Registry
- Provider-specific Adapters
- Webhook Handlers
- ↓ ↑
**[External Services]**

##### Additional Details

Annotations for:
- Authentication flows
- Data transformation pipelines
- Webhook processing paths
- Sync mechanisms between services

##### Infrastructure Elements

Supporting infrastructure:
- Docker containers
- Queue system (indicated by processor files)
- Caching layer (if applicable)
- Load balancers

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend
        WA["Dashboard App"]
        ML["Magic Link App"]
        EC["Embedded Catalog"]
        SDK["Frontend SDK"]
    end

    subgraph API
        Gateway["API Gateway"]
    end

    subgraph CoreServices
        Auth["Authentication"]
        WH["Webhook System"]
        CS["Connection Strategies"]
        FM["Field Mapping"]
        SS["Sync Services"]
        QS["Queue System"]
    end

    subgraph VerticalServices
        CRM["CRM Service"]
        TS["Ticketing Service"]
        AS["Accounting Service"]
        FS["File Storage Service"]
        MA["Marketing Automation"]
    end

    subgraph Integration
        CR["Connector Registry"]
        PA["Provider Adapters"]
        WHandler["Webhook Handlers"]
    end

    subgraph Database
        PG[(PostgreSQL)]
    end

    subgraph External
        TP["Third-Party Services"]
    end

    %% Frontend to API
    WA --> Gateway
    ML --> Gateway
    EC --> Gateway
    SDK --> Gateway

    %% API to Core
    Gateway --> Auth
    Gateway --> WH
    Gateway --> CS
    Gateway --> FM
    Gateway --> SS
    Gateway --> QS

    %% Core to Verticals
    Auth --> VerticalServices
    WH --> VerticalServices
    CS --> VerticalServices
    FM --> VerticalServices
    SS --> VerticalServices
    QS --> VerticalServices

    %% Verticals to Integration
    CRM --> CR
    TS --> CR
    AS --> CR
    FS --> CR
    MA --> CR

    CR --> PA
    CR --> WHandler

    %% Integration to External
    PA --> TP
    WHandler --> TP

    %% Database Connections
    CoreServices --> PG
    VerticalServices --> PG
    Integration --> PG

    %% Click Events
    click WA "https://github.com/panoratech/Panora/tree/main/apps/webapp"
    click ML "https://github.com/panoratech/Panora/tree/main/apps/magic-link"
    click EC "https://github.com/panoratech/Panora/tree/main/apps/embedded-catalog/react"
    click SDK "https://github.com/panoratech/Panora/tree/main/apps/frontend-sdk"
    click Auth "https://github.com/panoratech/Panora/tree/main/packages/api/src/@core/auth"
    click WH "https://github.com/panoratech/Panora/tree/main/packages/api/src/@core/@core-services/webhooks"
    click CS "https://github.com/panoratech/Panora/tree/main/packages/api/src/@core/connections-strategies"
    click FM "https://github.com/panoratech/Panora/tree/main/packages/api/src/@core/field-mapping"
    click SS "https://github.com/panoratech/Panora/tree/main/packages/api/src/@core/sync"
    click QS "https://github.com/panoratech/Panora/tree/main/packages/api/src/@core/@core-services/queues"
    click CRM "https://github.com/panoratech/Panora/tree/main/packages/api/src/crm"
    click TS "https://github.com/panoratech/Panora/tree/main/packages/api/src/ticketing"
    click AS "https://github.com/panoratech/Panora/tree/main/packages/api/src/accounting"
    click FS "https://github.com/panoratech/Panora/tree/main/packages/api/src/filestorage"
    click MA "https://github.com/panoratech/Panora/tree/main/packages/api/src/marketingautomation"
    click PG "https://github.com/panoratech/Panora/tree/main/packages/api/prisma"

    %% Styling
    classDef frontend fill:#2374ab
    classDef api fill:#ff7f50
    classDef core fill:#48a9a6
    classDef vertical fill:#4ea5d9
    classDef integration fill:#9370db
    classDef database fill:#ffd700
    classDef external fill:#808080

    class WA,ML,EC,SDK frontend
    class Gateway api
    class Auth,WH,CS,FM,SS,QS core
    class CRM,TS,AS,FS,MA vertical
    class CR,PA,WHandler integration
    class PG database
    class TP external
```
