# faith-jebet/justicore architecture

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

- Interactive diagram: https://gitdiagram.com/faith-jebet/justicore
- Repository: https://github.com/faith-jebet/justicore

## Overview

Justicore is a worker-protection reporting platform: workers submit incident reports through a web form or a USSD menu, and case officers can view submitted reports in a dashboard. The backend also provides a rights-information response through USSD; case-status lookup is explicitly unfinished. The sampled login only simulates authentication, and dashboard action buttons do not implement case-management operations. The tree and excerpts do not establish a working case-assignment, corporate-response, or notification workflow.

Main entry points: [`frontend/src/App.jsx`](https://github.com/faith-jebet/justicore/blob/main/frontend/src/App.jsx) (App router), [`backend/main.py`](https://github.com/faith-jebet/justicore/blob/main/backend/main.py) (API and USSD routes), [`backend/database.py`](https://github.com/faith-jebet/justicore/blob/main/backend/database.py) (Database sessions), [`backend/models.py`](https://github.com/faith-jebet/justicore/blob/main/backend/models.py) (ORM models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["App router<br/>[App.jsx]"]
  node_report_form["Incident form<br/>[ReportForm.jsx]"]
  node_login["Simulated login<br/>[Login.jsx]"]
  node_dashboard["Reports dashboard<br/>[Dashboard.jsx]"]
end

subgraph group_api["Reporting API"]
  node_api_routes["API and USSD routes<br/>[main.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_ussd_menu["USSD menu handling<br/>[main.py]"]
  node_report_logic["Report handling<br/>[main.py]"]
end

subgraph group_data["Report data"]
  node_orm_models["ORM models<br/>[models.py]"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_report_store[("SQLite database<br/>[database.py]")]
end

node_worker(("Worker"))
node_officer(("Case officer"))
node_ussd_gateway{{"USSD gateway"}}

node_worker -->|"opens"| node_app
node_officer -->|"opens"| node_app
node_ussd_gateway -->|"posts menu input"| node_ussd_menu
node_app -->|"routes to"| node_report_form
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_login -->|"navigates to dashboard"| node_app
node_report_form -->|"posts report"| node_api_routes
node_dashboard -->|"fetches reports"| node_api_routes
node_api_routes -->|"validates and shapes"| node_schemas
node_api_routes -->|"dispatches report routes"| node_report_logic
node_api_routes -->|"dispatches USSD route"| node_ussd_menu
node_report_logic -->|"uses session"| node_db_session
node_ussd_menu -->|"uses session"| node_db_session
node_report_logic -->|"creates and queries"| node_orm_models
node_ussd_menu -->|"creates report"| node_orm_models
node_orm_models -->|"uses declarative base"| node_db_session
node_db_session -->|"connects to SQLite"| node_report_store

click node_app "https://github.com/faith-jebet/justicore/blob/main/frontend/src/App.jsx"
click node_report_form "https://github.com/faith-jebet/justicore/blob/main/frontend/src/components/ReportForm.jsx"
click node_login "https://github.com/faith-jebet/justicore/blob/main/frontend/src/components/Login.jsx"
click node_dashboard "https://github.com/faith-jebet/justicore/blob/main/frontend/src/components/Dashboard.jsx"
click node_api_routes "https://github.com/faith-jebet/justicore/blob/main/backend/main.py"
click node_schemas "https://github.com/faith-jebet/justicore/blob/main/backend/schemas.py"
click node_ussd_menu "https://github.com/faith-jebet/justicore/blob/main/backend/main.py"
click node_report_logic "https://github.com/faith-jebet/justicore/blob/main/backend/main.py"
click node_orm_models "https://github.com/faith-jebet/justicore/blob/main/backend/models.py"
click node_db_session "https://github.com/faith-jebet/justicore/blob/main/backend/database.py"
click node_report_store "https://github.com/faith-jebet/justicore/blob/main/backend/database.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_app,node_report_form,node_login,node_dashboard toneBlue
class node_api_routes,node_schemas,node_ussd_menu,node_report_logic toneAmber
class node_orm_models,node_db_session,node_report_store toneMint
class node_worker toneRose
class node_officer,node_ussd_gateway toneIndigo
```

## Components

### Web experience

- [App router](https://github.com/faith-jebet/justicore/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Incident form](https://github.com/faith-jebet/justicore/blob/main/frontend/src/components/ReportForm.jsx): `frontend/src/components/ReportForm.jsx`
- [Simulated login](https://github.com/faith-jebet/justicore/blob/main/frontend/src/components/Login.jsx): `frontend/src/components/Login.jsx`
- [Reports dashboard](https://github.com/faith-jebet/justicore/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`

### Reporting API

- [API and USSD routes](https://github.com/faith-jebet/justicore/blob/main/backend/main.py): `backend/main.py`
- [Request schemas](https://github.com/faith-jebet/justicore/blob/main/backend/schemas.py): `backend/schemas.py`
- [USSD menu handling](https://github.com/faith-jebet/justicore/blob/main/backend/main.py): `backend/main.py`
- [Report handling](https://github.com/faith-jebet/justicore/blob/main/backend/main.py): `backend/main.py`

### Report data

- [ORM models](https://github.com/faith-jebet/justicore/blob/main/backend/models.py): `backend/models.py`
- [Database sessions](https://github.com/faith-jebet/justicore/blob/main/backend/database.py): `backend/database.py`
- [SQLite database](https://github.com/faith-jebet/justicore/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Worker**
- **Case officer**
- **USSD gateway**

## Connections

- Worker → App router: opens
- Case officer → App router: opens
- USSD gateway → USSD menu handling: posts menu input
- App router → Incident form: routes to
- App router → Simulated login: routes to
- App router → Reports dashboard: routes to
- Simulated login → App router: navigates to dashboard
- Incident form → API and USSD routes: posts report
- Reports dashboard → API and USSD routes: fetches reports
- API and USSD routes → Request schemas: validates and shapes
- API and USSD routes → Report handling: dispatches report routes
- API and USSD routes → USSD menu handling: dispatches USSD route
- Report handling → Database sessions: uses session
- USSD menu handling → Database sessions: uses session
- Report handling → ORM models: creates and queries
- USSD menu handling → ORM models: creates report
- ORM models → Database sessions: uses declarative base
- Database sessions → SQLite database: connects to SQLite
