A high-performance, AI-orchestrated web application that calculates university admission merit aggregates across all provinces of Pakistan, powered by Google Gemini API and a High-Level Multi-Agent Manager Architecture.
The AI University Merit Predictor is designed to provide Pakistani high school and college students with a frictionless, highly accurate, and intelligent platform to calculate aggregate scores and assess admission likelihood across all major universities in Pakistan.
Built with Next.js 16 (App Router), React 19, TypeScript, Drizzle ORM, Tailwind CSS v4, and Google Gemini 2.5 Flash, the platform eliminates the need for user accounts/login barriers, offering instant merit calculations, province-specific location matching, Hafiz-e-Quran bonus additions, and a floating Roman Urdu AI Web Guide.
Includes top public and private universities across all provinces and regions of Pakistan:
- Federal / ICT: NUST Islamabad, COMSATS, PIEAS, Air University, Bahria University.
- Punjab: LUMS, UET Lahore, Punjab University (PU), FAST Lahore.
- Sindh: NED Karachi, IBA Karachi, Aga Khan University (AKU), Mehran UET.
- Khyber Pakhtunkhwa (KPK): GIKI Swabi, UET Peshawar, IMSciences.
- Balochistan: BUITEMS Quetta, University of Balochistan.
- Azad Jammu & Kashmir (AJK): MUST Mirpur.
- Gilgit-Baltistan: Karakoram International University (KIU Gilgit).
- Province Selection: Punjab, Sindh, KPK, Balochistan, Federal/ICT, AJK, and Gilgit-Baltistan.
- Complete Cities List: Dynamic province-based dropdown listing all cities for every province in Pakistan.
- Nationwide Comparison: Match provincial quota seats while still comparing merit cutoffs nationwide.
Powered by an in-app Manager-Worker Agent Framework (src/lib/manager-agent.ts):
+--------------------------------+
| High-Level Manager Agent |
| (Orchestrator & Synthesizer)|
+--------------------------------+
|
+------------------------+------------------------+
| | |
v v v
+------------------+ +------------------+ +------------------+
| LocationAgent | | MeritAgent | | StrategyAgent |
| (Province/City | | (Formulas, | | (Admission Odds, |
| Matching & | | Aggregates & | | Portfolio |
| Local Quotas) | | Hafiz Bonus) | | Recommendations)|
+------------------+ +------------------+ +------------------+
- Floating AI Assistant with smooth cubic-bezier popup cards.
- Understands and communicates fluently in Roman Urdu (e.g. "NUST ke liye kitne marks chahiye?") or English.
- Automatically calculates the standard Pakistani admission criteria bonus of +20 marks (β +2% aggregate boost).
- No Login Required: Students enter credentials directly without creating accounts.
- Dark Mode Support π: Toggleable dark mode theme that inverts the UI perfectly for late-night merit checking.
- Smart Alternative Suggestions π‘: If a selected university is out of reach ("Unlikely"), the engine automatically scans all 80+ universities and suggests alternatives where the student has a Safe or Likely chance!
- Reset Form: One-click π Reset Form button clears all previous marks and resets state instantly.
- Interactive User Feedback: Built-in review system allowing users to rate the platform out of 10 and leave text reviews, visible on a "Recent Reviews" board.
- Rate Limiting: In-memory sliding window rate limiters protect all API endpoints (
/api/calculate,/api/agent,/api/feedback,/api/advisor). - HTTP Security Headers: Strict CSP, X-Frame-Options, and X-Content-Type-Options configured.
- 100% Zero-Downtime Fallback: Automatic fallback to static seed data if PostgreSQL is offline, ensuring zero runtime crashes.
| Component | Technology |
|---|---|
| Framework | Next.js 16 (App Router) + React 19 |
| Language | TypeScript (Strict Type Checking) |
| Styling | Tailwind CSS v4 + Vanilla CSS animations |
| Database | Drizzle ORM + PostgreSQL (with fallback) |
| AI API | Google Gemini 2.5 Flash API + Custom Multi-Agent Manager |
| Data Viz | Recharts |
| Validation | Zod Schema Validation |
ai-university-merit-predictor/
βββ public/
β βββ readme_hero_preview.png # Preview screenshot
βββ src/
β βββ app/
β β βββ api/
β β β βββ advisor/route.ts # AI Advisor route
β β β βββ agent/route.ts # Multi-Agent Manager route
β β β βββ calculate/route.ts # Merit Calculation engine route
β β β βββ seed/route.ts # Protected Database seed route
β β β βββ universities/route.ts # Universities API route
β β βββ globals.css # Custom animations & styles
β β βββ layout.tsx # Main layout
β β βββ page.tsx # Homepage
β βββ components/
β β βββ AIGuideAssistant.tsx # Floating Roman Urdu AI Agent
β β βββ CalculatorApp.tsx # Main Step Calculator component
β β βββ ResultsDashboard.tsx # Interactive Merit Results dashboard
β β βββ StepWizard.tsx # Interactive Step navigation header
β βββ db/
β β βββ index.ts # Database connection
β β βββ schema.ts # Drizzle ORM schema
β βββ lib/
β βββ advisor.ts # Local Advisor heuristics engine
β βββ agent-orchestrator.ts # Worker Agent tools & intent parser
β βββ calculator.ts # Aggregate math & likelihood algorithms
β βββ cities.ts # All-Pakistan Cities per province dataset
β βββ gemini.ts # Google Gemini API client
β βββ manager-agent.ts # High-Level Multi-Agent Manager
β βββ rate-limit.ts # Sliding-window rate limiter
β βββ seed-data.ts # All-Pakistan Universities seed data
βββ .env.example # Environment variable template
βββ .gitignore # Git ignore rules (Secured)
βββ next.config.ts # Next.js security headers & Turbopack config
βββ package.json # Project dependencies
βββ README.md # Documentation
- Node.js: v18.0 or higher
- npm or yarn / pnpm
git clone https://github.com/Muhammad08-dot/ai_university_merit_predictor.git
cd ai_university_merit_predictornpm installCreate a .env file in the root directory (you can copy .env.example):
cp .env.example .envAdd your credentials to .env:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/university_merit_db"
GEMINI_API_KEY="your-google-gemini-api-key"
SEED_SECRET="your-optional-seed-secret"npm run devOpen http://localhost:3000 in your browser to view the application!
The predictor categorizes student admission odds into 5 transparent tiers:
- π’ Safe: Aggregate is +8% or higher above typical cutoff.
- π΅ Likely: Aggregate is +3% to +7.9% above typical cutoff.
- π‘ Borderline: Aggregate is -2% to +2.9% around typical cutoff.
- π Reach: Aggregate is -8% to -2.1% below typical cutoff.
- π΄ Unlikely: Aggregate is more than -8% below typical cutoff.
This project is open source and available under the MIT License.



