# rohit1817-45/lost_found_universal architecture

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

- Interactive diagram: https://gitdiagram.com/rohit1817-45/lost_found_universal
- Repository: https://github.com/rohit1817-45/lost_found_universal

## Overview

#### Purpose and Entry Points
This is a case-reporting and matching platform with distinct user, NGO, police, and admin experiences. The frontend application starts at `frontend/src/index.js` and composes routes/UI from `frontend/src/App.js`. Backend API startup is centered on `backend/server.py`.

#### Client Application and Role-Based Experiences
React frontend pages implement public, account, reporting, browsing, case-detail, messaging, and role-specific dashboard flows. Route access is guarded by `frontend/src/components/ProtectedRoute.jsx`; session/auth state is handled in `frontend/src/lib/auth.jsx`.
- `frontend/src/pages/Apply.jsx`
- `frontend/src/pages/Browse.jsx`
- `frontend/src/pages/PoliceDashboard.jsx`

#### Case Reporting and Investigation Domain
Case creation and presentation form the core domain boundary. The report workflow is represented by `frontend/src/components/ReportWizard.jsx`, case discovery/detail by page components, and backend case operations by `backend/cases.py`. Matching logic is isolated from case CRUD in `backend/matching.py`.
- `frontend/src/pages/CaseDetail.jsx`
- `frontend/src/components/CaseCard.jsx`
- `backend/cases.py`

#### API, Authorization, and Service Boundaries
The backend groups API responsibilities by domain: authentication, cases, matching, messaging, and administration. Shared request dependencies/authorization enforcement likely belong in `backend/deps.py`, while persistence-facing schemas/entities are centralized in `backend/models.py`.
- `backend/auth.py`
- `backend/messaging.py`
- `backend/admin.py`

#### Data Platform and External Services
Supabase is the primary managed data boundary, with SQL migrations defining the database schema and storage setup. The frontend directly configures a Supabase client, while backend services likely use the same underlying platform for protected operations. Environment-specific secrets/configuration are separated under frontend and backend `.env` files.
- `supabase/migrations/00_schema.sql`
- `supabase/migrations/01_storage.sql`
- `frontend/src/lib/supabase.js`

#### Operational Automation
Deployment guidance is captured in `DEPLOY.md`. Emergent-managed cron scripts monitor and dispatch webhook-triggered scheduled work, creating an infrastructure boundary outside the application request path.
- `.emergent/cron/watch_crons.sh`
- `.emergent/cron/dispatch_webhook.sh`
- `.emergent/cron/webhook_crond.sh`

Main entry points: [`frontend/src/App.js`](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/App.js) (App routes), [`backend/server.py`](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/server.py) (API server), [`backend/cases.py`](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/cases.py) (Case operations), [`backend/models.py`](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/models.py) (Data models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React client"]
  node_client_entry["Client entry<br/>React bootstrap<br/>[index.js]"]
  node_app_routes["App routes<br/>React app shell<br/>[App.js]"]
  node_auth_state["Auth session<br/>auth state<br/>[auth.jsx]"]
  node_route_guard["Protected routes<br/>route guard<br/>[ProtectedRoute.jsx]"]
  node_report_wizard["Report wizard<br/>case reporting UI<br/>[ReportWizard.jsx]"]
  node_case_browse["Case browsing<br/>browse page<br/>[Browse.jsx]"]
  node_case_detail["Case detail<br/>[CaseDetail.jsx]"]
  node_role_dashboards["Role experiences<br/>application pages<br/>[Apply.jsx]"]
  node_police_dashboard["Police dashboard<br/>investigation dashboard"]
  node_supabase_client["Supabase client<br/>data client<br/>[supabase.js]"]
end

subgraph group_backend["Backend API"]
  node_api_server{{"API server<br/>backend entrypoint<br/>[server.py]"}}
  node_authorization["Request authorization<br/>shared dependencies<br/>[deps.py]"]
  node_auth_api["Authentication API<br/>auth service<br/>[auth.py]"]
  node_case_api["Case operations<br/>case API<br/>[cases.py]"]
  node_matching["Matching engine<br/>matching service<br/>[matching.py]"]
  node_messaging_api["Messaging API<br/>messaging service<br/>[messaging.py]"]
  node_admin_api["Administration API<br/>admin service<br/>[admin.py]"]
  node_data_models["Data models<br/>schemas and entities<br/>[models.py]"]
end

subgraph group_data["Data platform"]
  node_supabase[("Supabase platform<br/>managed data and storage<br/>[00_schema.sql]")]
  node_storage_schema["Storage setup<br/>storage migration<br/>[01_storage.sql]"]
end

subgraph group_operations["Operations"]
  node_deployment["Deployment guidance<br/>operations documentation<br/>[DEPLOY.md]"]
  node_cron_monitor["Cron monitor<br/>scheduled work monitor<br/>[watch_crons.sh]"]
  node_webhook_dispatch["Webhook dispatcher<br/>cron dispatch script"]
  node_webhook_cron["Webhook cron runner<br/>cron daemon<br/>[webhook_crond.sh]"]
end

node_client_entry -->|"boots"| node_app_routes
node_app_routes -->|"uses session"| node_auth_state
node_app_routes -->|"guards access"| node_route_guard
node_app_routes -->|"serves"| node_report_wizard
node_app_routes -->|"serves"| node_case_browse
node_app_routes -->|"serves"| node_case_detail
node_app_routes -->|"serves"| node_role_dashboards
node_role_dashboards -->|"includes"| node_police_dashboard
node_auth_state -->|"authenticates via"| node_auth_api
node_report_wizard -->|"creates cases"| node_case_api
node_case_browse -->|"queries cases"| node_case_api
node_case_detail -->|"reads cases"| node_case_api
node_police_dashboard -->|"uses matches"| node_matching
node_app_routes -->|"messages via"| node_messaging_api
node_app_routes -->|"admin actions"| node_admin_api
node_supabase_client -->|"connects to"| node_supabase
node_api_server -->|"enforces"| node_authorization
node_api_server -->|"mounts"| node_auth_api
node_api_server -->|"mounts"| node_case_api
node_api_server -->|"mounts"| node_matching
node_api_server -->|"mounts"| node_messaging_api
node_api_server -->|"mounts"| node_admin_api
node_case_api -->|"authorizes with"| node_authorization
node_case_api -->|"uses"| node_data_models
node_matching -->|"uses"| node_data_models
node_messaging_api -->|"uses"| node_data_models
node_admin_api -->|"uses"| node_data_models
node_data_models -->|"persists to"| node_supabase
node_storage_schema -->|"provisions"| node_supabase
node_cron_monitor -->|"triggers"| node_webhook_dispatch
node_webhook_cron -->|"runs"| node_webhook_dispatch

click node_client_entry "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/index.js"
click node_app_routes "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/App.js"
click node_auth_state "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/lib/auth.jsx"
click node_route_guard "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/components/ProtectedRoute.jsx"
click node_report_wizard "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/components/ReportWizard.jsx"
click node_case_browse "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/Browse.jsx"
click node_case_detail "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/CaseDetail.jsx"
click node_role_dashboards "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/Apply.jsx"
click node_police_dashboard "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/PoliceDashboard.jsx"
click node_supabase_client "https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/lib/supabase.js"
click node_api_server "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/server.py"
click node_authorization "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/deps.py"
click node_auth_api "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/auth.py"
click node_case_api "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/cases.py"
click node_matching "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/matching.py"
click node_messaging_api "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/messaging.py"
click node_admin_api "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/admin.py"
click node_data_models "https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/models.py"
click node_supabase "https://github.com/rohit1817-45/lost_found_universal/blob/main/supabase/migrations/00_schema.sql"
click node_storage_schema "https://github.com/rohit1817-45/lost_found_universal/blob/main/supabase/migrations/01_storage.sql"
click node_deployment "https://github.com/rohit1817-45/lost_found_universal/blob/main/DEPLOY.md"
click node_cron_monitor "https://github.com/rohit1817-45/lost_found_universal/blob/main/.emergent/cron/watch_crons.sh"
click node_webhook_dispatch "https://github.com/rohit1817-45/lost_found_universal/blob/main/.emergent/cron/dispatch_webhook.sh"
click node_webhook_cron "https://github.com/rohit1817-45/lost_found_universal/blob/main/.emergent/cron/webhook_crond.sh"

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_client_entry,node_app_routes,node_auth_state,node_route_guard,node_report_wizard,node_case_browse,node_case_detail,node_role_dashboards,node_police_dashboard,node_supabase_client toneBlue
class node_api_server,node_authorization,node_auth_api,node_case_api,node_matching,node_messaging_api,node_admin_api,node_data_models toneAmber
class node_supabase,node_storage_schema toneMint
class node_deployment,node_cron_monitor,node_webhook_dispatch,node_webhook_cron toneRose
```

## Components

### React client

Role-specific reporting and case experiences.

- [Client entry](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/index.js): React bootstrap · `frontend/src/index.js`
- [App routes](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/App.js): React app shell · `frontend/src/App.js`
- [Auth session](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/lib/auth.jsx): auth state · `frontend/src/lib/auth.jsx`
- [Protected routes](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/components/ProtectedRoute.jsx): route guard · `frontend/src/components/ProtectedRoute.jsx`
- [Report wizard](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/components/ReportWizard.jsx): case reporting UI · `frontend/src/components/ReportWizard.jsx`
- [Case browsing](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/Browse.jsx): browse page · `frontend/src/pages/Browse.jsx`
- [Case detail](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/CaseDetail.jsx): case detail page · `frontend/src/pages/CaseDetail.jsx`
- [Role experiences](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/Apply.jsx): application pages · Application and police dashboard flows. · `frontend/src/pages/Apply.jsx`
- [Police dashboard](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/pages/PoliceDashboard.jsx): investigation dashboard · `frontend/src/pages/PoliceDashboard.jsx`
- [Supabase client](https://github.com/rohit1817-45/lost_found_universal/blob/main/frontend/src/lib/supabase.js): data client · `frontend/src/lib/supabase.js`

### Backend API

Domain APIs and authorization boundary.

- [API server](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/server.py): backend entrypoint · `backend/server.py`
- [Request authorization](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/deps.py): shared dependencies · `backend/deps.py`
- [Authentication API](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/auth.py): auth service · `backend/auth.py`
- [Case operations](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/cases.py): case API · Case CRUD and investigation operations. · `backend/cases.py`
- [Matching engine](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/matching.py): matching service · Matching is isolated from case CRUD. · `backend/matching.py`
- [Messaging API](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/messaging.py): messaging service · `backend/messaging.py`
- [Administration API](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/admin.py): admin service · `backend/admin.py`
- [Data models](https://github.com/rohit1817-45/lost_found_universal/blob/main/backend/models.py): schemas and entities · `backend/models.py`

### Data platform

Managed persistence and storage.

- [Supabase platform](https://github.com/rohit1817-45/lost_found_universal/blob/main/supabase/migrations/00_schema.sql): managed data and storage · Primary database and storage boundary. · `supabase/migrations/00_schema.sql`
- [Storage setup](https://github.com/rohit1817-45/lost_found_universal/blob/main/supabase/migrations/01_storage.sql): storage migration · `supabase/migrations/01_storage.sql`

### Operations

Deployment and scheduled webhook automation.

- [Deployment guidance](https://github.com/rohit1817-45/lost_found_universal/blob/main/DEPLOY.md): operations documentation · `DEPLOY.md`
- [Cron monitor](https://github.com/rohit1817-45/lost_found_universal/blob/main/.emergent/cron/watch_crons.sh): scheduled work monitor · `.emergent/cron/watch_crons.sh`
- [Webhook dispatcher](https://github.com/rohit1817-45/lost_found_universal/blob/main/.emergent/cron/dispatch_webhook.sh): cron dispatch script · `.emergent/cron/dispatch_webhook.sh`
- [Webhook cron runner](https://github.com/rohit1817-45/lost_found_universal/blob/main/.emergent/cron/webhook_crond.sh): cron daemon · `.emergent/cron/webhook_crond.sh`

## Connections

- Client entry → App routes: boots
- App routes → Auth session: uses session
- App routes → Protected routes: guards access
- App routes → Report wizard: serves
- App routes → Case browsing: serves
- App routes → Case detail: serves
- App routes → Role experiences: serves
- Role experiences → Police dashboard: includes
- Auth session → Authentication API: authenticates via
- Report wizard → Case operations: creates cases
- Case browsing → Case operations: queries cases
- Case detail → Case operations: reads cases
- Police dashboard → Matching engine: uses matches
- App routes → Messaging API: messages via
- App routes → Administration API: admin actions
- Supabase client → Supabase platform: connects to
- API server → Request authorization: enforces
- API server → Authentication API: mounts
- API server → Case operations: mounts
- API server → Matching engine: mounts
- API server → Messaging API: mounts
- API server → Administration API: mounts
- Case operations → Request authorization: authorizes with
- Case operations → Data models: uses
- Matching engine → Data models: uses
- Messaging API → Data models: uses
- Administration API → Data models: uses
- Data models → Supabase platform: persists to
- Storage setup → Supabase platform: provisions
- Cron monitor → Webhook dispatcher: triggers
- Webhook cron runner → Webhook dispatcher: runs
