# alexskuznetsov/control-app architecture

> Architecture diagram of the GitHub repository alexskuznetsov/control-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alexskuznetsov/control-app
- Repository: https://github.com/alexskuznetsov/control-app

## Overview

##### Main Components Identification

a) Frontend (webapp/)
- React.js application
- User interface components
- API integration layers

b) Backend API (backend/)
- Node.js/Express REST API
- Process controllers
- Service layer

c) Camunda BPM Engine (camunda/)
- Process orchestration
- BPMN workflow execution
- Task management

d) Notification Service (notification-service/)
- Separate microservice for handling notifications

**┌─ Client Layer ─────────────────────┐**
- React.js Frontend (webapp/)        │
- User Interface                   │
- API Integration                  │
- Task Management UI               │
- ┬────────────────────┘
- ↓
**┌─ API Layer ──┴────────────────────┐**
- Node.js Backend API               │
- Process Management              │
- Site Management                 │
- User Management                 │
- ┬────────────────────┘
- ↓
**┌─ Services ───┴────────────────────┐**
- ┌─────────────┐   ┌─────────────┐ │
- Camunda    │   │Notification │ │
- BPM Engine │   │  Service    │ │
- ┘   └─────────────┘ │
- ┬────────────────────┘
- ↓
**┌─ Data Layer ─┴────────────────────┐**
- MongoDB                           │
- ┘

##### Component Details

Frontend (Blue):
- Main React components (ProcessList, TaskTable, etc.)
- API integration points
- Routing structure

Backend API (Green):
- Controllers (processController, seedController)
- Service layer
- Route handlers

Camunda BPM (Orange):
- BPMN workflow integration
- REST API endpoints
- Task management system

Notification Service (Purple):
- Communication channels
- Notification topics

Database (Gray):
- MongoDB collections
- Data relationships

##### Connection and Data Flow

- REST API calls between frontend and backend
- Process execution flow through Camunda
- Database operations
- Notification dispatch paths

##### Additional Elements

Include:
- External service connections
- Authentication flow
- API endpoints listing
- Environment configurations

##### Specific Implementation Details

- The BPMN workflow integration (control_app_v2.bpmn)
- Task management flow between components
- Site and user management processes
- Notification dispatch system

##### Technical Stack Indicators

- React.js + TypeScript
- Node.js + Express
- Camunda BPM 7
- MongoDB
- Docker containers

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI["Frontend UI"]:::frontend
        API_INT["API Integration Layer"]:::frontend
        TASK_UI["Task Management UI"]:::frontend
        PROC_LIST["Process List Management"]:::frontend
        
        UI --> API_INT
        UI --> TASK_UI
        UI --> PROC_LIST
    end

    subgraph API
        PROC_CTRL["Process Management"]:::backend
        SITE_CTRL["Site Management"]:::backend
        USER_CTRL["User Management"]:::backend
        CONFIG["Configuration"]:::backend

        PROC_CTRL --> CONFIG
        SITE_CTRL --> CONFIG
        USER_CTRL --> CONFIG
    end

    subgraph Services
        CAMUNDA["Camunda BPM Engine"]:::camunda
        NOTIF["Notification Service"]:::notification
    end

    subgraph Data
        DB[(MongoDB)]:::database
    end

    API_INT --> PROC_CTRL
    API_INT --> SITE_CTRL
    API_INT --> USER_CTRL
    
    PROC_CTRL --> CAMUNDA
    SITE_CTRL --> CAMUNDA
    USER_CTRL --> CAMUNDA
    
    CAMUNDA --> NOTIF
    NOTIF --> API_INT

    PROC_CTRL --> DB
    SITE_CTRL --> DB
    USER_CTRL --> DB

    %% Click events for component mapping
    click UI "https://github.com/AlexSKuznetsov/control-app/tree/main/webapp/src/components/"
    click API_INT "https://github.com/AlexSKuznetsov/control-app/blob/main/webapp/src/api/processApi.ts"
    click TASK_UI "https://github.com/AlexSKuznetsov/control-app/blob/main/webapp/src/components/TaskTable.tsx"
    click PROC_LIST "https://github.com/AlexSKuznetsov/control-app/blob/main/webapp/src/components/ProcessList.tsx"
    click PROC_CTRL "https://github.com/AlexSKuznetsov/control-app/blob/main/backend/src/controllers/processController.ts"
    click SITE_CTRL "https://github.com/AlexSKuznetsov/control-app/blob/main/backend/src/routes/sites.ts"
    click USER_CTRL "https://github.com/AlexSKuznetsov/control-app/blob/main/backend/src/routes/users.ts"
    click CAMUNDA "https://github.com/AlexSKuznetsov/control-app/blob/main/camunda/control_app_v2.bpmn"
    click NOTIF "https://github.com/AlexSKuznetsov/control-app/blob/main/notification-service/app.js"
    click CONFIG "https://github.com/AlexSKuznetsov/control-app/blob/main/backend/src/config.ts"

    %% Styling
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef backend fill:#4CAF50,stroke:#2E7D32,color:white
    classDef camunda fill:#FF9800,stroke:#EF6C00,color:white
    classDef notification fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef database fill:#607D8B,stroke:#37474F,color:white

    %% Legend
    subgraph Legend
        FRONT["Frontend"]:::frontend
        BACK["Backend"]:::backend
        CAM["Camunda"]:::camunda
        NOT["Notification"]:::notification
        DAT["Database"]:::database
    end
```
