# mrvenom17/sihp-intelrisk architecture

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

- Interactive diagram: https://gitdiagram.com/mrvenom17/sihp-intelrisk
- Repository: https://github.com/mrvenom17/sihp-intelrisk

## Overview

##### Project type and purpose
- Full-stack, real-time disaster intelligence platform.
- Front-end: React + TypeScript SPA for interactive mapping, dashboards, fact-checking.
- Back-end: Node.js + Express API (JWT auth, rate limiting, validation) plus a PostgreSQL database.
- AI Processing Pipeline: Python modules (extractor, detecter, analyser, checker) orchestrated together.

##### File structure
- Top level:
- Front-End/ – React app (components, hooks, services).
- Back-End/ – Express API (config, middleware, routes, services).
- src/ – Python "agents" (analyser, checker, detecter, extractor), core, schema, orchestrator.
- server/ – Python API mock server (for local microservice testing).
- docs/ – ADRs detailing design of each Python agent and orchestrator.
- benchmarks/ – performance tests for each Python agent.
- Patterns:
- Front vs Back separation
- Node API → Python microservices pipeline
- MVC-style on Express (routes → services → database)
- Microservice/pipeline pattern for AI stages

##### README insights
- Tech stack summary (React, Express, PostgreSQL, JWT, Joi, Tailwind, Leaflet).
- Feature list (hotspots, fact checker, export).
- Environment variables (.env).
- API endpoints under /api/v1 for auth, hotspots, fact-check, export.
- Quick start scripts (start-dev.sh, docker-compose.yml).

##### Detail
- Inside the AI Pipeline cluster, detail each stage (extractor, detecter, analyser, checker) and the orchestrator flow.
- Data formats flowing between components (JSON over HTTP, CSV/JSON export).
- External dependencies (OpenStreetMap, third-party AI models if any).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Front-End (React SPA)"
        FE_Main["main.tsx"]:::frontend
        FE_App["App.tsx"]:::frontend
        FE_Comp["components/"]:::frontend
        FE_API["api.ts"]:::frontend
        FE_Hooks["useAuth.tsx"]:::frontend
    end

    subgraph "Back-End API (Express.js)"
        BE_Server["server.ts"]:::backend
        BE_Config["database.ts"]:::backend
        BE_MW_Auth["auth.ts"]:::backend
        BE_MW_Val["validation.ts"]:::backend
        BE_R_Auth["auth.ts"]:::backend
        BE_R_HS["hotspots.ts"]:::backend
        BE_R_FC["factCheck.ts"]:::backend
        BE_R_Exp["export.ts"]:::backend
        BE_Svc["factCheckService.ts"]:::backend
        BE_Types["types/index.ts"]:::backend
    end

    DB["PostgreSQL"]:::db

    subgraph "AI Pipeline (Python Microservices)"
        ORC["main.py"]:::ai
        EXT["extractor.py"]:::ai
        DET["detecter.py"]:::ai
        ANL["analyser.py"]:::ai
        CHK["checker.py"]:::ai
        CORE_Models["models.py"]:::ai
        CORE_DB["database.py"]:::ai
        CORE_Met["metrics.py"]:::ai
    end

    subgraph "Python Mock Server"
        MS_Main["main.py"]:::external
        MS_Extr["mock_extractor.py"]:::external
        MS_Det["mock_detecter.py"]:::external
        MS_Start["start_server.py"]:::external
    end

    subgraph "Documentation (ADRs)"
        ADR1["ADR-001-analyser-design.md"]:::external
        ADR2["ADR-002-checker-design.md"]:::external
        ADR3["ADR-003-extractor-design.md"]:::external
        ADR4["ADR-004-detecter-design.md"]:::external
        ADR5["ADR-005-orchestrator-design.md"]:::external
        ADR6["ADR-006-models-design.md"]:::external
        ADR7["ADR-007-schema-design.md"]:::external
    end

    subgraph "External Services"
        OSM["OpenStreetMap Tiles"]:::external
        SMTP["SMTP / File Storage"]:::external
    end

    User --> FE_Main
    FE_Main --> FE_App
    FE_App --> FE_Comp
    FE_App --> FE_API
    FE_App --> FE_Hooks
    FE_API --> BE_Server
    FE_API --> OSM
    FE_Hooks --> BE_Server

    BE_Server --> BE_Config
    BE_Server --> BE_MW_Auth
    BE_Server --> BE_MW_Val
    BE_Server --> BE_R_Auth
    BE_Server --> BE_R_HS
    BE_Server --> BE_R_FC
    BE_Server --> BE_R_Exp
    BE_Server --> DB

    BE_R_FC --> BE_Svc
    BE_Svc --> ORC

    BE_R_Auth --> DB
    BE_R_HS --> DB
    BE_R_Exp --> DB

    ORC --> EXT
    EXT --> DET
    DET --> ANL
    ANL --> CHK
    CHK --> ORC

    ORC --> CORE_Models
    ORC --> CORE_DB
    ORC --> CORE_Met

    MS_Main --> MS_Extr
    MS_Main --> MS_Det
    MS_Start --> MS_Main

    click FE_Main "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Front-End/src/main.tsx"
    click FE_App "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Front-End/src/App.tsx"
    click FE_Comp "https://github.com/mrvenom17/sihp-intelrisk/tree/main/Front-End/src/components/"
    click FE_API "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Front-End/src/services/api.ts"
    click FE_Hooks "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Front-End/src/hooks/useAuth.tsx"

    click BE_Server "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/server.ts"
    click BE_Config "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/config/database.ts"
    click BE_MW_Auth "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/middleware/auth.ts"
    click BE_MW_Val "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/middleware/validation.ts"
    click BE_R_Auth "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/routes/auth.ts"
    click BE_R_HS "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/routes/hotspots.ts"
    click BE_R_FC "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/routes/factCheck.ts"
    click BE_R_Exp "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/routes/export.ts"
    click BE_Svc "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/services/factCheckService.ts"
    click BE_Types "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/types/index.ts"

    click DB "https://github.com/mrvenom17/sihp-intelrisk/blob/main/Back-End/src/config/database.ts"

    click ORC "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/orchestrator/main.py"
    click EXT "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/extractor/extractor.py"
    click DET "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/detecter/detecter.py"
    click ANL "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/analyser/analyser.py"
    click CHK "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/checker/checker.py"
    click CORE_Models "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/core/models.py"
    click CORE_DB "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/core/database.py"
    click CORE_Met "https://github.com/mrvenom17/sihp-intelrisk/blob/main/src/core/metrics.py"

    click MS_Main "https://github.com/mrvenom17/sihp-intelrisk/blob/main/server/main.py"
    click MS_Extr "https://github.com/mrvenom17/sihp-intelrisk/blob/main/server/mock_extractor.py"
    click MS_Det "https://github.com/mrvenom17/sihp-intelrisk/blob/main/server/mock_detecter.py"
    click MS_Start "https://github.com/mrvenom17/sihp-intelrisk/blob/main/server/start_server.py"

    click ADR1 "https://github.com/mrvenom17/sihp-intelrisk/blob/main/docs/ADR-001-analyser-design.md"
    click ADR2 "https://github.com/mrvenom17/sihp-intelrisk/blob/main/docs/ADR-002-checker-design.md"
    click ADR3 "https://github.com/mrvenom17/sihp-intelrisk/blob/main/docs/ADR-003-extractor-design.md"
    click ADR4 "https://github.com/mrvenom17/sihp-intelrisk/blob/main/docs/ADR-004-detecter-design.md"
    click ADR5 "https://github.com/mrvenom17/sihp-intelrisk/blob/main/docs/ADR-005-orchestrator-design.md"
    click ADR6 "https://github.com/mrvenom17/sihp-intelrisk/blob/main/docs/ADR-006-models-design.md"
    click ADR7 "https://github.com/mrvenom17/sihp-intelrisk/blob/main/docs/ADR-007-schema-design.md"

    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#DFFFE0,stroke:#228B22,color:#228B22;
    classDef db fill:#FFE4B5,stroke:#CD853F,color:#CD853F;
    classDef ai fill:#E8D0FF,stroke:#800080,color:#800080;
    classDef external fill:#F0F0F0,stroke:#808080,color:#808080;
```
