# pandeysidhartha/child-safety architecture

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

- Interactive diagram: https://gitdiagram.com/pandeysidhartha/child-safety
- Repository: https://github.com/pandeysidhartha/child-safety

## Overview

Guardian accepts text, images, and location pings through a Flask API, moderates content, records scan events, and alerts guardians when severity warrants it. A feed simulator exercises the same moderation flow; the React dashboard submits scans and simulations, polls for status and history, and presents alerts for review. Text and image moderation, geofencing, alert delivery, and persistent storage are distinct product stages. The README documents geofencing and Twilio/SMTP integrations; their route-level implementation is not fully shown in the excerpts.

Main entry points: [`frontend/src/App.jsx`](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/App.jsx) (Dashboard shell), [`backend/app.py`](https://github.com/pandeysidhartha/child-safety/blob/main/backend/app.py) (Flask API), [`backend/alerts/alert_manager.py`](https://github.com/pandeysidhartha/child-safety/blob/main/backend/alerts/alert_manager.py) (Alert manager), [`backend/storage/db.py`](https://github.com/pandeysidhartha/child-safety/blob/main/backend/storage/db.py) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs &amp; Dashboard"]
  node_dashboard["Dashboard shell<br/>[App.jsx]"]
  node_api_client["API client<br/>[client.js]"]
  node_scan_console["Scan console<br/>[ScanConsole.jsx]"]
  node_simulator_panel["Simulator panel<br/>[SimulatorPanel.jsx]"]
  node_status_banner["Status banner<br/>[StatusBanner.jsx]"]
  node_stats_row["Stats row<br/>[StatsRow.jsx]"]
  node_activity_pulse["Activity pulse<br/>[ActivityPulse.jsx]"]
  node_alert_feed["Alert feed<br/>[AlertFeed.jsx]"]
  node_events_log["Events log<br/>[EventsLog.jsx]"]
end

subgraph group_api["API &amp; Moderation"]
  node_backend_api["Flask API<br/>[app.py]"]
  node_text_moderator["Text moderation<br/>[text_moderator.py]"]
  node_image_moderator["Image moderation<br/>[image_moderator.py]"]
  node_feed_simulator["Feed simulator<br/>[feed_simulator.py]"]
end

subgraph group_safety["Alerts &amp; Geofencing"]
  node_alert_manager["Alert manager<br/>[alert_manager.py]"]
  node_sms_service["Twilio SMS"]
  node_email_service["SMTP email"]
  node_geofencing["Geofencing<br/>[app.py]"]
end

subgraph group_persistence["Persistence"]
  node_database[("SQLite database<br/>[db.py]")]
end

node_content_source(("Connected content source"))
node_guardian(("Guardian"))

node_dashboard -->|"calls"| node_api_client
node_dashboard -->|"renders"| node_status_banner
node_dashboard -->|"renders"| node_stats_row
node_dashboard -->|"renders"| node_activity_pulse
node_dashboard -->|"renders"| node_alert_feed
node_dashboard -->|"renders"| node_scan_console
node_dashboard -->|"renders"| node_simulator_panel
node_dashboard -->|"renders"| node_events_log
node_scan_console -->|"submits scan"| node_dashboard
node_simulator_panel -->|"submits run"| node_dashboard
node_alert_feed -->|"requests review"| node_dashboard
node_api_client -->|"HTTP requests"| node_backend_api
node_content_source -->|"sends content"| node_backend_api
node_backend_api -->|"analyzes text"| node_text_moderator
node_backend_api -->|"analyzes images"| node_image_moderator
node_backend_api -->|"generates sample feed"| node_feed_simulator
node_backend_api -->|"records and queries"| node_database
node_backend_api -->|"triggers alerts"| node_alert_manager
node_alert_manager -->|"reads child; stores alert"| node_database
node_alert_manager -->|"sends SMS"| node_sms_service
node_alert_manager -->|"sends email"| node_email_service
node_backend_api -->|"handles location ping"| node_geofencing
node_geofencing -.->|"checks and stores location"| node_database
node_geofencing -.->|"alerts on exit"| node_alert_manager
node_guardian -->|"receives notification"| node_alert_manager

click node_dashboard "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/api/client.js"
click node_scan_console "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/ScanConsole.jsx"
click node_simulator_panel "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/SimulatorPanel.jsx"
click node_status_banner "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/StatusBanner.jsx"
click node_stats_row "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/StatsRow.jsx"
click node_activity_pulse "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/ActivityPulse.jsx"
click node_alert_feed "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/AlertFeed.jsx"
click node_events_log "https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/EventsLog.jsx"
click node_backend_api "https://github.com/pandeysidhartha/child-safety/blob/main/backend/app.py"
click node_text_moderator "https://github.com/pandeysidhartha/child-safety/blob/main/backend/moderation/text_moderator.py"
click node_image_moderator "https://github.com/pandeysidhartha/child-safety/blob/main/backend/moderation/image_moderator.py"
click node_feed_simulator "https://github.com/pandeysidhartha/child-safety/blob/main/backend/simulator/feed_simulator.py"
click node_alert_manager "https://github.com/pandeysidhartha/child-safety/blob/main/backend/alerts/alert_manager.py"
click node_geofencing "https://github.com/pandeysidhartha/child-safety/blob/main/backend/app.py"
click node_database "https://github.com/pandeysidhartha/child-safety/blob/main/backend/storage/db.py"

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,node_api_client,node_scan_console,node_simulator_panel,node_status_banner,node_stats_row,node_activity_pulse,node_alert_feed,node_events_log toneBlue
class node_backend_api,node_text_moderator,node_image_moderator,node_feed_simulator toneAmber
class node_alert_manager,node_sms_service,node_email_service,node_geofencing toneMint
class node_database toneRose
class node_content_source,node_guardian toneIndigo
```

## Components

### Inputs & Dashboard

- [Dashboard shell](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [Scan console](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/ScanConsole.jsx): `frontend/src/components/ScanConsole.jsx`
- [Simulator panel](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/SimulatorPanel.jsx): `frontend/src/components/SimulatorPanel.jsx`
- [Status banner](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/StatusBanner.jsx): `frontend/src/components/StatusBanner.jsx`
- [Stats row](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/StatsRow.jsx): `frontend/src/components/StatsRow.jsx`
- [Activity pulse](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/ActivityPulse.jsx): `frontend/src/components/ActivityPulse.jsx`
- [Alert feed](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/AlertFeed.jsx): `frontend/src/components/AlertFeed.jsx`
- [Events log](https://github.com/pandeysidhartha/child-safety/blob/main/frontend/src/components/EventsLog.jsx): `frontend/src/components/EventsLog.jsx`

### API & Moderation

- [Flask API](https://github.com/pandeysidhartha/child-safety/blob/main/backend/app.py): `backend/app.py`
- [Text moderation](https://github.com/pandeysidhartha/child-safety/blob/main/backend/moderation/text_moderator.py): `backend/moderation/text_moderator.py`
- [Image moderation](https://github.com/pandeysidhartha/child-safety/blob/main/backend/moderation/image_moderator.py): `backend/moderation/image_moderator.py`
- [Feed simulator](https://github.com/pandeysidhartha/child-safety/blob/main/backend/simulator/feed_simulator.py): `backend/simulator/feed_simulator.py`

### Alerts & Geofencing

- [Alert manager](https://github.com/pandeysidhartha/child-safety/blob/main/backend/alerts/alert_manager.py): `backend/alerts/alert_manager.py`
- **Twilio SMS**
- **SMTP email**
- [Geofencing](https://github.com/pandeysidhartha/child-safety/blob/main/backend/app.py): `backend/app.py`

### Persistence

- [SQLite database](https://github.com/pandeysidhartha/child-safety/blob/main/backend/storage/db.py): `backend/storage/db.py`

### Other components

- **Connected content source**
- **Guardian**

## Connections

- Dashboard shell → API client: calls (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Status banner: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Stats row: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Activity pulse: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Alert feed: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Scan console: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Simulator panel: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Events log: renders (evidence: `frontend/src/App.jsx`)
- Scan console → Dashboard shell: submits scan (evidence: `frontend/src/App.jsx`)
- Simulator panel → Dashboard shell: submits run (evidence: `frontend/src/App.jsx`)
- Alert feed → Dashboard shell: requests review (evidence: `frontend/src/App.jsx`)
- API client → Flask API: HTTP requests (evidence: `README.md`)
- Connected content source → Flask API: sends content (evidence: `README.md`)
- Flask API → Text moderation: analyzes text (evidence: `backend/app.py`)
- Flask API → Image moderation: analyzes images (evidence: `backend/app.py`)
- Flask API → Feed simulator: generates sample feed (evidence: `backend/app.py`)
- Flask API → SQLite database: records and queries (evidence: `backend/app.py`)
- Flask API → Alert manager: triggers alerts (evidence: `backend/app.py`)
- Alert manager → SQLite database: reads child; stores alert (evidence: `backend/alerts/alert_manager.py`)
- Alert manager → Twilio SMS: sends SMS (evidence: `backend/alerts/alert_manager.py`)
- Alert manager → SMTP email: sends email (evidence: `backend/alerts/alert_manager.py`)
- Flask API → Geofencing: handles location ping (evidence: `README.md`)
- Geofencing → SQLite database: checks and stores location (evidence: `backend/app.py`)
- Geofencing → Alert manager: alerts on exit (evidence: `backend/app.py`)
- Guardian → Alert manager: receives notification (evidence: `README.md`)
