Skip to content

Latest commit

ย 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SevaSetu AI ๐Ÿ‡ฎ๐Ÿ‡ณ

AI-Powered Public Service Assistant for Government Scheme Guidance

"Bridging Citizens to Government Services" Developed by Rahul Jha | Made in India ๐Ÿ‡ฎ๐Ÿ‡ณ

Python FastAPI React MySQL Docker License


๐ŸŒŸ Features

Feature Technology
๐Ÿค– AI Chat (RAG) Gemini API + ChromaDB + Sentence-BERT
๐Ÿ—ณ๏ธ 10+ Government Services Voter ID, PAN, Passport, Certificates
๐Ÿ›๏ธ 100+ Government Schemes Central + State, Eligibility Scoring
๐Ÿ“„ Document OCR Tesseract (EN+HI+MR), Field Extraction
๐ŸŒ Multilingual English, Hindi, Marathi
๐ŸŽค Voice Input/Output Web Speech API
๐Ÿ” Auth JWT + bcrypt + RBAC
๐Ÿ“Š Admin Panel Analytics, User & Scheme Management
๐Ÿ“ฅ PDF Reports ReportLab โ€” Professional PDFs
๐Ÿณ Deployment Docker Compose + Nginx

๐Ÿ—๏ธ Project Structure

sevasetu-ai/
โ”œโ”€โ”€ frontend/                    # React.js Frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx              # Root app + auth context + routing
โ”‚   โ”‚   โ”œโ”€โ”€ App.css              # Global design system CSS
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SplashScreen.jsx # 3D animated intro screen
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ LoginPage.jsx    # JWT login
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ RegisterPage.jsx # User registration
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.jsx    # User dashboard with stats
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatPage.jsx     # AI chatbot interface โญ
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SchemesPage.jsx  # Scheme browser + eligibility
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DocumentsPage.jsx# Document upload + OCR + checklist
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ HistoryPage.jsx  # Query history
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ReportsPage.jsx  # PDF report generation
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminPage.jsx    # Admin panel
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ProfilePage.jsx  # User profile settings
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MainLayout.jsx   # Sidebar + topnav layout
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ LoadingSpinner.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ””โ”€โ”€ services/
โ”‚   โ”‚       โ””โ”€โ”€ api.js           # Axios API client (all endpoints)
โ”‚   โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ Dockerfile
โ”‚
โ”œโ”€โ”€ backend/                     # Python FastAPI Backend
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ main.py              # FastAPI app entry point โญ
โ”‚   โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ config.py        # Pydantic settings
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.py          # JWT + bcrypt + RBAC
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ database.py      # Async SQLAlchemy + MySQL
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ logging_config.py
โ”‚   โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.py          # /auth/* endpoints
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ queries.py       # /queries/* (RAG pipeline) โญ
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ schemes.py       # /schemes/* CRUD + eligibility
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ documents.py     # /documents/* upload + OCR
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ reports.py       # /reports/* PDF generation
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ admin.py         # /admin/* analytics
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ users.py         # /users/* profile
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ models/
โ”‚   โ”‚       โ””โ”€โ”€ user.py          # All SQLAlchemy models
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ Dockerfile
โ”‚
โ”œโ”€โ”€ ai/                          # AI/ML Modules
โ”‚   โ”œโ”€โ”€ rag/
โ”‚   โ”‚   โ””โ”€โ”€ rag_engine.py        # RAG pipeline (ChromaDB + Gemini) โญ
โ”‚   โ”œโ”€โ”€ ocr/
โ”‚   โ”‚   โ””โ”€โ”€ ocr_engine.py        # Tesseract OCR + field extraction โญ
โ”‚   โ””โ”€โ”€ embeddings/
โ”‚       โ””โ”€โ”€ embedding_service.py
โ”‚
โ”œโ”€โ”€ database/
โ”‚   โ””โ”€โ”€ schema.sql               # MySQL schema + seed data โญ
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ PROJECT_DOCUMENTATION.md # Complete SRS, Literature Survey, Viva QA โญ
โ”‚
โ”œโ”€โ”€ docker/
โ”‚   โ”œโ”€โ”€ docker-compose.yml       # Full stack deployment โญ
โ”‚   โ””โ”€โ”€ nginx/
โ”‚       โ””โ”€โ”€ nginx.conf
โ”‚
โ””โ”€โ”€ README.md                    # This file

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • MySQL 8.0
  • Tesseract OCR (with Hindi+Marathi packs)
  • Docker & Docker Compose (for containerized deployment)

1. Clone Repository

git clone https://github.com/rahul-jha/sevasetu-ai.git
cd sevasetu-ai

2. Configure Environment

# Backend .env
cp backend/.env.example backend/.env

# Edit backend/.env:
SECRET_KEY=your-super-secret-key-here
DATABASE_URL=mysql+asyncmy://sevasetu:password@localhost:3306/sevasetu_db
GEMINI_API_KEY=your-gemini-api-key-here    # Set this only in your backend host environment; never commit the real key    # Get from aistudio.google.com
REDIS_URL=redis://localhost:6379

# Frontend .env
echo "REACT_APP_API_URL=http://localhost:8000" > frontend/.env

3. Database Setup

mysql -u root -p < database/schema.sql

4. Backend Setup

cd backend
python -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate
pip install -r requirements.txt

# Install Tesseract OCR (Ubuntu/Debian)
sudo apt-get install -y tesseract-ocr tesseract-ocr-hin tesseract-ocr-mar

# Start backend
uvicorn app.main:app --reload --port 8000

5. Frontend Setup

cd frontend
npm install
npm start
# Opens at http://localhost:3000

6. Access Application

Service URL
๐ŸŒ Frontend http://localhost:3000
๐Ÿ”Œ Backend API http://localhost:8000
๐Ÿ“– Swagger Docs http://localhost:8000/docs
๐Ÿ“Š ReDoc http://localhost:8000/redoc

Default Admin Login:

  • Email: admin@sevasetu.ai
  • Password: Admin@SevaSetu1

๐Ÿณ Docker Deployment

# Full stack with Docker Compose
cd docker
cp .env.example .env              # Configure your API keys
docker-compose up --build         # Development
docker-compose up -d              # Production (detached)

# Check logs
docker-compose logs -f backend
docker-compose logs -f frontend

# Stop
docker-compose down

โ˜๏ธ Cloud Deployment (AWS/GCP)

AWS Elastic Beanstalk

# Install EB CLI
pip install awsebcli

# Initialize
eb init sevasetu-ai --region ap-south-1 --platform docker

# Create environment
eb create production --instance_type t3.medium

# Deploy
eb deploy

Google Cloud Run

# Build and push images
gcloud builds submit --tag gcr.io/PROJECT_ID/sevasetu-backend ./backend
gcloud builds submit --tag gcr.io/PROJECT_ID/sevasetu-frontend ./frontend

# Deploy backend
gcloud run deploy sevasetu-backend \
  --image gcr.io/PROJECT_ID/sevasetu-backend \
  --region asia-south1 \
  --allow-unauthenticated \
  --set-env-vars GEMINI_API_KEY=xxx

# Deploy frontend
gcloud run deploy sevasetu-frontend \
  --image gcr.io/PROJECT_ID/sevasetu-frontend \
  --region asia-south1 \
  --allow-unauthenticated

๐Ÿ”Œ API Quick Reference

# Register
curl -X POST http://localhost:8000/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"name":"Test","email":"test@example.com","mobile":"9876543210","password":"Test@1234","state":"Maharashtra"}'

# Login
curl -X POST http://localhost:8000/api/v1/auth/login \
  -d "username=test@example.com&password=Test@1234"

# Ask AI (RAG)
curl -X POST http://localhost:8000/api/v1/queries/ask \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"question":"How to apply for PAN card?","language":"en"}'

# Check scheme eligibility
curl -X POST http://localhost:8000/api/v1/schemes/eligibility \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"annual_income":200000,"age":35,"gender":"male","is_farmer":true}'

# Upload document for OCR
curl -X POST http://localhost:8000/api/v1/documents/upload \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@aadhaar.jpg" \
  -F "service_type=voter_id"

๐Ÿงช Running Tests

cd backend
pytest tests/ -v --asyncio-mode=auto

# With coverage report
pytest tests/ --cov=app --cov-report=html
open htmlcov/index.html

๐Ÿค– Getting Gemini API Key

  1. Go to Google AI Studio
  2. Sign in with your Google account
  3. Click "Get API Key" โ†’ "Create API Key"
  4. Copy key into backend/.env as GEMINI_API_KEY=xxx

Free tier: 15 requests/minute, 1 million tokens/month โ€” sufficient for development and testing.


๐Ÿ“Š Tech Stack Summary

Layer Technology Purpose
Frontend React.js 18, React Router 6 Single Page Application
Styling CSS Modules, Custom Properties Design system
API Client Axios + interceptors HTTP + auth
Backend FastAPI + Uvicorn REST API
Auth JWT + bcrypt Authentication + RBAC
Database MySQL 8 + SQLAlchemy async Relational data
Cache Redis 7 Sessions + rate limit
AI/LLM Google Gemini 1.5 Flash Language generation
Vector DB ChromaDB Semantic search
Embeddings Sentence-BERT (MiniLM) Query embedding
OCR Tesseract 5 + OpenCV Document processing
PDF ReportLab Report generation
Container Docker + Docker Compose Deployment
Web Server Nginx Reverse proxy + SSL

๐Ÿ‘จโ€๐Ÿ’ป Author

Rahul Jha

  • Final Year AIML Student
  • Project: SevaSetu AI โ€” Government Services Assistant
  • Made with โค๏ธ in India ๐Ÿ‡ฎ๐Ÿ‡ณ
  • Contact: rahul@sevasetu.ai

๐Ÿ“œ License

MIT License โ€” Free to use for educational purposes.

Copyright (c) 2026 Rahul Jha


๐Ÿ™ Acknowledgements

  • Google Gemini team for the powerful LLM API
  • ChromaDB team for the vector database
  • Hugging Face for Sentence-Transformers
  • FastAPI team for the excellent Python web framework
  • Government of India for the open scheme data

Jai Hind! ๐Ÿ‡ฎ๐Ÿ‡ณ โ€” SevaSetu AI: Bridging 1.4 Billion Citizens to Government Services

Render deployment

This project is configured for Render with render.yaml. Deploy the repository as a Blueprint. It creates a FastAPI Docker Web Service and a React Static Site.

Set these backend secrets in Render: GEMINI_API_KEY, DATABASE_URL, REDIS_URL, SMTP_USER, and SMTP_PASSWORD. The backend also generates a production SECRET_KEY.

The frontend uses REACT_APP_API_URL and must point to the Render FastAPI service root URL (do not append /api/v1).

For Forgot Password, configure Gmail SMTP with a Gmail App Password so the backend can send reset links.

For the complete Render deployment process, see RENDER_DEPLOYMENT.md.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages