# en765/disastermaster architecture

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

- Interactive diagram: https://gitdiagram.com/en765/disastermaster
- Repository: https://github.com/en765/disastermaster

## Overview

##### Main Components

a) Frontend Layer (React.js):
- User Interface Components
- Authentication Module
- Disaster Reporting Interface
- Notification Center
- Resource Information Display
- Integration (OpenStreetMap)

b) Backend Layer (Spring Boot):
- REST API Controllers
- Authentication Service (OAuth 2.0)
- Disaster Management Service
- Notification Service (Twilio)
- Report Generation Service
- Resource Management Service

c) Database Layer:
- User Data Store
- Disaster Reports Storage
- Resource Information Storage

d) External Services:
- Twilio (for notifications)
- OpenStreetMap Integration
- OAuth 2.0 Provider

##### Component Relationships

- Frontend → Backend (REST API calls)
- Backend → Database (data persistence)
- Backend → External Services (third-party integrations)
- Backend → Notification Service (email notifications)

##### User Role Flows

Separate flows for different user types:
- Regular Users (disaster reporting, resource viewing)
- Authorities (report management, status updates)
- Humanitarian Organizations (resource management)

##### Key Architectural Patterns to Highlight

- Client-Server Architecture
- RESTful API Design
- Microservices-like separation of concerns
- Event-driven notification system

##### Additional Details

Annotations for:
- Security layers (OAuth 2.0)
- Data flow directions
- API endpoints
- Service boundaries

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef frontend fill:#blue,stroke:#333,stroke-width:2px
    classDef backend fill:#green,stroke:#333,stroke-width:2px
    classDef database fill:#gray,stroke:#333,stroke-width:2px
    classDef external fill:#yellow,stroke:#333,stroke-width:2px
    classDef critical fill:#red,stroke:#333,stroke-width:2px

    %% Frontend Layer
    subgraph Frontend
        UI[User Interface Components]:::frontend
        Auth[Authentication Module]:::frontend
        DRI[Disaster Reporting Interface]:::frontend
        NC[Notification Center]:::frontend
        RID[Resource Information Display]:::frontend
        Map[Map Integration]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        API[REST API Controllers]:::backend
        AuthService[Authentication Service]:::backend
        DMS[Disaster Management Service]:::backend
        NS[Notification Service]:::backend
        RGS[Report Generation Service]:::backend
        RMS[Resource Management Service]:::backend
    end
    click Backend "https://github.com/en765/DisasterMaster/blob/main/IzvorniKod/dm-be/src/main/java/dm_be/DmBeApplication.java"
    click API "https://github.com/en765/DisasterMaster/blob/main/IzvorniKod/dm-be/src/main/resources/application.properties"
    click AuthService "https://github.com/en765/DisasterMaster/blob/main/IzvorniKod/dm-be/pom.xml"
    click DMS "https://github.com/en765/DisasterMaster/blob/main/IzvorniKod/dm-be/src/test/java/dm_be/DmBeApplicationTests.java"

    %% Database Layer
    subgraph Database
        UDS[(User Data Store)]:::database
        DRS[(Disaster Reports Storage)]:::database
        RIS[(Resource Information Storage)]:::database
    end

    %% External Services
    subgraph External
        Twilio[Twilio Service]:::external
        OSM[OpenStreetMap]:::external
        OAuth[OAuth 2.0 Provider]:::external
    end

    %% User Roles
    subgraph Users
        RegUser[Regular Users]
        Auth[Authorities]
        HumOrg[Humanitarian Organizations]
    end

    %% Connections
    RegUser --> UI
    Auth --> UI
    HumOrg --> UI

    UI --> API
    DRI --> API
    NC --> API
    RID --> API
    Map --> API

    API --> AuthService
    API --> DMS
    API --> NS
    API --> RGS
    API --> RMS

    AuthService --> OAuth
    NS --> Twilio
    Map --> OSM

    AuthService --> UDS
    DMS --> DRS
    RMS --> RIS

    %% Legend
    subgraph Legend
        L1[Frontend Components]:::frontend
        L2[Backend Services]:::backend
        L3[Databases]:::database
        L4[External Services]:::external
        L5[Critical Paths]:::critical
    end
```
