# suyogshelke/civi-go architecture

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

- Interactive diagram: https://gitdiagram.com/suyogshelke/civi-go
- Repository: https://github.com/suyogshelke/civi-go

## Overview

CiviGo is a civic-issue reporting and resolution platform: citizens submit complaints and track their progress, while officers handle assigned work and administrators oversee operations and analytics. The frontend routes users into role-specific portals and provides authentication; its API layer supports a Django backend and a mock implementation. The README documents feedback, email verification, and analytics as product capabilities. Sampled source confirms authentication and mock complaint behavior; backend view-to-model wiring and most page-to-API calls were not sampled, so those links are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/App.jsx) (Role-based routes), [`frontend/src/auth/ProtectedRoute.jsx`](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/ProtectedRoute.jsx) (Role access guard), [`frontend/src/api/client.js`](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/client.js) (HTTP client), [`frontend/src/auth/AuthContext.jsx`](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/AuthContext.jsx) (Authentication context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["User portals"]
  node_app["Role-based routes<br/>[App.jsx]"]
  node_citizen_pages["Citizen portal"]
  node_officer_pages["Officer portal"]
  node_admin_pages["Admin portal"]
  node_public_pages["Public access"]
end

subgraph group_frontend_services["Frontend services"]
  node_auth_context["Authentication context<br/>[AuthContext.jsx]"]
  node_protected_route["Role access guard<br/>[ProtectedRoute.jsx]"]
  node_session["Session storage<br/>[session.js]"]
  node_api_facade["API facade<br/>[index.js]"]
  node_api_client["HTTP client<br/>[client.js]"]
  node_complaint_api["Complaint API<br/>[complaints.js]"]
  node_feedback_api["Feedback API<br/>[feedback.js]"]
  node_analytics_api["Analytics API<br/>[analytics.js]"]
  node_mock_service["Mock operations<br/>[service.js]"]
  node_mock_db[("Mock data store<br/>[db.js]")]
end

subgraph group_backend["Backend services"]
  node_django["Django REST API"]
  node_api_urls["API routes<br/>[urls.py]"]
  node_api_views["API handlers<br/>[views.py]"]
  node_api_models[("Domain models<br/>[models.py]")]
  node_firebase_auth["Firebase token verification<br/>[authentication.py]"]
end

node_citizen(("Citizen"))
node_officer(("Officer"))
node_admin(("Administrator"))
node_firebase{{"Firebase Authentication"}}

node_citizen -->|"uses"| node_app
node_officer -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"routes"| node_public_pages
node_app -->|"guards"| node_protected_route
node_protected_route -->|"permits role"| node_citizen_pages
node_protected_route -->|"permits role"| node_officer_pages
node_protected_route -->|"permits role"| node_admin_pages
node_auth_context -->|"calls"| node_api_facade
node_auth_context -->|"updates session"| node_session
node_auth_context -->|"authenticates"| node_firebase
node_api_client -.->|"gets ID token"| node_firebase
node_complaint_api -->|"uses client"| node_api_client
node_feedback_api -->|"uses client"| node_api_client
node_analytics_api -->|"uses client"| node_api_client
node_mock_service -.->|"reads and writes"| node_mock_db
node_django -->|"routes through"| node_api_urls
node_api_views -->|"authenticates requests"| node_firebase_auth
node_firebase_auth -->|"verifies tokens"| node_firebase
node_firebase_auth -->|"looks up user"| node_api_models

click node_app "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/App.jsx"
click node_citizen_pages "https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/citizen"
click node_officer_pages "https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/officer"
click node_admin_pages "https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/admin"
click node_public_pages "https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/public"
click node_auth_context "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/AuthContext.jsx"
click node_protected_route "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/ProtectedRoute.jsx"
click node_session "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/session.js"
click node_api_facade "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/index.js"
click node_api_client "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/client.js"
click node_complaint_api "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/complaints.js"
click node_feedback_api "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/feedback.js"
click node_analytics_api "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/analytics.js"
click node_mock_service "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/mock/service.js"
click node_mock_db "https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/mock/db.js"
click node_django "https://github.com/suyogshelke/civi-go/tree/main/backend/api"
click node_api_urls "https://github.com/suyogshelke/civi-go/blob/main/backend/api/urls.py"
click node_api_views "https://github.com/suyogshelke/civi-go/blob/main/backend/api/views.py"
click node_api_models "https://github.com/suyogshelke/civi-go/blob/main/backend/api/models.py"
click node_firebase_auth "https://github.com/suyogshelke/civi-go/blob/main/backend/api/authentication.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_citizen_pages,node_officer_pages,node_admin_pages,node_public_pages toneBlue
class node_auth_context,node_protected_route,node_session,node_api_facade,node_api_client,node_complaint_api,node_feedback_api,node_analytics_api,node_mock_service,node_mock_db toneAmber
class node_django,node_api_urls,node_api_views,node_api_models,node_firebase_auth toneMint
class node_citizen,node_officer,node_admin,node_firebase toneIndigo
```

## Components

### User portals

- [Role-based routes](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Citizen portal](https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/citizen): `frontend/src/pages/citizen`
- [Officer portal](https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/officer): `frontend/src/pages/officer`
- [Admin portal](https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Public access](https://github.com/suyogshelke/civi-go/tree/main/frontend/src/pages/public): `frontend/src/pages/public`

### Frontend services

- [Authentication context](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/AuthContext.jsx): `frontend/src/auth/AuthContext.jsx`
- [Role access guard](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/ProtectedRoute.jsx): `frontend/src/auth/ProtectedRoute.jsx`
- [Session storage](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/auth/session.js): `frontend/src/auth/session.js`
- [API facade](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/index.js): `frontend/src/api/index.js`
- [HTTP client](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [Complaint API](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/complaints.js): `frontend/src/api/complaints.js`
- [Feedback API](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/feedback.js): `frontend/src/api/feedback.js`
- [Analytics API](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/analytics.js): `frontend/src/api/analytics.js`
- [Mock operations](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/mock/service.js): `frontend/src/api/mock/service.js`
- [Mock data store](https://github.com/suyogshelke/civi-go/blob/main/frontend/src/api/mock/db.js): `frontend/src/api/mock/db.js`

### Backend services

- [Django REST API](https://github.com/suyogshelke/civi-go/tree/main/backend/api): `backend/api`
- [API routes](https://github.com/suyogshelke/civi-go/blob/main/backend/api/urls.py): `backend/api/urls.py`
- [API handlers](https://github.com/suyogshelke/civi-go/blob/main/backend/api/views.py): `backend/api/views.py`
- [Domain models](https://github.com/suyogshelke/civi-go/blob/main/backend/api/models.py): `backend/api/models.py`
- [Firebase token verification](https://github.com/suyogshelke/civi-go/blob/main/backend/api/authentication.py): `backend/api/authentication.py`

### Other components

- **Citizen**
- **Officer**
- **Administrator**
- **Firebase Authentication**

## Connections

- Citizen → Role-based routes: uses
- Officer → Role-based routes: uses
- Administrator → Role-based routes: uses
- Role-based routes → Public access: routes
- Role-based routes → Role access guard: guards
- Role access guard → Citizen portal: permits role
- Role access guard → Officer portal: permits role
- Role access guard → Admin portal: permits role
- Authentication context → API facade: calls
- Authentication context → Session storage: updates session
- Authentication context → Firebase Authentication: authenticates
- HTTP client → Firebase Authentication: gets ID token
- Complaint API → HTTP client: uses client
- Feedback API → HTTP client: uses client
- Analytics API → HTTP client: uses client
- Mock operations → Mock data store: reads and writes
- Django REST API → API routes: routes through
- API handlers → Firebase token verification: authenticates requests
- Firebase token verification → Firebase Authentication: verifies tokens
- Firebase token verification → Domain models: looks up user
