# migaradenuwan/franklin architecture

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

- Interactive diagram: https://gitdiagram.com/migaradenuwan/franklin
- Repository: https://github.com/migaradenuwan/franklin

## Overview

Franklin is a sea-turtle conservation monitoring system: users view live camera and habitat monitoring, review AI detections and health findings, and act on alerts or reports. The React application presents dashboard, hatchery, nest, shoreline, turtle-health, notification, and report workflows. Its Express API coordinates domain services and MongoDB-backed records; Python inference services provide detection and shoreline analysis. The README documents disease, predator/human, nest, and shoreline capabilities, though the sampled excerpts do not establish every model-to-API connection. Google Drive integration is documented, but its runtime caller was not sampled.

Main entry points: [`Backend/src/app.js`](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/app.js) (HTTP API), [`Backend/src/config/db.js`](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/config/db.js) (MongoDB), [`Backend/src/modules/shoreline/shoreline.controller.js`](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/shoreline/shoreline.controller.js) (Shoreline analysis), [`Backend/src/modules/detections/detections.controller.js`](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/detections/detections.controller.js) (Detection intake)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Monitoring interface"]
  node_dashboard_ui["Dashboard<br/>[HomePage.jsx]"]
  node_hatchery_ui["Hatchery view<br/>[HatcheryPage.jsx]"]
  node_nests_ui["Nest monitoring"]
  node_shoreline_ui["Shoreline risk"]
  node_health_ui["Turtle health"]
  node_reports_ui["Reports<br/>[ReportsPage.jsx]"]
  node_notifications_ui["Notifications"]
end

subgraph group_api["Conservation API"]
  node_express["HTTP API<br/>[app.js]"]
  node_camera_api["Camera control"]
  node_streaming["Camera streaming"]
  node_hatchery_api["Hatchery workflows"]
  node_shoreline_api["Shoreline analysis"]
  node_detections_api["Detection intake"]
  node_dashboard_api["Dashboard aggregation"]
  node_reports_api["Report generation"]
  node_notifications["Detection notifications"]
end

subgraph group_inference["AI inference"]
  node_combined_ai["Combined AI service<br/>[app.py]"]
  node_unified_ai["Video analysis<br/>[app.py]"]
  node_shoreline_ai["Shoreline segmentation<br/>[app.py]"]
end

subgraph group_state["Records and services"]
  node_database[("MongoDB<br/>[db.js]")]
end

subgraph group_integrations["External systems"]
  node_drive[("Google Drive")]
  node_camera(("CCTV camera"))
  node_ai_hatchery["Hatchery AI service"]
  node_mail["Email service"]
end

node_conservationist(("Conservationist"))

node_conservationist -->|"views"| node_dashboard_ui
node_conservationist -->|"monitors"| node_hatchery_ui
node_conservationist -->|"monitors"| node_nests_ui
node_conservationist -->|"reviews"| node_shoreline_ui
node_conservationist -->|"reviews"| node_health_ui
node_conservationist -->|"requests"| node_reports_ui
node_conservationist -->|"reviews"| node_notifications_ui
node_camera -->|"provides video"| node_streaming
node_camera_api -->|"reads/writes"| node_database
node_camera_api -->|"starts/stops"| node_streaming
node_streaming -->|"reads stream"| node_camera
node_hatchery_api -->|"requests stream/data"| node_ai_hatchery
node_hatchery_api -->|"reads/writes alerts"| node_database
node_shoreline_api -->|"requests prediction"| node_combined_ai
node_shoreline_api -->|"stores alerts"| node_database
node_shoreline_api -.->|"sends alerts"| node_mail
node_combined_ai -.->|"shoreline inference"| node_shoreline_ai
node_combined_ai -.->|"unified analysis"| node_unified_ai
node_unified_ai -->|"posts detections"| node_detections_api
node_detections_api -->|"saves records"| node_database
node_detections_api -->|"tracks detection"| node_notifications
node_dashboard_api -->|"aggregates records"| node_database
node_reports_api -->|"loads report data"| node_database
node_reports_api -.->|"stores monitoring logs"| node_drive
node_dashboard_ui -->|"requests dashboard"| node_express
node_hatchery_ui -->|"requests hatchery"| node_express
node_nests_ui -->|"requests nest data"| node_express
node_shoreline_ui -->|"requests monitoring"| node_express
node_health_ui -->|"requests health"| node_express
node_reports_ui -->|"requests reports"| node_express
node_notifications_ui -->|"requests alerts"| node_express

click node_dashboard_ui "https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/dashboard/HomePage.jsx"
click node_hatchery_ui "https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/hatchery/HatcheryPage.jsx"
click node_nests_ui "https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/nests/NestMonitoringPage.jsx"
click node_shoreline_ui "https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/shoreline/pages/ShorelineRiskPage.jsx"
click node_health_ui "https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/turtles/TurtleHealthPage.jsx"
click node_reports_ui "https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/reports/ReportsPage.jsx"
click node_notifications_ui "https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/notifications/NotificationsPage.jsx"
click node_express "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/app.js"
click node_camera_api "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/cameras/camera.controller.js"
click node_streaming "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/streaming/streaming.service.js"
click node_hatchery_api "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/hatchery/hatchery.controller.js"
click node_shoreline_api "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/shoreline/shoreline.controller.js"
click node_detections_api "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/detections/detections.controller.js"
click node_dashboard_api "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/dashboard/dashboard.controller.js"
click node_reports_api "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/reports/reports.controller.js"
click node_notifications "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/notifications/notification.service.js"
click node_combined_ai "https://github.com/migaradenuwan/franklin/blob/main/Models/AI_Service/app.py"
click node_unified_ai "https://github.com/migaradenuwan/franklin/blob/main/Models/Unified_Backend/app.py"
click node_shoreline_ai "https://github.com/migaradenuwan/franklin/blob/main/Models/Shoreline_Segmentation_Backend/app.py"
click node_database "https://github.com/migaradenuwan/franklin/blob/main/Backend/src/config/db.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard_ui,node_hatchery_ui,node_nests_ui,node_shoreline_ui,node_health_ui,node_reports_ui,node_notifications_ui toneBlue
class node_express,node_camera_api,node_streaming,node_hatchery_api,node_shoreline_api,node_detections_api,node_dashboard_api,node_reports_api,node_notifications toneAmber
class node_combined_ai,node_unified_ai,node_shoreline_ai toneMint
class node_database toneRose
class node_drive,node_camera,node_ai_hatchery,node_mail,node_conservationist toneIndigo
```

## Components

### Monitoring interface

- [Dashboard](https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/dashboard/HomePage.jsx): `Frontend/src/modules/dashboard/HomePage.jsx`
- [Hatchery view](https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/hatchery/HatcheryPage.jsx): `Frontend/src/modules/hatchery/HatcheryPage.jsx`
- [Nest monitoring](https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/nests/NestMonitoringPage.jsx): `Frontend/src/modules/nests/NestMonitoringPage.jsx`
- [Shoreline risk](https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/shoreline/pages/ShorelineRiskPage.jsx): `Frontend/src/modules/shoreline/pages/ShorelineRiskPage.jsx`
- [Turtle health](https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/turtles/TurtleHealthPage.jsx): `Frontend/src/modules/turtles/TurtleHealthPage.jsx`
- [Reports](https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/reports/ReportsPage.jsx): `Frontend/src/modules/reports/ReportsPage.jsx`
- [Notifications](https://github.com/migaradenuwan/franklin/blob/main/Frontend/src/modules/notifications/NotificationsPage.jsx): `Frontend/src/modules/notifications/NotificationsPage.jsx`

### Conservation API

- [HTTP API](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/app.js): `Backend/src/app.js`
- [Camera control](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/cameras/camera.controller.js): `Backend/src/modules/cameras/camera.controller.js`
- [Camera streaming](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/streaming/streaming.service.js): `Backend/src/modules/streaming/streaming.service.js`
- [Hatchery workflows](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/hatchery/hatchery.controller.js): `Backend/src/modules/hatchery/hatchery.controller.js`
- [Shoreline analysis](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/shoreline/shoreline.controller.js): `Backend/src/modules/shoreline/shoreline.controller.js`
- [Detection intake](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/detections/detections.controller.js): `Backend/src/modules/detections/detections.controller.js`
- [Dashboard aggregation](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/dashboard/dashboard.controller.js): `Backend/src/modules/dashboard/dashboard.controller.js`
- [Report generation](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/reports/reports.controller.js): `Backend/src/modules/reports/reports.controller.js`
- [Detection notifications](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/modules/notifications/notification.service.js): `Backend/src/modules/notifications/notification.service.js`

### AI inference

- [Combined AI service](https://github.com/migaradenuwan/franklin/blob/main/Models/AI_Service/app.py): `Models/AI_Service/app.py`
- [Video analysis](https://github.com/migaradenuwan/franklin/blob/main/Models/Unified_Backend/app.py): `Models/Unified_Backend/app.py`
- [Shoreline segmentation](https://github.com/migaradenuwan/franklin/blob/main/Models/Shoreline_Segmentation_Backend/app.py): `Models/Shoreline_Segmentation_Backend/app.py`

### Records and services

- [MongoDB](https://github.com/migaradenuwan/franklin/blob/main/Backend/src/config/db.js): `Backend/src/config/db.js`

### External systems

- **Google Drive**
- **CCTV camera**
- **Hatchery AI service**
- **Email service**

### Other components

- **Conservationist**

## Connections

- Conservationist → Dashboard: views
- Conservationist → Hatchery view: monitors
- Conservationist → Nest monitoring: monitors
- Conservationist → Shoreline risk: reviews
- Conservationist → Turtle health: reviews
- Conservationist → Reports: requests
- Conservationist → Notifications: reviews
- CCTV camera → Camera streaming: provides video
- Camera control → MongoDB: reads/writes
- Camera control → Camera streaming: starts/stops
- Camera streaming → CCTV camera: reads stream
- Hatchery workflows → Hatchery AI service: requests stream/data
- Hatchery workflows → MongoDB: reads/writes alerts
- Shoreline analysis → Combined AI service: requests prediction
- Shoreline analysis → MongoDB: stores alerts
- Shoreline analysis → Email service: sends alerts
- Combined AI service → Shoreline segmentation: shoreline inference
- Combined AI service → Video analysis: unified analysis
- Video analysis → Detection intake: posts detections
- Detection intake → MongoDB: saves records
- Detection intake → Detection notifications: tracks detection
- Dashboard aggregation → MongoDB: aggregates records
- Report generation → MongoDB: loads report data
- Report generation → Google Drive: stores monitoring logs
- Dashboard → HTTP API: requests dashboard
- Hatchery view → HTTP API: requests hatchery
- Nest monitoring → HTTP API: requests nest data
- Shoreline risk → HTTP API: requests monitoring
- Turtle health → HTTP API: requests health
- Reports → HTTP API: requests reports
- Notifications → HTTP API: requests alerts
