AI-Powered Civic Engagement Platform
AI for Bharat Hackathon — AI for Communities Track
Live Demo · Architecture · Tech Stack · Setup
CivicAI is a fully serverless platform that enables citizens to report civic issues (potholes, garbage, broken streetlights, waterlogging) by simply uploading a photo. The system uses a custom-trained YOLOv8 computer vision model and Amazon Bedrock (Claude) to automatically:
- Detect the issue type with 90%+ accuracy
- Assess severity using rule-based logic
- Generate a formal complaint description using LLM
- Route it to the correct municipal department
- Notify administrators via email
Citizens authenticate via OTP (SMS) and can track their complaints in real-time.
Production URL: https://dpsfubu0rsyo3.cloudfront.net
Quick Login: Enter any name, any 10-digit phone number, and use OTP 123456 to log in.
| Feature | Description |
|---|---|
| Photo-Based Reporting | Upload a photo → AI detects potholes, garbage, broken lights, waterlogging |
| YOLOv8 Vision AI | Custom-trained model with robust issue detection + confidence scoring |
| LLM Descriptions | Amazon Bedrock (Claude) generates formal complaint text automatically |
| GPS Auto-Detect | Real-time location tagging with coordinates |
| OTP Authentication | Secure phone-based login via AWS SNS |
| User-Specific Tracking | Citizens only see their own submitted complaints |
| Smart Routing | Auto-assignment to PWD, Sanitation, Electrical, or Water departments |
| Mobile Responsive | Fully responsive design for desktop and mobile browsers |
┌─────────────────────────────────────────────────────────────────────┐
│ FRONTEND (React + Vite) │
│ Hosted on S3 + CloudFront CDN │
└──────────────────────────┬──────────────────────────────────────────┘
│ HTTPS
▼
┌──────────────────────────────────────────────────────────────────────┐
│ AWS API GATEWAY (REST) │
│ │
│ POST /auth/send-otp POST /upload/presign │
│ POST /auth/verify-otp POST /complaints │
│ GET /complaints GET /complaints/{id} │
└────┬──────────┬──────────┬──────────┬──────────┬────────────────────┘
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
┌──────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐
│ Auth │ │Upload │ │Submit │ │ Get │ │ Get │
│Lambda│ │Presign │ │Complnt │ │Complnts│ │Complnt │
└──┬───┘ └───┬────┘ └───┬────┘ └───┬────┘ └───┬────┘
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
┌──────┐ ┌──────┐ ┌────────────────────────────┐
│ SNS │ │ S3 │────▶│ DynamoDB (Complaints) │
│(SMS) │ │Bucket│ └────────────────────────────┘
└──────┘ └──┬───┘ ▲
│ S3 Event Trigger │
▼ │
┌───────────┐ │
│ Process │─────────────────┘
│ Image λ │
└─────┬─────┘
│
┌────────┴────────┐
▼ ▼
┌────────┐ ┌──────────┐
│ EC2 │ │ Bedrock │
│ YOLOv8 │ │ (Claude) │
└────────┘ └──────────┘
- Citizen uploads a photo via the React frontend
- Frontend requests a presigned S3 URL from the Upload Lambda
- Image is uploaded directly to S3 (bypasses Lambda payload limits)
- S3 ObjectCreated event triggers the Process Image Lambda
- Process Image Lambda calls YOLOv8 on EC2 for classification
- Severity is calculated, department is mapped, and Bedrock generates a description
- Result is saved to DynamoDB and admin is notified via SES
- Citizen finalizes with notes/GPS via the Submit Complaint Lambda
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite 7, React Router v7 |
| Styling | Vanilla CSS with custom design system |
| Compute | AWS Lambda (Python 3.12) |
| API | Amazon API Gateway (REST) |
| Hosting | Amazon S3 + CloudFront CDN |
| Database | Amazon DynamoDB |
| Storage | Amazon S3 (image storage) |
| Auth | AWS SNS / Amazon Pinpoint (SMS OTP) |
| AI/ML | YOLOv8 (custom-trained) on EC2 |
| LLM | Amazon Bedrock (Claude 3 Haiku) |
| Amazon SES |
civicai-frontend/
│
├── src/ # Frontend source code
│ ├── components/
│ │ ├── Layout/ # Sidebar, TopBar, AppLayout, CitizenLayout
│ │ └── Shared/ # Reusable UI components (badges, tags, loaders)
│ ├── pages/
│ │ ├── Home/ # Landing page with stats & features
│ │ ├── Login/ # OTP-based authentication
│ │ ├── SubmitComplaint/ # Multi-step complaint wizard
│ │ ├── MyComplaints/ # User's complaint list with filters
│ │ ├── ComplaintDetail/ # Individual complaint view with image
│ │ ├── Dashboard/ # Admin analytics dashboard
│ │ └── Worker/ # Field worker assignment view
│ ├── services/
│ │ ├── api.js # API service layer with mock fallbacks
│ │ └── apiClient.js # HTTP client with auth & error handling
│ ├── data/
│ │ └── mockData.js # Development mock data
│ ├── App.jsx # Root component with routing & auth
│ ├── main.jsx # Entry point
│ └── index.css # Global design system (variables, utilities)
│
├── backend/ # AWS Lambda function source code
│ ├── auth/ # OTP send & verify (SNS + DynamoDB)
│ ├── generate_upload_url/ # S3 presigned URL generation
│ ├── process_image/ # AI pipeline (YOLO + Bedrock + SES)
│ ├── submit_complaint/ # Finalize complaint submission
│ ├── get_user_complaints/ # List complaints (with phone filter)
│ ├── get_complaint/ # Get single complaint by ID
│ └── README.md # Lambda documentation
│
├── docs/ # Setup & deployment guides
│ ├── aws_lambda_gateway_setup.md
│ ├── frontend_hosting.md
│ └── yolo_ec2_setup.md
│
├── model/ # YOLOv8 model artifacts (gitignored)
│ ├── best.pt # Trained model weights
│ ├── confusion_matrix.png # Training evaluation
│ └── results.png # Training metrics
│
├── .env.example # Environment variable template
├── .gitignore # Git exclusions
├── index.html # Vite entry HTML
├── package.json # Node.js dependencies
├── vite.config.js # Vite configuration
└── README.md # This file
- Node.js 18+
- AWS Account with configured services
- Python 3.12 (for Lambda development)
git clone https://github.com/YOUR-USERNAME/CivicAI.git
cd civicai-frontend
npm installcp .env.example .envEdit .env and set your API Gateway URL:
VITE_API_BASE_URL=https://your-api-id.execute-api.ap-south-1.amazonaws.com/prod
npm run devnpm run buildUpload the dist/ folder to your S3 bucket and create a CloudFront invalidation.
CivicAI uses Amazon Pinpoint/SNS for phone authentication. Ensure your AWS account is out of the SMS Sandbox.
- Navigate to the Amazon Pinpoint Console in
ap-south-1. - Access SMS and voice settings.
- Update your Account spend limit to the approved amount (e.g., $50 USD).
- (Optional) Set up Country Rules to block sending to unintended regions.
Note: Changes to the spend limit can take up to an hour to reflect across AWS systems.
Detailed setup guides for each AWS service:
| Guide | Description |
|---|---|
| AWS Lambda & API Gateway | Lambda creation, API routes, IAM roles |
| Frontend Hosting | S3 bucket, CloudFront distribution setup |
| YOLOv8 EC2 Server | EC2 instance, FastAPI server, model deployment |
- Authentication: Phone-based OTP via AWS SNS
- Authorization: JWT tokens with 7-day expiry
- API Security: API Gateway with CORS headers
- Data Privacy: User complaints are filtered by phone number — users only see their own data
- Infrastructure: All services run within AWS with IAM-scoped permissions
Built for the AI for Bharat Hackathon — AI for Communities Track.
MIT License
CivicAI — Making Indian cities smarter, one photo at a time.