ΰ€ΰ€¨ΰ€€ΰ€Ύ ΰ€ΰ₯ ΰ€ΰ€΅ΰ€Ύΰ€ΰ€Ό, ΰ€¨ΰ₯ΰ€€ΰ€Ύ ΰ€ΰ₯ ΰ€¦ΰ€Ώΰ€Άΰ€Ύ β Voice of the People, Direction for Leaders
An AI-powered Smart Civic Governance Platform built with React + Vite (frontend) and FastAPI + MongoDB (backend). Citizens can report civic issues like potholes, officers resolve them, and AI verifies repairs β all tracked with real-time trust scores.
- Submit complaints with image upload + text description
- AI-powered pothole detection from road images
- NLP sentiment & urgency analysis of complaint text
- Real-time complaint tracking with timeline
- Community validation of completed repairs
- View assigned complaints
- Upload after-repair proof images
- AI-powered repair verification (before/after comparison)
- Performance stats & resolution tracking
- Real-time stats: Total Issues, Resolved, Pending, Pothole Alerts
- Public Trust Index with 4 key metrics (Resolution Speed, Citizen Sentiment, Verified Proof, Communication)
- AI Priority Inbox β issues ranked by urgency Γ public impact
- Proof of Work gallery β verified completions
- Quick Insights β Critical Alerts, Misinformation, Trending issues
- Heatmaps β Geographic complaint clustering with KMeans
- Fraud Detection β Duplicate images, suspicious timing, unresolved damage checks
- Officer Performance β Rankings, resolution time, citizen ratings
- Trust Score Analytics β Area-wise and city-wide trust computation
- Digital Twin β City simulation with what-if scenario modeling
- Predictions β Complaint volume forecasting with linear regression
- JWT-based authentication with bcrypt password hashing
- Role-Based Access Control (RBAC):
- Admin β Full access to all governance endpoints
- Department/Officer β Proof upload, assignment views
- Public/Citizen β Complaint submission, feedback
- Frontend route protection with role checks
JanVaani/
βββ backend/ # FastAPI Backend
β βββ main.py # App entry point + all API routes
β βββ db.py # Shared MongoDB handle
β βββ register_routers.py # Governance router registration
β βββ routes/
β β βββ rbac.py # RBAC dependency helpers
β β βββ workflow.py # Complaint lifecycle endpoints
β β βββ fraud.py # Fraud detection APIs
β β βββ trust.py # Trust score APIs
β β βββ officer_analytics.py # Officer performance APIs
β β βββ geo.py # Heatmap & clustering APIs
β β βββ digital_twin.py # City simulation APIs
β β βββ prediction.py # Forecasting APIs
β β βββ verification.py # Work verification APIs
β βββ services/
β β βββ trust_service.py # Trust computation logic
β β βββ officer_service.py # Officer metrics from complaints
β β βββ fraud_service.py # Fraud checks
β β βββ prediction_service.py # Linear regression forecasting
β β βββ digital_twin_service.py # Simulation engine
β β βββ geo_service.py # Geographic analytics
β βββ requirements.txt
βββ src/ # React Frontend
β βββ App.jsx # Routes + RBAC protection
β βββ pages/
β β βββ CitizenPortal.jsx # Complaint submission
β β βββ Dashboard.jsx # Admin dashboard
β β βββ GovernanceDashboard.jsx # AI governance suite
β βββ components/dashboard/
β βββ StatsCards.jsx # Real-time stats
β βββ TrustIndex.jsx # Trust score visualization
β βββ PriorityInbox.jsx # AI-ranked issue queue
β βββ ProofOfWork.jsx # Verified completions
βββ datasets/ # Analytics datasets
β βββ 311_small.csv # NYC 311 complaint data
βββ data/India/ # Road damage detection images
βββ package.json
βββ vite.config.js
- Python 3.10+ with pip
- Node.js 18+ with npm
- MongoDB β running locally or on Atlas (default:
mongodb://localhost:27017)
git clone https://github.com/sshekhar563/JanVaani.git
cd JanVaani# Create and activate virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
# Install dependencies
pip install -r backend/requirements.txtnpm installCreate a .env file inside backend/ (optional β defaults are provided):
MONGODB_URL=mongodb://localhost:27017
SECRET_KEY=janvaani_production_super_secret_key_999
FRONTEND_URLS=http://localhost:5173,http://localhost:3000npm run devThis starts both servers concurrently:
- Frontend β
http://localhost:5173 - Backend API β
http://localhost:8000
- Go to
http://localhost:5173/admin/signup - Enter your details
- Use access key:
JANVAANI_ADMIN_2024 - Login at
http://localhost:5173/admin/login
- Go to
http://localhost:5173/signup - Register with email and password
- Login at
http://localhost:5173/login
We provide a multi-stage Dockerfile that builds the Vite frontend and the Python backend in one container.
docker build -t janvaani:latest .
docker run -p 8000:8000 --env-file backend/.env janvaani:latestThe application will be served at http://localhost:8000.
python backend/test_e2e.pyCitizen uploads pothole image
β AI detects pothole (YOLOv8-based detection)
β NLP analyzes complaint text (sentiment + urgency)
β Complaint created in MongoDB
β Appears in Admin Priority Inbox
β Admin assigns officer
β Officer fixes issue & uploads proof image
β AI verifies repair (before/after comparison)
β Citizen gives feedback (1-5 rating)
β Trust score auto-recalculated
β Officer performance auto-updated
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/signup |
Register new user |
| POST | /api/auth/login |
Login (returns JWT) |
| GET | /api/workflow/stats |
Dashboard statistics |
| GET | /api/workflow/completed-works |
Verified completions |
| GET | /api/trust/city |
City-wide trust score |
| Method | Endpoint | Role | Description |
|---|---|---|---|
| POST | /api/complaints |
Any | Create complaint |
| GET | /api/complaints |
Any | List complaints |
| POST | /api/detect-pothole |
Any | AI pothole detection |
| POST | /api/analyze |
Any | NLP text analysis |
| POST | /api/workflow/feedback/{id} |
Any | Submit citizen feedback |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/workflow/assign |
Assign complaint to officer |
| GET | /api/workflow/officers |
List all officers |
| GET | /api/fraud/reports |
View fraud reports |
| GET | /api/predict/complaints |
Complaint forecasts |
| GET | /api/geo/heatmap |
Geographic heatmap data |
| GET | /api/officer/ranking |
Officer performance ranking |
| GET | /api/digital-twin/state |
Digital twin city state |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/workflow/my-assignments |
View assigned cases |
| POST | /api/workflow/upload-proof/{id} |
Upload repair proof |
| POST | /api/workflow/verify-repair/{id} |
AI verification |
| Dataset | Size | Purpose |
|---|---|---|
datasets/311_small.csv |
~16 MB | Complaint volume prediction & digital twin |
News_Dataset/Fake.csv + True.csv |
~50 MB | Misinformation/fraud detection |
twcs/twcs.csv |
~45 MB | Customer service sentiment training |
data/India/ images |
~200 MB | Road damage detection (7706 annotations) |
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite 7, Framer Motion, Lucide Icons, Chart.js |
| Backend | FastAPI, Uvicorn, Motor (async MongoDB) |
| Database | MongoDB |
| AI/ML | OpenCV (pothole detection), HuggingFace Transformers (NLP), Whisper (voice) |
| Auth | JWT + bcrypt + RBAC |
| Styling | Tailwind CSS + custom glassmorphism theme |
This project is built for academic and civic governance research purposes.
Built with β€οΈ for Smart Governance