Saral Seva is an AI-powered Indian Government Schemes Help Portal that leverages RAG pipelines, multilingual LLMs, and intelligent document processing to help citizens discover, understand, and apply for the welfare schemes they deserve.
๐ Quick Start ยท โจ Features ยท ๐ Architecture ยท ๐ก API Reference ยท ๐ค Contributing
- Conversational AI built on the smolagents framework
- Multilingual support โ responds in Hindi, Tamil, Telugu, Bengali, and 18+ Indian languages
- Context-aware responses with smart follow-up question suggestions
- Automated grievance redressal via email for unresolved complaints
- DPR (Dense Passage Retrieval) embeddings for accurate scheme matching
- Vector-based semantic search across the full scheme corpus
- Automatic extraction of citations and references from source documents
- Real-time scheme eligibility matching against uploaded user documents
- Brave Search API integration for up-to-date scheme information
- Concurrent URL content extraction and full-text parsing via Playwright
- Intelligent relevance scoring and filtering pipeline
- Multi-format support: PDF, DOCX, Excel, and images
- Tesseract OCR for text extraction from scanned documents
- AI-powered document authenticity and completeness verification
- Automatic DPR (Document Processing Report) generation
- Secure cloud storage via AWS S3
- OTP-based authentication โ no passwords required
- JWT session management with configurable expiry
- Built-in API rate limiting and in-memory caching (FastAPI-cache2)
- Celery workers with Redis broker for background processing
- Real-time WebSocket notifications
- Nginx reverse proxy with load balancing
- Multi-stage Docker builds for all services
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLIENT LAYER โ
โ Next.js 15 ยท React 19 ยท TailwindCSS ยท Bootstrap 5 โ
โ FilePond (uploads) ยท React-Markdown ยท WebSocket โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP / WebSocket
โโโโโโโผโโโโโโ
โ Nginx โ โ Reverse Proxy + Load Balancer
โโโโโโโฌโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SERVICE LAYER โ
โ FastAPI ยท Celery Workers ยท WebSocket Server โ
โ JWT Auth ยท OTP Verification โ
โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ-โ
โ โ
โโโโโโโโผโโโโโโโ โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DATA LAYER โ โ AI / ML LAYER โ
โ MongoDB โ โ smolagents ยท LiteLLM ยท OpenAI ยท Gemini โ
โ Redis โ โ Hugging Face DPR ยท Brave Search โ
โ AWS S3 โ โ Tesseract OCR ยท PyMuPDF ยท Playwright โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ-โ
Citizen Query / Document Upload
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Multilingual NLP โ โ Detects language, normalises input
โ Intent Detection โ โ smolagents classifies query type
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Document Pipeline โ โ Tesseract OCR + PyMuPDF extraction
โ (if file uploaded) โ โ AI categorises by scheme relevance
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ RAG Retrieval โ โ DPR embeddings โ Vector search
โ + Brave Search โ โ Live web context fetched & ranked
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ LLM Generation โ โ GPT-4o / Gemini via LiteLLM
โ (Grounded) โ โ Eligibility check against documents
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ DPR + Guidance โ โ Document Processing Report
โ Delivery โ โ Step-by-step application guide
โ โ โ Auto grievance email if needed
โโโโโโโโโโโโโโโโโโโโโโโ
| Layer | Technology | Purpose |
|---|---|---|
| Backend | FastAPI + Python 3.11 | REST API, business logic |
| Frontend | Next.js 15 + React 19 | Modern, responsive UI |
| Database | MongoDB + Motor (async) | Scheme & user data |
| Cache / Queue | Redis + Celery | Sessions, background tasks |
| AI Agents | smolagents | Intelligent automation |
| LLM Interface | LiteLLM | GPT-4o, Gemini, unified API |
| Embeddings | Hugging Face DPR | Semantic vector search |
| OCR | Tesseract + PyMuPDF | Document text extraction |
| Web Scraping | Playwright + BeautifulSoup | Scheme data collection |
| Search | Brave Search API | Live web information |
| File Storage | AWS S3 | Secure document storage |
| Infra | Docker + Nginx | Containers, load balancing |
| Styling | TailwindCSS + Bootstrap 5 | UI components |
| File Upload | React FilePond | Drag-and-drop uploads |
DocuMindAI/
โโโ backend/ # FastAPI backend
โ โโโ main.py # App entrypoint
โ โโโ routers/
โ โ โโโ auth.py # OTP auth endpoints
โ โ โโโ chatbot.py # AI chat endpoints
โ โ โโโ schemes.py # Scheme search & details
โ โ โโโ documents.py # Document upload & verify
โ โโโ agents/
โ โ โโโ chatbot_agent.py # smolagents chatbot
โ โ โโโ document_agent.py # Document processing agent
โ โโโ rag/
โ โ โโโ embeddings.py # DPR embedding pipeline
โ โ โโโ retriever.py # Vector search
โ โโโ tasks.py # Celery async tasks
โ โโโ requirements.txt
โ
โโโ saral-sewa/ # Next.js frontend
โ โโโ app/ # App Router pages
โ โโโ components/ # Reusable UI components
โ โโโ package.json
โ
โโโ pipeline/ # Data ingestion pipeline
โ โโโ main.py # Scheme scraping + indexing
โ โโโ requirements.txt
โ
โโโ docker-compose.yaml # All services orchestration
โโโ nginx.conf # Reverse proxy config
โโโ .env.example # Environment variable template
- Docker & Docker Compose
- OpenAI API key, Gemini API key, Brave Search API key
- Hugging Face token
- AWS S3 bucket + credentials
git clone https://github.com/your-org/DocuMindAI.git
cd DocuMindAIBackend (backend/.env):
# Database
MONGO_URI=mongodb://localhost:27017/schemes_db
# AI / ML
HF_TOKEN=your_huggingface_token
GEMINI_API_KEY=your_gemini_api_key
OPENAI_API_KEY=your_openai_api_key
BRAVE_API_KEY=your_brave_search_api_key
# Storage
AWS_ACCESS_KEY_ID=your_aws_key
AWS_SECRET_ACCESS_KEY=your_aws_secret
AWS_STORAGE_BUCKET_NAME=your_bucket_name
AWS_S3_REGION_NAME=ap-south-1
# App
SESSION_SECRET=your_session_secret
SUPPORT_EMAIL=support@saralsewa.com
SMTP_SERVER=smtp.gmail.comFrontend (saral-sewa/.env.local):
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000/api/masterDOCKER_BUILDKIT=1 docker compose build --build-arg CACHE_BUSTER=$(date +%s)
docker compose up -ddocker compose exec pipeline python main.py| Service | URL |
|---|---|
| ๐ Frontend | http://localhost:3000 |
| โ๏ธ API | http://localhost:8000/api/master |
| ๐ API Docs | http://localhost:8000/docs |
Backend:
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000Frontend:
cd saral-sewa
npm install && npm run devPipeline:
cd pipeline
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt && python main.pyAll endpoints are prefixed with /api/master and require a JWT bearer token (except auth routes).
| Method | Endpoint | Description |
|---|---|---|
POST |
/auth/send-otp |
Send OTP to registered phone |
POST |
/auth/verify-otp |
Verify OTP, receive JWT token |
POST |
/auth/logout |
Invalidate current session |
| Method | Endpoint | Description |
|---|---|---|
POST |
/chatbot/chat |
Send message to AI assistant |
| Method | Endpoint | Description |
|---|---|---|
GET |
/schemes |
List all indexed schemes |
GET |
/schemes/{slug} |
Get full scheme details |
GET |
/schemes/search?q= |
Full-text scheme search |
| Method | Endpoint | Description |
|---|---|---|
POST |
/documents/upload |
Upload documents to S3 |
GET |
/documents |
List user's documents |
POST |
/documents/verify |
Verify document authenticity |
| Citizen | Schemes They Can Discover |
|---|---|
| ๐จโ๐พ Farmers | PM Kisan Yojana, crop insurance, soil health card |
| ๐ฉโ๐ Students | Scholarships, skill development, fellowships |
| ๐คฑ Women | Mahila schemes, maternity benefits, SHG support |
| ๐๏ธ Labour | MGNREGS, PMAY housing, pension schemes |
| ๐ง Senior Citizens | Atal Pension Yojana, Ayushman Bharat |
| ๐ข MSMEs | Mudra loans, startup grants, credit guarantee |
Contributions are welcome!
# Fork the repo, then:
git clone https://github.com/your-username/DocuMindAI.git
git checkout -b feature/your-feature-name
# Make your changes, then:
git commit -m "feat: describe your change"
git push origin feature/your-feature-name
# Open a Pull Request| Channel | Details |
|---|---|
| ๐ง Email | support@saralsewa.com |
| ๐ค Chatbot | Available 24/7 on the platform |
| ๐ Issues | Open a GitHub Issue |
This project is licensed under the MIT License โ see the LICENSE file for details.