satyamxpatil/SchemeFinder-AI
SchemeFinder AI ๐๏ธ
A government-grade, AI-assisted platform ensuring zero-hallucination scheme discovery and deterministic eligibility verification for Indian Citizens. Built for the AI for Bharat Hackathon.
๐ Problem Statement
Many citizens struggle to find government schemes they are eligible for. Existing AI solutions often "hallucinate" eligibility, giving citizens false hope or incorrect information. SchemeFinder AI solves this by separating AI Discovery from Deterministic Mathematical Verification.
โจ Key Features
- Zero Hallucination Hybrid Architecture: Uses Google Gemini to discover relevant schemes, but strictly evaluates eligibility mathematically via a custom TypeScript Engine.
- Navira AI Chatbot: Real-time conversational assistant for government scheme inquiries.
- Premium UI: Government-grade, accessible interface built with Vanilla CSS modules (No Tailwind bloat).
- Upcoming Scheme Flags: Distinct visual indicators for schemes that are still in parliamentary discussion.
- Data Privacy First: Zero databases attached to the frontend. All inputs are evaluated in-memory and instantly discarded.
๐ How to Run Locally
Prerequisites
- Node.js v18+ โ verify with
node -v - npm (comes with Node.js)
- A Google Gemini API Key (free)
Installation Steps
- Clone the repository
git clone https://github.com/Patilsatyam83/schemefinder-ai.git- Navigate into the project folder
cd scheme-finderโ ๏ธ Important: The project folder is calledscheme-finder, NOTschemefinder-ai. Runningnpmcommands outside this folder will cause apackage.json not founderror.
- Install dependencies
npm install- Create the environment file
In the scheme-finder folder, create a new file named exactly .env.local and add:
GEMINI_API_KEY=your_actual_api_key_here Replace your_actual_api_key_here with your real Gemini API key from Google AI Studio.
๐ก Windows users: Use VS Code to create .env.local โ Windows Explorer may block filenames that start with a dot.- Start the development server
npm run dev- Open in browser
Navigate to http://localhost:3000
โ Troubleshooting
๐๏ธ Architecture & Code Overview (For Judges)
1. src/data/schemes.json (The Database)
This acts as our massive ingested government database (simulating data.gov.in). It stores rigid criteria for active schemes (like PM-Kisan) and upcoming schemes (like Universal Basic Youth Income).
2. src/lib/eligibilityEngine.ts (The Brains - Zero Hallucination)
This is the core innovation. It is a strictly deterministic TypeScript function. It takes the user's profile and compares it against the JSON criteria. Why it matters: It uses standard if/else mathematical checks (user.income <= rule.maxIncome). AI is never allowed to dictate if someone is eligible.
3. src/app/api/schemes/route.ts (The Hybrid Discovery Pipeline)
When a user clicks "Search", this API route triggers:
- It sends the profile to Google Gemini asking it to discover potentially relevant schemes.
- It takes those AI-suggested schemes and merges them with our local
schemes.json. - It takes the combined list and safely passes it through the
eligibilityEngine.ts. - The frontend only renders schemes that mathematically survived step 3.
4. src/components/Chatbot.tsx & api/chat/route.ts (The Assistant)
A custom-built React component that maintains conversation history and streams responses from Gemini 2.5 Flash, strictly instructed via system prompts to act as a government guide.
๐ Privacy & Security
- In-Memory Processing: The Next.js API routes process the JSON payload instantly without saving state to an external SQL/NoSQL database.
๐จโ๐ป Developed By
Satyam Patil - Project Lead, Navira AI
