# operacle/checkcle architecture

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

- Interactive diagram: https://gitdiagram.com/operacle/checkcle
- Repository: https://github.com/operacle/checkcle

## Overview

##### Project type and purpose
- CheckCle is a full-stack, open-source monitoring platform.
- It comprises a React+TypeScript single-page application (SPA) in the **application/** folder and a PocketBase backend (Go) in the **server/** folder.
- Docker Compose glues everything together for local development and production.

##### File structure
- Top level:
- **application/** – the Vite-powered React SPA
- **server/** – PocketBase binary, migration scripts, SQLite data
- **docker/** + **docker-compose.yml** – container definitions for dev/prod
- **scripts/** – setup/entrypoint shell scripts
- In **application/**:
- **src/pages/** implements route-level views (Dashboard, Login, Settings, etc.)
- **src/components/** holds UI components (dashboard, services, profile, settings, ssl-domain)
- **src/services/** contains API wrappers (authService, serviceService, etc.), monitoring logic (httpChecker, monitoring intervals), notification logic (telegramService, signalService, templateProcessor)
- **src/api/** configures REST + real-time (WebSocket) communication with PocketBase
- **src/lib/pocketbase.ts** – initializes the PocketBase SDK client
- **vite.config.ts**, **tsconfig.json**, **tailwind.config.ts** – build tool and styling configs
- In **server/**:
- **pb_data/** – SQLite files for data persistence
- **pb_migrations/** – JSON and JS migration scripts defining collections (services, uptimes, alert configurations)
- **pocketbase/** – the backend executable

##### README for additional insights
- Real-time monitoring of HTTP, DNS, Ping, TCP services
- Incident history, SSL/domain checks, user and alert management
- Notification channels: Email, Telegram, Discord, Slack
- Multi-language, theming, and a settings panel
- Deployed via Docker Compose, exposing port 8090

##### Elements
– Clear, descriptive labels for each component
- SPA → API calls → PocketBase
- API → DB reads/writes
- Monitoring Engine → DB writes
- Monitoring Engine → Notification Engine → External Channel
- DB → WebSocket pushes → SPA
- UI (blue),
- Backend/core services (green),
- External dependencies (orange),
– Annotations for protocols (HTTP, WebSocket, Docker network)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Docker Compose" 
        style DockerCompose fill:#e2e3e5,stroke:#999

        subgraph "Frontend SPA (React + Vite)" 
            style Frontend fill:#cce5ff,stroke:#339
            A["Entry point & bootstrapping\nmain.tsx"] 
            B["Pages (route-level views)"] 
            C["UI Components"] 
            D["API layer (REST + real-time)"] 
            E["Services (client-side wrappers)"] 
            F["PocketBase SDK initialization"] 
            A --> B
            A --> C
            B --> D
            C --> E
            E --> D
            D --> F
        end

        subgraph "Backend API & Database (PocketBase + SQLite)"
            style Backend fill:#d4edda,stroke:#2a7
            G["PocketBase binary"] 
            H["Migration scripts & schema"] 
            I(["SQLite DB"])
            G --> H
            G --> I
        end

        subgraph "Monitoring Engine"
            style Monitor fill:#d4edda,stroke:#2a7
            M1["HTTP checker"] 
            M2["Monitoring intervals"] 
            M3["Service status handlers"] 
            M2 --> M1
            M1 --> M3
        end

        subgraph "Notification Engine"
            style Notify fill:#d4edda,stroke:#2a7
            N1["Telegram integration"] 
            N2["Signal integration"] 
            N3["Template processor"] 
        end

        subgraph "External Channels"
            style External fill:#ffe5b4,stroke:#e67
            X1["Telegram Bot API"] 
            X2["SMTP / Email"] 
            X3["Slack Webhook"] 
            X4["Discord Webhook"] 
        end

        %% Interactions
        A -->|"HTTP REST"| G
        A -->|"WebSocket"| G
        G -->|"reads/writes"| I
        M3 -->|"writes results"| I
        M3 --> NotificationEngine["Notification Engine"]
        NotificationEngine --> X1
        NotificationEngine --> X2
        NotificationEngine --> X3
        NotificationEngine --> X4
        I -->|"WebSocket push"| A

    end

    %% Click Events
    click A "https://github.com/operacle/checkcle/blob/main/application/src/main.tsx"
    click B "https://github.com/operacle/checkcle/tree/main/application/src/pages/"
    click C "https://github.com/operacle/checkcle/tree/main/application/src/components/"
    click D "https://github.com/operacle/checkcle/tree/main/application/src/api/"
    click E "https://github.com/operacle/checkcle/tree/main/application/src/services/"
    click F "https://github.com/operacle/checkcle/blob/main/application/src/lib/pocketbase.ts"
    click M1 "https://github.com/operacle/checkcle/blob/main/application/src/services/monitoring/httpChecker.ts"
    click M2 "https://github.com/operacle/checkcle/blob/main/application/src/services/monitoring/monitoringIntervals.ts"
    click M3 "https://github.com/operacle/checkcle/blob/main/application/src/services/monitoring/handlers/serviceStatusHandlers.ts"
    click N1 "https://github.com/operacle/checkcle/blob/main/application/src/services/notification/telegramService.ts"
    click N2 "https://github.com/operacle/checkcle/blob/main/application/src/services/notification/signalService.ts"
    click N3 "https://github.com/operacle/checkcle/blob/main/application/src/services/notification/templateProcessor.ts"
    click G "https://github.com/operacle/checkcle/tree/main/server/pocketbase"
    click H "https://github.com/operacle/checkcle/tree/main/server/pb_migrations/"
    click I "https://github.com/operacle/checkcle/tree/main/server/pb_data/"
    click DockerCompose "https://github.com/operacle/checkcle/blob/main/docker-compose.yml"

    %% Classes
    classDef UI fill:#cce5ff,stroke:#339
    classDef core fill:#d4edda,stroke:#2a7
    classDef external fill:#ffe5b4,stroke:#e67
    class DockerCompose orchestration
    class Frontend,Monitor,Notify,Backend core
    class External external
```
