# kajjayamadithya/crime-report-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/kajjayamadithya/crime-report-management-system
- Repository: https://github.com/kajjayamadithya/crime-report-management-system

## Overview

CRMS supports citizen registration and FIR filing, police investigation and case updates, and administrator oversight, provisioning, and analytics. The main workflow runs from role-based web portals through authenticated API routes to controllers and MongoDB-backed records; evidence uploads and status changes can generate notifications and SMS alerts. The graph preserves the documented dashboard, profile, tracking, and analytics capabilities. Relationships are limited to README statements and source-index references or shown calls; unsampled subsystems are represented only where documented.

Main entry points: [`server/server.js`](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/server.js) (API server), [`client/src/App.jsx`](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/App.jsx) (Role-based web app), [`client/src/api/axiosInstance.js`](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/api/axiosInstance.js) (Authenticated API client), [`server/controllers/firController.js`](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/firController.js) (FIR lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web portals"]
  node_webapp["Role-based web app<br/>[App.jsx]"]
  node_authui["Auth and profile<br/>[AuthContext.jsx]"]
  node_firform["FIR filing<br/>[FileFIR.jsx]"]
  node_citizendash["Citizen tracking"]
  node_policedash["Police operations"]
  node_admindash["Admin intelligence<br/>[AdminDashboard.jsx]"]
end

subgraph group_api["API and access"]
  node_http["Authenticated API client<br/>[axiosInstance.js]"]
  node_server["API server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_firroutes["FIR routes<br/>[firRoutes.js]"]
  node_dashroutes["Dashboard routes<br/>[dashboardRoutes.js]"]
  node_userroutes["User routes<br/>[userRoutes.js]"]
  node_notifroutes["Notification routes"]
  node_adminroutes["Admin routes<br/>[adminRoutes.js]"]
end

subgraph group_cases["Case management"]
  node_fir["FIR lifecycle<br/>[firController.js]"]
  node_analytics["Dashboards and analytics"]
  node_notifications["Notification handling"]
end

subgraph group_identity["Identity and administration"]
  node_auth["Authentication and registration<br/>[authController.js]"]
  node_users["User and officer management<br/>[userController.js]"]
  node_admin["Officer provisioning<br/>[adminController.js]"]
end

subgraph group_state["Persistent state and alerts"]
  node_firdata[("FIR records<br/>[FIR.js]")]
  node_userdata[("User records<br/>[User.js]")]
  node_evidencedata[("Evidence files<br/>[FileUpload.js]")]
  node_notifdata[("Notification records<br/>[Notification.js]")]
end

node_citizens(("Citizens"))
node_officers(("Police officers"))
node_administrators(("Administrators"))
node_mongo[("MongoDB")]
node_twilio["Twilio SMS"]

node_citizens -->|"use portal"| node_webapp
node_officers -->|"use portal"| node_webapp
node_administrators -->|"use portal"| node_webapp
node_webapp -->|"uses auth"| node_authui
node_webapp -->|"routes to"| node_firform
node_webapp -->|"routes to"| node_citizendash
node_webapp -->|"routes to"| node_policedash
node_webapp -->|"routes to"| node_admindash
node_authui -->|"calls API"| node_http
node_firform -->|"calls API"| node_http
node_citizendash -->|"calls API"| node_http
node_policedash -->|"calls API"| node_http
node_admindash -->|"calls API"| node_http
node_http -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_firroutes
node_server -->|"mounts routes"| node_dashroutes
node_server -->|"mounts routes"| node_userroutes
node_server -->|"mounts routes"| node_notifroutes
node_server -->|"mounts routes"| node_adminroutes
node_authroutes -->|"dispatches"| node_auth
node_firroutes -->|"dispatches"| node_fir
node_dashroutes -->|"dispatches"| node_analytics
node_userroutes -->|"dispatches"| node_users
node_notifroutes -->|"dispatches"| node_notifications
node_adminroutes -->|"dispatches"| node_admin
node_auth -->|"reads and writes"| node_userdata
node_auth -->|"writes"| node_notifdata
node_users -->|"reads and writes"| node_userdata
node_users -->|"reads"| node_firdata
node_users -->|"writes"| node_notifdata
node_admin -->|"manages"| node_userdata
node_fir -->|"reads and writes"| node_firdata
node_fir -->|"links evidence"| node_evidencedata
node_fir -->|"creates alerts"| node_notifdata
node_fir -->|"sends SMS"| node_twilio
node_analytics -->|"queries cases"| node_firdata
node_analytics -->|"queries users"| node_userdata
node_analytics -->|"queries activity"| node_notifdata
node_notifications -->|"reads and updates"| node_notifdata
node_server -->|"connects database"| node_mongo

click node_webapp "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/App.jsx"
click node_authui "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/context/AuthContext.jsx"
click node_firform "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/FileFIR.jsx"
click node_citizendash "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/CitizenDashboard.jsx"
click node_policedash "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/PoliceDashboard.jsx"
click node_admindash "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/AdminDashboard.jsx"
click node_http "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/api/axiosInstance.js"
click node_server "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/server.js"
click node_authroutes "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/authRoutes.js"
click node_firroutes "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/firRoutes.js"
click node_dashroutes "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/dashboardRoutes.js"
click node_userroutes "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/userRoutes.js"
click node_notifroutes "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/notificationRoutes.js"
click node_adminroutes "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/adminRoutes.js"
click node_auth "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/authController.js"
click node_users "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/userController.js"
click node_admin "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/adminController.js"
click node_fir "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/firController.js"
click node_analytics "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/dashboardController.js"
click node_notifications "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/notificationController.js"
click node_firdata "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/FIR.js"
click node_userdata "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/User.js"
click node_evidencedata "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/FileUpload.js"
click node_notifdata "https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/Notification.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_webapp,node_authui,node_firform,node_citizendash,node_policedash,node_admindash toneBlue
class node_http,node_server,node_authroutes,node_firroutes,node_dashroutes,node_userroutes,node_notifroutes,node_adminroutes,node_mongo toneAmber
class node_fir,node_analytics,node_notifications toneMint
class node_auth,node_users,node_admin toneRose
class node_firdata,node_userdata,node_evidencedata,node_notifdata,node_citizens,node_officers,node_administrators,node_twilio toneIndigo
```

## Components

### Web portals

- [Role-based web app](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth and profile](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [FIR filing](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/FileFIR.jsx): `client/src/pages/FileFIR.jsx`
- [Citizen tracking](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/CitizenDashboard.jsx): `client/src/pages/CitizenDashboard.jsx`
- [Police operations](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/PoliceDashboard.jsx): `client/src/pages/PoliceDashboard.jsx`
- [Admin intelligence](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/pages/AdminDashboard.jsx): `client/src/pages/AdminDashboard.jsx`

### API and access

- [Authenticated API client](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/client/src/api/axiosInstance.js): `client/src/api/axiosInstance.js`
- [API server](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/server.js): `server/server.js`
- [Auth routes](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [FIR routes](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/firRoutes.js): `server/routes/firRoutes.js`
- [Dashboard routes](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/dashboardRoutes.js): `server/routes/dashboardRoutes.js`
- [User routes](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/userRoutes.js): `server/routes/userRoutes.js`
- [Notification routes](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/notificationRoutes.js): `server/routes/notificationRoutes.js`
- [Admin routes](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/routes/adminRoutes.js): `server/routes/adminRoutes.js`

### Case management

- [FIR lifecycle](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/firController.js): `server/controllers/firController.js`
- [Dashboards and analytics](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/dashboardController.js): `server/controllers/dashboardController.js`
- [Notification handling](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/notificationController.js): `server/controllers/notificationController.js`

### Identity and administration

- [Authentication and registration](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [User and officer management](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/userController.js): `server/controllers/userController.js`
- [Officer provisioning](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/controllers/adminController.js): `server/controllers/adminController.js`

### Persistent state and alerts

- [FIR records](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/FIR.js): `server/models/FIR.js`
- [User records](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/User.js): `server/models/User.js`
- [Evidence files](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/FileUpload.js): `server/models/FileUpload.js`
- [Notification records](https://github.com/kajjayamadithya/crime-report-management-system/blob/main/server/models/Notification.js): `server/models/Notification.js`

### Other components

- **Citizens**
- **Police officers**
- **Administrators**
- **MongoDB**
- **Twilio SMS**

## Connections

- Citizens → Role-based web app: use portal
- Police officers → Role-based web app: use portal
- Administrators → Role-based web app: use portal
- Role-based web app → Auth and profile: uses auth (evidence: `client/src/App.jsx`)
- Role-based web app → FIR filing: routes to (evidence: `client/src/App.jsx`)
- Role-based web app → Citizen tracking: routes to (evidence: `client/src/App.jsx`)
- Role-based web app → Police operations: routes to (evidence: `client/src/App.jsx`)
- Role-based web app → Admin intelligence: routes to (evidence: `client/src/App.jsx`)
- Auth and profile → Authenticated API client: calls API (evidence: `client/src/context/AuthContext.jsx`)
- FIR filing → Authenticated API client: calls API (evidence: `client/src/pages/FileFIR.jsx`)
- Citizen tracking → Authenticated API client: calls API (evidence: `client/src/pages/CitizenDashboard.jsx`)
- Police operations → Authenticated API client: calls API (evidence: `client/src/pages/PoliceDashboard.jsx`)
- Admin intelligence → Authenticated API client: calls API (evidence: `client/src/pages/AdminDashboard.jsx`)
- Authenticated API client → API server: sends requests (evidence: `client/src/api/axiosInstance.js`)
- API server → Auth routes: mounts routes (evidence: `server/server.js`)
- API server → FIR routes: mounts routes (evidence: `server/server.js`)
- API server → Dashboard routes: mounts routes (evidence: `server/server.js`)
- API server → User routes: mounts routes (evidence: `server/server.js`)
- API server → Notification routes: mounts routes (evidence: `server/server.js`)
- API server → Admin routes: mounts routes (evidence: `server/server.js`)
- Auth routes → Authentication and registration: dispatches (evidence: `server/routes/authRoutes.js`)
- FIR routes → FIR lifecycle: dispatches (evidence: `server/routes/firRoutes.js`)
- Dashboard routes → Dashboards and analytics: dispatches (evidence: `server/routes/dashboardRoutes.js`)
- User routes → User and officer management: dispatches (evidence: `server/routes/userRoutes.js`)
- Notification routes → Notification handling: dispatches (evidence: `server/routes/notificationRoutes.js`)
- Admin routes → Officer provisioning: dispatches (evidence: `server/routes/adminRoutes.js`)
- Authentication and registration → User records: reads and writes (evidence: `server/controllers/authController.js`)
- Authentication and registration → Notification records: writes (evidence: `server/controllers/authController.js`)
- User and officer management → User records: reads and writes (evidence: `server/controllers/userController.js`)
- User and officer management → FIR records: reads (evidence: `server/controllers/userController.js`)
- User and officer management → Notification records: writes (evidence: `server/controllers/userController.js`)
- Officer provisioning → User records: manages (evidence: `server/controllers/adminController.js`)
- FIR lifecycle → FIR records: reads and writes (evidence: `server/controllers/firController.js`)
- FIR lifecycle → Evidence files: links evidence (evidence: `server/controllers/firController.js`)
- FIR lifecycle → Notification records: creates alerts (evidence: `server/controllers/firController.js`)
- FIR lifecycle → Twilio SMS: sends SMS (evidence: `server/controllers/firController.js`)
- Dashboards and analytics → FIR records: queries cases (evidence: `server/controllers/dashboardController.js`)
- Dashboards and analytics → User records: queries users (evidence: `server/controllers/dashboardController.js`)
- Dashboards and analytics → Notification records: queries activity (evidence: `server/controllers/dashboardController.js`)
- Notification handling → Notification records: reads and updates (evidence: `server/controllers/notificationController.js`)
- API server → MongoDB: connects database (evidence: `server/server.js`)
