# manmathk31/child-tracker-app architecture

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

- Interactive diagram: https://gitdiagram.com/manmathk31/child-tracker-app
- Repository: https://github.com/manmathk31/child-tracker-app

## Overview

ChildTrack is a child-safety monitoring backend with browser and API workflows. Users authenticate and manage students, wearables, zones, and alert settings; incoming wearable telemetry is localized, persisted as location history, and evaluated for safety events, while dashboards expose current occupancy and alerts. The sampled code confirms application startup and route registration, authentication, MQTT-to-localization processing, SOS alert creation, and dashboard-to-alert queries. Other management routes and background alert monitoring are documented by module names and startup wiring, but their internal calls were not sampled.

Main entry points: [`backend/app/main.py`](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/main.py) (Application), [`backend/app/database/session.py`](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/database/session.py) (Database), [`backend/app/services/proximity_service.py`](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/proximity_service.py) (Telemetry localization), [`backend/app/routers/auth.py`](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/auth.py) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_main["Application<br/>[main.py]"]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_auth_service["Authentication service<br/>[auth_service.py]"]
  node_security["Token security<br/>[security.py]"]
end

subgraph group_monitoring["Telemetry and safety"]
  node_mqtt["MQTT ingestion<br/>[mqtt_service.py]"]
  node_proximity["Telemetry localization"]
  node_location_schema["Telemetry schemas<br/>[location.py]"]
  node_alert_service["Alert monitoring<br/>[alert_service.py]"]
  node_scheduler["Alert scheduler<br/>[alert_scheduler.py]"]
  node_tether["Testing tether"]
  node_tracking_routes["Tracking routes<br/>[tracking.py]"]
end

subgraph group_operations["Monitoring and management"]
  node_management_routes["Management routes"]
  node_device_service["Device management<br/>[device_service.py]"]
  node_student_service["Student management<br/>[student_service.py]"]
  node_zone_service["Zone management<br/>[zone_service.py]"]
  node_settings_service["Alert settings"]
  node_dashboard_routes["Dashboard routes<br/>[dashboard.py]"]
  node_dashboard_service["Dashboard aggregation"]
  node_alerts_routes["Alert routes<br/>[alerts.py]"]
end

subgraph group_data["Domain data"]
  node_database[("Database<br/>[session.py]")]
  node_models["Domain models"]
end

node_staff(("School staff"))

node_staff -->|"signs in"| node_auth_routes
node_staff -.->|"manages records"| node_management_routes
node_staff -.->|"views status"| node_dashboard_routes
node_main -->|"registers routes"| node_auth_routes
node_main -->|"registers routes"| node_dashboard_routes
node_main -->|"registers routes"| node_management_routes
node_main -->|"registers routes"| node_alerts_routes
node_main -->|"registers routes"| node_tracking_routes
node_main -->|"starts monitor"| node_scheduler
node_main -->|"starts optionally"| node_mqtt
node_auth_routes -->|"authenticates user"| node_auth_service
node_auth_routes -->|"creates tokens"| node_security
node_auth_service -->|"checks passwords"| node_security
node_management_routes -->|"uses device logic"| node_device_service
node_mqtt -->|"submits telemetry"| node_proximity
node_mqtt -.->|"handles tether data"| node_tether
node_proximity -->|"creates SOS alert"| node_alert_service
node_proximity -->|"validates payload"| node_location_schema
node_dashboard_service -->|"queries active alerts"| node_alert_service
node_alert_service -->|"reads thresholds"| node_settings_service
node_proximity -.->|"stores location records"| node_database
node_auth_service -.->|"reads and writes users"| node_database
node_alert_service -.->|"persists alerts"| node_database
node_dashboard_service -.->|"reads monitoring data"| node_database
node_database -.->|"stores domain entities"| node_models

click node_main "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/auth.py"
click node_auth_service "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/auth_service.py"
click node_security "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/core/security.py"
click node_management_routes "https://github.com/manmathk31/child-tracker-app/tree/main/backend/app/routers"
click node_device_service "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/device_service.py"
click node_student_service "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/student_service.py"
click node_zone_service "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/zone_service.py"
click node_settings_service "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/settings_service.py"
click node_dashboard_routes "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/dashboard.py"
click node_dashboard_service "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/dashboard_service.py"
click node_mqtt "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/mqtt_service.py"
click node_proximity "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/proximity_service.py"
click node_location_schema "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/schemas/location.py"
click node_alert_service "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/alert_service.py"
click node_scheduler "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/alert_scheduler.py"
click node_tether "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/testing_tether_service.py"
click node_database "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/database/session.py"
click node_models "https://github.com/manmathk31/child-tracker-app/tree/main/backend/app/models"
click node_alerts_routes "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/alerts.py"
click node_tracking_routes "https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/tracking.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_main toneBlue
class node_auth_routes,node_auth_service,node_security toneAmber
class node_mqtt,node_proximity,node_location_schema,node_alert_service,node_scheduler,node_tether,node_tracking_routes toneMint
class node_management_routes,node_device_service,node_student_service,node_zone_service,node_settings_service,node_dashboard_routes,node_dashboard_service,node_alerts_routes toneRose
class node_database,node_models,node_staff toneIndigo
```

## Components

### App entry

- [Application](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/main.py): `backend/app/main.py`

### Identity and access

- [Authentication routes](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Authentication service](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Token security](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/core/security.py): `backend/app/core/security.py`

### Telemetry and safety

- [MQTT ingestion](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/mqtt_service.py): `backend/app/services/mqtt_service.py`
- [Telemetry localization](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/proximity_service.py): `backend/app/services/proximity_service.py`
- [Telemetry schemas](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/schemas/location.py): `backend/app/schemas/location.py`
- [Alert monitoring](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/alert_service.py): `backend/app/services/alert_service.py`
- [Alert scheduler](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/alert_scheduler.py): `backend/app/services/alert_scheduler.py`
- [Testing tether](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/testing_tether_service.py): `backend/app/services/testing_tether_service.py`
- [Tracking routes](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/tracking.py): `backend/app/routers/tracking.py`

### Monitoring and management

- [Management routes](https://github.com/manmathk31/child-tracker-app/tree/main/backend/app/routers): `backend/app/routers`
- [Device management](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/device_service.py): `backend/app/services/device_service.py`
- [Student management](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/student_service.py): `backend/app/services/student_service.py`
- [Zone management](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/zone_service.py): `backend/app/services/zone_service.py`
- [Alert settings](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/settings_service.py): `backend/app/services/settings_service.py`
- [Dashboard routes](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/dashboard.py): `backend/app/routers/dashboard.py`
- [Dashboard aggregation](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/services/dashboard_service.py): `backend/app/services/dashboard_service.py`
- [Alert routes](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/routers/alerts.py): `backend/app/routers/alerts.py`

### Domain data

- [Database](https://github.com/manmathk31/child-tracker-app/blob/main/backend/app/database/session.py): `backend/app/database/session.py`
- [Domain models](https://github.com/manmathk31/child-tracker-app/tree/main/backend/app/models): `backend/app/models`

### Other components

- **School staff**

## Connections

- School staff → Authentication routes: signs in (evidence: `backend/app/routers/auth.py`)
- School staff → Management routes: manages records
- School staff → Dashboard routes: views status
- Application → Authentication routes: registers routes (evidence: `backend/app/main.py`)
- Application → Dashboard routes: registers routes (evidence: `backend/app/main.py`)
- Application → Management routes: registers routes (evidence: `backend/app/main.py`)
- Application → Alert routes: registers routes (evidence: `backend/app/main.py`)
- Application → Tracking routes: registers routes (evidence: `backend/app/main.py`)
- Application → Alert scheduler: starts monitor (evidence: `backend/app/main.py`)
- Application → MQTT ingestion: starts optionally (evidence: `backend/app/main.py`)
- Authentication routes → Authentication service: authenticates user (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Token security: creates tokens (evidence: `backend/app/routers/auth.py`)
- Authentication service → Token security: checks passwords (evidence: `backend/app/services/auth_service.py`)
- Management routes → Device management: uses device logic (evidence: `backend/app/routers/devices.py`)
- MQTT ingestion → Telemetry localization: submits telemetry (evidence: `backend/app/services/mqtt_service.py`)
- MQTT ingestion → Testing tether: handles tether data (evidence: `backend/app/services/mqtt_service.py`)
- Telemetry localization → Alert monitoring: creates SOS alert (evidence: `backend/app/services/proximity_service.py`)
- Telemetry localization → Telemetry schemas: validates payload (evidence: `backend/app/services/mqtt_service.py`)
- Dashboard aggregation → Alert monitoring: queries active alerts (evidence: `backend/app/services/dashboard_service.py`)
- Alert monitoring → Alert settings: reads thresholds (evidence: `backend/app/services/alert_service.py`)
- Telemetry localization → Database: stores location records
- Authentication service → Database: reads and writes users
- Alert monitoring → Database: persists alerts
- Dashboard aggregation → Database: reads monitoring data
- Database → Domain models: stores domain entities
