Skip to content

pestechnology/Zencitizen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 Zen Citizen AI

GitHub stars GitHub license Node.js MongoDB OpenAI

AI-Powered Government Guidance Assistant with Multi-Source Verification

Get instant, verified guidance on Indian government services. Zen Citizen AI combines internal databases, official government websites, verified sources, community forums, and ChatGPT synthesis to provide reliable information with confidence scores.

✨ Features

🎯 Core Functionality

  • Multi-Source Verification: Fetches data from 5+ sources simultaneously
  • Confidence Scoring: Shows reliability of each answer (High/Medium/Low)
  • AI Synthesis: ChatGPT verifies and synthesizes information
  • State Awareness: Get guidance specific to your state
  • Beautiful Interface: Modern, responsive design

πŸ”„ Data Sources

  • Internal Database (95% confidence) - Pre-verified guides
  • Official Government Sites (85% confidence) - .gov.in domains
  • Verified Websites (75% confidence) - Trusted organizations
  • Community Forums (40-60% confidence) - Reddit & YouTube
  • AI Verification (Variable) - ChatGPT synthesis

πŸ› οΈ Technologies

  • Backend: Node.js, Express, MongoDB
  • Frontend: HTML5, CSS3, Vanilla JavaScript
  • AI: OpenAI GPT-4o-mini
  • Data: Axios, Cheerio, MongoDB
  • Deployment: Ready for Heroku, Railway, Vercel, etc.

πŸš€ Quick Start

Prerequisites

  • Node.js 14+
  • MongoDB (local or Atlas)
  • Python 3 (for frontend development)
  • OpenAI API key

1. Backend Setup

cd Zencitizen-backend

# Install dependencies
npm install

# Create .env file
cp .env.example .env
# Edit .env and add your OpenAI API key and MongoDB URI

# Start server
npm start

Backend runs on http://localhost:8000

2. Frontend Setup

cd Zencitizen-frontend

# Start HTTP server
python3 -m http.server 8888

Frontend accessible at http://localhost:8888

3. Test Integration

Visit http://localhost:8888 and ask:

  • "How do I apply for passport?"
  • "Voter ID requirements in Maharashtra?"
  • "Driving license process"

πŸ“ Project Structure

Zencitizen-AI/
β”œβ”€β”€ Zencitizen-backend/          # Backend API
β”‚   β”œβ”€β”€ server.js                # Main server
β”‚   β”œβ”€β”€ models/Guide.js          # MongoDB schema
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ guidanceEngine.js    # Core orchestrator
β”‚   β”‚   β”œβ”€β”€ serviceRegistry.js   # Service definitions
β”‚   β”‚   β”œβ”€β”€ confidenceScorer.js  # Scoring system
β”‚   β”‚   β”œβ”€β”€ chatgptSynthesis.js  # AI synthesis
β”‚   β”‚   β”œβ”€β”€ mcpSources.js        # Reddit/YouTube
β”‚   β”‚   └── verifiedWebsites.js  # Official sources
β”‚   β”œβ”€β”€ config/services.js       # Service mappings
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ .env.example
β”‚   β”œβ”€β”€ SETUP_GUIDE.md
β”‚   └── README.md
β”‚
β”œβ”€β”€ Zencitizen-frontend/         # Frontend UI
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ styles.css
β”‚   β”‚   └── components.css
β”‚   β”œβ”€β”€ js/main.js
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ QUICK_START.md
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   └── .gitignore
β”‚
β”œβ”€β”€ README.md                     # This file
β”œβ”€β”€ LICENSE
└── .gitignore

🎯 Available Services

  1. Indian Passport - Travel documents
  2. Voter ID - Electoral card
  3. Driving License - Vehicle license
  4. Aadhaar - National ID
  5. PAN Card - Tax identification
  6. Ration Card - Food security
  7. Property Registration - Land registry

πŸ“Š How It Works

Request Flow

User Question
    ↓
Service Identification (Search Registry)
    ↓
Internal Database Check (MongoDB)
    ↓
Official Sites Fetch (.gov.in domains) β”œβ”€ Parallel
Community Sources (Reddit/YouTube)      β”‚
Verified Websites                       ↓
    ↓
Confidence Scoring & AI Synthesis (ChatGPT)
    ↓
Structured JSON Response
    ↓
Beautiful Results Display

Confidence Levels

  • High (85-100%): Internal DB or official government
  • Medium (60-84%): Verified sources with some consensus
  • Low (1-59%): Community-only sources, verify directly

πŸ”Œ API Endpoints

POST /api/chat

Get guidance on any government service.

Request:

{
  "question": "How do I apply for passport?",
  "state": "Maharashtra"
}

Response:

{
  "source": "hybrid+verified_websites+community",
  "confidenceLevel": "High",
  "service": "Indian Passport",
  "state": "Maharashtra",
  "answer": "...",
  "steps": [...],
  "requiredDocuments": [...],
  "fees": "β‚Ή1500",
  "processingTime": "7-14 days",
  "eligibility": "...",
  "officialLinks": [...],
  "confidenceScore": 0.95
}

POST /api/add-guide

Add a new guide (admin).

POST /api/fetch-raw

Fetch raw content from URL.

POST /api/structure-content

Structure raw content with ChatGPT.

DELETE /api/delete-guide/:category

Remove a guide.

🎨 Frontend Features

  • Hero Section - Eye-catching landing page
  • Service Browser - Browse 7+ government services
  • Chat Interface - Real-time guidance
  • Results Modal - Detailed information display
  • Source Tracking - View all sources used
  • Search History - Recent searches saved locally
  • Responsive Design - Works on all devices

πŸ“± Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+
  • Mobile browsers

πŸ”’ Security & Privacy

  • No personal data collection
  • All API keys stored server-side (.env)
  • Source domain verification
  • Community sources weighted lower
  • External page verification
  • CORS enabled for safety

πŸ“š Documentation

πŸš€ Deployment

Frontend

  • Netlify: netlify deploy --prod
  • Vercel: vercel --prod
  • GitHub Pages: Push to gh-pages branch
  • AWS S3: aws s3 sync . s3://bucket

Backend

  • Heroku: git push heroku main
  • Railway: railway up
  • Render: Connect GitHub repo
  • AWS EC2, DigitalOcean, or custom VPS

Environment Setup

  1. Create .env file with secrets
  2. Set MongoDB Atlas connection
  3. Add OpenAI API key
  4. Configure CORS for frontend domain

πŸ§ͺ Testing

Test Backend

# Chat endpoint
curl -X POST http://localhost:8000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"question":"How to get passport?"}'

# Add guide
curl -X POST http://localhost:8000/api/add-guide \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Test",
    "category": "passport",
    "overview": "Test",
    "sourceUrl": "https://test.gov.in"
  }'

# View database
curl http://localhost:8000/debug-guides

Test Frontend

  1. Open http://localhost:8888
  2. Search different services
  3. Check browser console (F12)
  4. Test on mobile devices

πŸ› Troubleshooting

Backend Issues

# Check MongoDB connection
# Verify OPENAI_API_KEY is set
# Check port 8000 is available
lsof -i :8000

# View logs
npm start

Frontend Issues

# Check port 8888 is available
lsof -i :8888

# Clear browser cache
# Check DevTools Network/Console tabs

API Connection

  1. Verify both servers running
  2. Check API base URL in frontend code
  3. Inspect network requests
  4. Review error messages in console

πŸ“ˆ Performance

  • Backend: 5-15s (includes synthesis)
  • Frontend: <100ms render
  • Database: <100ms queries
  • Bundle: ~50KB assets
  • Lightweight & optimized

πŸ’‘ Future Enhancements

  • Dark mode
  • Multi-language support
  • Offline mode
  • Service comparison
  • Voice search
  • PDF export
  • Real-time updates
  • User bookmarks

🀝 Contributing

We welcome contributions!

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -am 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open Pull Request

πŸ“„ License

MIT License - see LICENSE file for details

πŸ™ Acknowledgments

  • Built with Node.js, Express, MongoDB
  • AI powered by OpenAI
  • Community data from Reddit & YouTube
  • Government data from official sources

πŸ“ž Support & Contact


πŸ“Š Stats

  • πŸš€ 7+ Government Services
  • πŸ”— 5+ Data Sources
  • 🧠 AI-Powered Verification
  • 🎨 Modern Web Interface
  • ⚑ Fast & Lightweight

🌿 Zen Citizen AI - Making Government Guidance Simple & Reliable

Built with ❀️ using modern web technologies. Designed to help Indians navigate government services effortlessly.

Last Updated: February 2026

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •