Bridging Citizens and Government Services through Intelligent Technology
"If AI can revolutionize e-commerce recommendations, why not help citizens discover the government schemes they deserve?"
MySarkar is a comprehensive multilingual AI platform that makes government scheme discovery intelligent, accessible, and inclusive โ supporting everything from smartphone apps to keypad phone IVR calls.
โ Vector-powered search using:
Xenova/all-MiniLM-L6-v2 + multilingual transformers{
"query": "farmer loan scheme west bengal",
"results": [
{
"name": "PM-KISAN Samman Nidhi",
"eligibility_score": 0.94,
"benefits": "โน6,000/year direct transfer"
}
]
}
Powered by Google Gemini + Hugging Face Models with comprehensive knowledge:
{
"query": "West Bengal health insurance schemes",
"response": "Available schemes: Ayushman Bharat (โน5L coverage), Swasthya Sathi (โน5L state scheme)..."
}
Press 1 for scheme information
Press 2 for eligibility check
Press 3 to speak with AI assistant
Supports keypad phones with:
Smart form assistance using:
{
"extracted_fields": ["name", "aadhaar", "income"],
"help_text": "Fill Aadhaar as 12-digit number without spaces",
"audio_url": "/audio/form_help_hindi.mp3"
}
Role-based social features:
| Layer | Technology | Purpose |
|---|---|---|
| ๐จ Frontend | React 19 + Vite + Tailwind CSS | Modern responsive UI |
| ๐ง Backend | Node.js + Express + MongoDB | RESTful API & data management |
| ๐ง AI Services | FastAPI + Python + Transformers | ML/AI processing pipeline |
| ๐๏ธ Database | MongoDB Atlas + Vector Search | Semantic scheme discovery |
| ๐ Voice | Twilio + Ngrok | IVR calling system |
| ๐ Translation | IndicTrans2 + Google Translate | Multi-language support |
| ๐ค ML Models | Hugging Face + Custom Models | NLP & Computer Vision |
| ๐ Auth | JWT + bcrypt | Secure authentication |
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ React Frontend โโโโโโ Node.js Backend โโโโโโ FastAPI AI Hub โ
โ (Port 3000) โ โ (Port 5000) โ โ (Port 8000) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโ MongoDB Atlas โโโโโโโโโโโโโโโโ
โ (Vector Search) โ
โโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Twilio IVR System โ
โ (Ngrok Tunneling) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
Node.js 18+, Python 3.9+, MongoDB Atlas account
Twilio account, Google API keys, Ngrok
cd backend
npm install
cp .env.example .env
# Configure: MONGODB_URI, JWT_SECRET, CORS_ORIGIN
npm run dev # Runs on port 5000
cd frontend
npm install
cp .env.example .env
# Configure: VITE_BACKEND_URL, VITE_GEMINI_API_KEY
npm run dev # Runs on port 3000
cd fastAPI
python -m venv myenv
source myenv/bin/activate # Windows: myenv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Configure: GOOGLE_API_KEY, BACKEND_URL
python -m uvicorn app.main:app --reload # Runs on port 8000
# Install ngrok globally
npm install -g ngrok
# Expose FastAPI to internet
ngrok http 8000
# Configure Twilio webhook URL:
# https://your-ngrok-url.ngrok.io/ivr/voice
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/register | User registration |
| POST | /api/v1/auth/login | User login |
| GET | /api/v1/auth/me | Get current user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/schemes | List all schemes |
| POST | /api/v1/schemes/search | Vector search schemes |
| GET | /api/v1/schemes/eligible/me | Get eligible schemes |
| Method | Endpoint | Description |
|---|---|---|
| POST | /chat | AI assistant chat |
| POST | /analyze-form | OCR + form help |
| POST | /detect-hatespeech | Content moderation |
| POST | /translate | Text translation |
| Method | Endpoint | Description |
|---|---|---|
| POST | /ivr/voice | Twilio voice webhook |
| POST | /ivr/gather | DTMF input processing |
| GET | /ivr/tts/{text} | Text-to-speech audio |
// Semantic scheme matching with state-of-the-art embeddings
const embedder = await pipeline("feature-extraction", "Xenova/all-MiniLM-L6-v2");
const queryEmbedding = await embedder(userQuery);
const results = await collection.aggregate([
{
$vectorSearch: {
queryVector: queryEmbedding,
path: "embedding",
numCandidates: 200,
limit: 5
}
}
]);
# IndicTrans2 for Indian languages
from IndicTransToolkit import IndicProcessor
ip = IndicProcessor(inference=True)
input_sentences = ["Government scheme information"]
batch = ip.preprocess_batch(input_sentences, src_lang="eng_Latn", tgt_lang="hin_Deva")
translated = model(batch)
output = ip.postprocess_batch(translated, lang="hin_Deva")
# Hugging Face Transformers integration
from transformers import pipeline, AutoTokenizer, AutoModel
# Sentiment analysis for community posts
sentiment_analyzer = pipeline("sentiment-analysis",
model="cardiffnlp/twitter-roberta-base-sentiment-latest")
# Multilingual embeddings
embedding_model = AutoModel.from_pretrained("sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2")
# Google Gemini for conversational AI
model = genai.GenerativeModel('gemini-1.5-flash')
response = model.generate_content(f"""
You are an Indian Government Services Assistant.
Query: {user_query}
Schemes: {relevant_schemes}
Respond directly with helpful information.
""")
# Advanced document processing pipeline
import pytesseract
from PIL import Image
from transformers import pipeline
# OCR with preprocessing
ocr_result = pytesseract.image_to_string(preprocessed_image, lang='eng+hin+ben')
# Document classification
doc_classifier = pipeline("image-classification",
model="microsoft/dit-base-finetuned-rvlcdip")
# Form field extraction with NER
ner_pipeline = pipeline("ner",
model="dbmdz/bert-large-cased-finetuned-conll03-english")
fields = ner_pipeline(ocr_result)
# Custom hate speech detection model
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
# Load pre-trained models
tfidf = pickle.load(open('vectorizer.pkl', 'rb'))
hate_model = pickle.load(open('model.pkl', 'rb'))
# Multi-language hate speech detection
transformed_text = transform_text(user_input)
vector_input = tfidf.transform([transformed_text])
is_hate_speech = hate_model.predict(vector_input)[0]
| Role | Permissions | UI Features |
|---|---|---|
| ๐ค Citizen | View schemes, apply, community posts | Standard interface |
| ๐๏ธ Govt Official | Manage schemes, approve applications | Gold highlighting, admin badge |
| ๐ค NGO | Create schemes, community engagement | Green highlighting, NGO badge |
| โก Admin | Full system access, user management | Red highlighting, admin badge |
๐ User calls Twilio number
โ
๐ต Welcome message in preferred language
โ
๐ข DTMF menu options
โ (Press 1)
๐ Scheme information service
โ (Press 2)
โ
Eligibility checking
โ (Press 3)
๐ค AI assistant conversation
// JWT-based security
const token = jwt.sign({ userId, role }, JWT_SECRET, { expiresIn: '7d' });
// Role-based access control
const hasPermission = user.permissions.includes('manage_schemes');
# Hate speech detection
transformed_text = transform_text(user_input)
vector_input = tfidf.transform([transformed_text])
is_hate_speech = hate_model.predict(vector_input)[0]
| Traditional Process | With MySarkar | Improvement |
|---|---|---|
| Manual scheme search | AI-powered discovery | 10x faster |
| Language barriers | Multi-lingual support | 100% accessible |
| Complex forms | OCR + AI assistance | 80% error reduction |
| Limited access | IVR for feature phones | Universal reach |
| Scattered information | Unified platform | Single source of truth |
POST /api/v1/schemes/search
{
"query": "farmer subsidy odisha",
"user_profile": {
"state": "Odisha",
"category": "farmer",
"income": 200000
}
}
POST /chat
{
"message": "เคฎเฅเคเฅ เคธเฅเคตเคพเคธเฅเคฅเฅเคฏ เคฌเฅเคฎเคพ เคเคพเคนเคฟเค",
"language": "Hindi"
}
POST /analyze-form
{
"image_data": "base64_encoded_image",
"language": "Bengali"
}
# Backend tests
cd backend && npm test
# AI services tests
cd fastAPI && python test_services.py
# Frontend tests
cd frontend && npm run test
# Production build
npm run build
# Docker deployment
docker-compose up -d
# Environment setup
cp .env.production .env
// Structured logging
logger.info('Scheme search', {
userId,
query,
resultsCount,
responseTime: Date.now() - startTime
});
๐ Monitoring & Logging
| Tool | Purpose | Example Metrics / Logs |
|---|---|---|
| Prometheus | Metrics collection | API latency, request count, DB query time |
| Grafana | Dashboards & alerts | API health, inference latency, IVR funnel |
| Loki | Centralized logging | Errors, OCR failures, Twilio webhook logs |
| Tempo | Distributed tracing | End-to-end request traces across services |
| Sentry | Error monitoring | Backend crashes, React errors |
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureMIT ยฉ 2025 MySarkar Team
Built for Digital India Initiative
๐ Making Government Services Accessible to Every Indian Citizen
JavaScript
80.4%
Python
16.6%
CSS
2.2%
Bridging Citizens and Government Services through Intelligent Technology
"If AI can revolutionize e-commerce recommendations, why not help citizens discover the government schemes they deserve?"
MySarkar is a comprehensive multilingual AI platform that makes government scheme discovery intelligent, accessible, and inclusive โ supporting everything from smartphone apps to keypad phone IVR calls.
โ Vector-powered search using:
Xenova/all-MiniLM-L6-v2 + multilingual transformers{
"query": "farmer loan scheme west bengal",
"results": [
{
"name": "PM-KISAN Samman Nidhi",
"eligibility_score": 0.94,
"benefits": "โน6,000/year direct transfer"
}
]
}
Powered by Google Gemini + Hugging Face Models with comprehensive knowledge:
{
"query": "West Bengal health insurance schemes",
"response": "Available schemes: Ayushman Bharat (โน5L coverage), Swasthya Sathi (โน5L state scheme)..."
}
Press 1 for scheme information
Press 2 for eligibility check
Press 3 to speak with AI assistant
Supports keypad phones with:
Smart form assistance using:
{
"extracted_fields": ["name", "aadhaar", "income"],
"help_text": "Fill Aadhaar as 12-digit number without spaces",
"audio_url": "/audio/form_help_hindi.mp3"
}
Role-based social features:
| Layer | Technology | Purpose |
|---|---|---|
| ๐จ Frontend | React 19 + Vite + Tailwind CSS | Modern responsive UI |
| ๐ง Backend | Node.js + Express + MongoDB | RESTful API & data management |
| ๐ง AI Services | FastAPI + Python + Transformers | ML/AI processing pipeline |
| ๐๏ธ Database | MongoDB Atlas + Vector Search | Semantic scheme discovery |
| ๐ Voice | Twilio + Ngrok | IVR calling system |
| ๐ Translation | IndicTrans2 + Google Translate | Multi-language support |
| ๐ค ML Models | Hugging Face + Custom Models | NLP & Computer Vision |
| ๐ Auth | JWT + bcrypt | Secure authentication |
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ React Frontend โโโโโโ Node.js Backend โโโโโโ FastAPI AI Hub โ
โ (Port 3000) โ โ (Port 5000) โ โ (Port 8000) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโ MongoDB Atlas โโโโโโโโโโโโโโโโ
โ (Vector Search) โ
โโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Twilio IVR System โ
โ (Ngrok Tunneling) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
Node.js 18+, Python 3.9+, MongoDB Atlas account
Twilio account, Google API keys, Ngrok
cd backend
npm install
cp .env.example .env
# Configure: MONGODB_URI, JWT_SECRET, CORS_ORIGIN
npm run dev # Runs on port 5000
cd frontend
npm install
cp .env.example .env
# Configure: VITE_BACKEND_URL, VITE_GEMINI_API_KEY
npm run dev # Runs on port 3000
cd fastAPI
python -m venv myenv
source myenv/bin/activate # Windows: myenv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Configure: GOOGLE_API_KEY, BACKEND_URL
python -m uvicorn app.main:app --reload # Runs on port 8000
# Install ngrok globally
npm install -g ngrok
# Expose FastAPI to internet
ngrok http 8000
# Configure Twilio webhook URL:
# https://your-ngrok-url.ngrok.io/ivr/voice
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/register | User registration |
| POST | /api/v1/auth/login | User login |
| GET | /api/v1/auth/me | Get current user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/schemes | List all schemes |
| POST | /api/v1/schemes/search | Vector search schemes |
| GET | /api/v1/schemes/eligible/me | Get eligible schemes |
| Method | Endpoint | Description |
|---|---|---|
| POST | /chat | AI assistant chat |
| POST | /analyze-form | OCR + form help |
| POST | /detect-hatespeech | Content moderation |
| POST | /translate | Text translation |
| Method | Endpoint | Description |
|---|---|---|
| POST | /ivr/voice | Twilio voice webhook |
| POST | /ivr/gather | DTMF input processing |
| GET | /ivr/tts/{text} | Text-to-speech audio |
// Semantic scheme matching with state-of-the-art embeddings
const embedder = await pipeline("feature-extraction", "Xenova/all-MiniLM-L6-v2");
const queryEmbedding = await embedder(userQuery);
const results = await collection.aggregate([
{
$vectorSearch: {
queryVector: queryEmbedding,
path: "embedding",
numCandidates: 200,
limit: 5
}
}
]);
# IndicTrans2 for Indian languages
from IndicTransToolkit import IndicProcessor
ip = IndicProcessor(inference=True)
input_sentences = ["Government scheme information"]
batch = ip.preprocess_batch(input_sentences, src_lang="eng_Latn", tgt_lang="hin_Deva")
translated = model(batch)
output = ip.postprocess_batch(translated, lang="hin_Deva")
# Hugging Face Transformers integration
from transformers import pipeline, AutoTokenizer, AutoModel
# Sentiment analysis for community posts
sentiment_analyzer = pipeline("sentiment-analysis",
model="cardiffnlp/twitter-roberta-base-sentiment-latest")
# Multilingual embeddings
embedding_model = AutoModel.from_pretrained("sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2")
# Google Gemini for conversational AI
model = genai.GenerativeModel('gemini-1.5-flash')
response = model.generate_content(f"""
You are an Indian Government Services Assistant.
Query: {user_query}
Schemes: {relevant_schemes}
Respond directly with helpful information.
""")
# Advanced document processing pipeline
import pytesseract
from PIL import Image
from transformers import pipeline
# OCR with preprocessing
ocr_result = pytesseract.image_to_string(preprocessed_image, lang='eng+hin+ben')
# Document classification
doc_classifier = pipeline("image-classification",
model="microsoft/dit-base-finetuned-rvlcdip")
# Form field extraction with NER
ner_pipeline = pipeline("ner",
model="dbmdz/bert-large-cased-finetuned-conll03-english")
fields = ner_pipeline(ocr_result)
# Custom hate speech detection model
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
# Load pre-trained models
tfidf = pickle.load(open('vectorizer.pkl', 'rb'))
hate_model = pickle.load(open('model.pkl', 'rb'))
# Multi-language hate speech detection
transformed_text = transform_text(user_input)
vector_input = tfidf.transform([transformed_text])
is_hate_speech = hate_model.predict(vector_input)[0]
| Role | Permissions | UI Features |
|---|---|---|
| ๐ค Citizen | View schemes, apply, community posts | Standard interface |
| ๐๏ธ Govt Official | Manage schemes, approve applications | Gold highlighting, admin badge |
| ๐ค NGO | Create schemes, community engagement | Green highlighting, NGO badge |
| โก Admin | Full system access, user management | Red highlighting, admin badge |
๐ User calls Twilio number
โ
๐ต Welcome message in preferred language
โ
๐ข DTMF menu options
โ (Press 1)
๐ Scheme information service
โ (Press 2)
โ
Eligibility checking
โ (Press 3)
๐ค AI assistant conversation
// JWT-based security
const token = jwt.sign({ userId, role }, JWT_SECRET, { expiresIn: '7d' });
// Role-based access control
const hasPermission = user.permissions.includes('manage_schemes');
# Hate speech detection
transformed_text = transform_text(user_input)
vector_input = tfidf.transform([transformed_text])
is_hate_speech = hate_model.predict(vector_input)[0]
| Traditional Process | With MySarkar | Improvement |
|---|---|---|
| Manual scheme search | AI-powered discovery | 10x faster |
| Language barriers | Multi-lingual support | 100% accessible |
| Complex forms | OCR + AI assistance | 80% error reduction |
| Limited access | IVR for feature phones | Universal reach |
| Scattered information | Unified platform | Single source of truth |
POST /api/v1/schemes/search
{
"query": "farmer subsidy odisha",
"user_profile": {
"state": "Odisha",
"category": "farmer",
"income": 200000
}
}
POST /chat
{
"message": "เคฎเฅเคเฅ เคธเฅเคตเคพเคธเฅเคฅเฅเคฏ เคฌเฅเคฎเคพ เคเคพเคนเคฟเค",
"language": "Hindi"
}
POST /analyze-form
{
"image_data": "base64_encoded_image",
"language": "Bengali"
}
# Backend tests
cd backend && npm test
# AI services tests
cd fastAPI && python test_services.py
# Frontend tests
cd frontend && npm run test
# Production build
npm run build
# Docker deployment
docker-compose up -d
# Environment setup
cp .env.production .env
// Structured logging
logger.info('Scheme search', {
userId,
query,
resultsCount,
responseTime: Date.now() - startTime
});
๐ Monitoring & Logging
| Tool | Purpose | Example Metrics / Logs |
|---|---|---|
| Prometheus | Metrics collection | API latency, request count, DB query time |
| Grafana | Dashboards & alerts | API health, inference latency, IVR funnel |
| Loki | Centralized logging | Errors, OCR failures, Twilio webhook logs |
| Tempo | Distributed tracing | End-to-end request traces across services |
| Sentry | Error monitoring | Backend crashes, React errors |
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureMIT ยฉ 2025 MySarkar Team
Built for Digital India Initiative
๐ Making Government Services Accessible to Every Indian Citizen
JavaScript
80.4%
Python
16.6%
CSS
2.2%