|
Next.js 16 App Router + Turbopack |
TypeScript 5 Type Safety |
Tailwind CSS 4 Modern Styling |
React 19 UI Library |
|
Gemini 2.0 Flash AI Analysis Engine |
Gemini Live API Kore Voice (Urdu) |
WebSocket + Web Audio Real-time Communication |
|
Vercel Serverless Deploy |
Git Version Control |
ESLint Code Quality |
npm Package Manager |
π Prerequisites
β
Node.js 18+ (Download from nodejs.org)
β
npm or yarn package manager
β
Google Gemini API Key (Free at aistudio.google.com/app/apikey)
β
Git installedβ‘ Quick Installation
git clone https://github.com/Ahmed-KHI/pakistan-court-case-predictor.git
cd pakistan-court-case-predictornpm install# Copy .env.example to .env.local
cp .env.example .env.local
# Edit .env.local and add your Gemini API key
NEXT_PUBLIC_GEMINI_API_KEY=your_api_key_herenpm run devπ http://localhost:3000ποΈ Build for Production
# Create optimized production build
npm run build
# Start production server
npm startnpm install
cp .env.example .env.local
npm run dev
Open [http://localhost:3000](http://localhost:3000) in your browser.
---
## π― Usage Guide
<table>
<tr>
<td width="50%">
### ποΈ Voice Mode (Urdu)
1. **Click** "Start Voice Conversation" ποΈ
2. **Grant** microphone permission
3. **Hear** greeting in Urdu: "Ψ§ΩΨ³ΩΨ§Ω
ΨΉΩΫΪ©Ω
"
4. **Answer** 10 questions naturally:
- Ψ’ΩΎ Ϊ©Ψ§ ΩΨ§Ω
Ψ (Your name?)
- ΨΉΩ
Ψ±Ψ (Age?)
- Ϊ©ΫΨ³ Ϊ©Ϋ ΩΨ³Ω
Ψ (Case type?)
- ΨͺΩΨ΅ΫΩΨ (Description?)
- And more...
5. **Receive** instant AI prediction
**Benefits:**
- β
Natural conversation flow
- β
Authentic Pakistani accent
- β
No typing required
- β
Perfect for illiterate users
</td>
<td width="50%">
### β¨οΈ Manual Mode (Text)
1. **Fill** case details form:
- Name, Age, Location
- Case Type (Criminal/Civil/Property)
- Description, Evidence
- Financial Status
2. **Click** "Analyze Case" π
3. **View** comprehensive results:
- Outcome prediction
- Cost estimation
- Timeline forecast
- Risk assessment
4. **Toggle** Urdu translation π
**Benefits:**
- β
Detailed input control
- β
Review before submission
- β
Edit anytime
- β
Bilingual support
</td>
</tr>
</table>
---
## π οΈ Tech Stack
| Category | Technologies |
|----------|-------------|
| **Framework** | Next.js 16, React 19, TypeScript 5 |
| **Styling** | Tailwind CSS 4 |
| **AI/ML** | Google Gemini 2.0 Flash Exp |
| **Voice** | Gemini Live WebSocket API (Kore voice) |
| **Speech** | Web Speech API (ur-PK) |
| **Deployment** | Vercel |
---
## π Deployment
### Deploy to Vercel
<div align="center">
[](https://vercel.com/new/clone?repository-url=https://github.com/Ahmed-KHI/pakistan-court-case-predictor&env=NEXT_PUBLIC_GEMINI_API_KEY)
</div>
**Manual Steps:**
1. Push code to GitHub
2. Import project in [Vercel](https://vercel.com/new)
3. Add environment variable: `NEXT_PUBLIC_GEMINI_API_KEY`
4. Deploy π
### Build for Production
```bash
npm run build
npm start
pakistan-court-case-predictor/
β
βββ π app/
β βββ π api/
β β βββ π predict/route.ts # AI case analysis endpoint
β β βββ π translate/route.ts # Urdu translation endpoint
β β βββ π voice/route.ts # Voice processing endpoint
β βββ π layout.tsx # Root layout with metadata
β βββ π page.tsx # Home page component
β βββ π globals.css # Global styles
β
βββ π components/
β βββ π ConversationalVoice.tsx # Voice assistant with Gemini Live
β βββ π PredictionDisplay.tsx # AI prediction results UI
β βββ π ui/
β βββ π card.tsx # Card components
β βββ π button.tsx # Button components
β βββ π badge.tsx # Badge components
β
βββ π lib/
β βββ π gemini.ts # Gemini API client
β βββ π utils.ts # Utility functions
β βββ π legal-data/
β βββ π pakistan-laws.ts # Pakistani law database
β
βββ π docs/
β βββ π index.html # GitHub Pages site
β
βββ π .env.local # Environment variables (create this)
βββ π .env.example # Environment template
βββ π vercel.json # Vercel deployment config
βββ π README.md # This file
βββ π LICENSE # MIT LicenseHow to Contribute:
- π΄ Fork the repository
- πΏ Create feature branch:
git checkout -b feature/AmazingFeature - πΎ Commit changes:
git commit -m 'Add: AmazingFeature' - π€ Push to branch:
git push origin feature/AmazingFeature - π Open Pull Request
Contribution Ideas:
- π Bug fixes and improvements
- β¨ New features (e.g., more case types, additional languages)
- π Documentation improvements
- π¨ UI/UX enhancements
- π§ͺ Test coverage
MIT License Β© 2025 Muhammad Ahmed
This project is free and open-source software licensed under the MIT License.
See the LICENSE file for full details.
Special Thanks To:
ποΈ Governor House Karachi IT Initiative
For providing the platform and inspiration
π€ Google Gemini Team
For the powerful AI technology
π΅π° Pakistan Tech Community
For continuous support and feedback
βοΈ Legal Experts
For guidance on Pakistani law implementation
- β Voice input in Urdu with Pakistani accent
- β AI-powered case prediction
- β Bilingual interface (English + Urdu)
- β Cost estimation in PKR
- β Risk assessment system
- π Mobile app (React Native)
- π More languages support (Punjabi, Sindhi, Pashto)
- π Integration with court databases
- π Lawyer matching system
- π Document generation (case filing templates)
- π Chat support with legal AI assistant
Important: This tool provides AI-generated predictions for educational purposes only. It should NOT be considered as professional legal advice. Always consult with a qualified lawyer for actual legal matters. The predictions are based on AI analysis and may not reflect actual court outcomes.
If you find this project helpful, please consider:
β Starring this repository
π΄ Forking to contribute
π Reporting issues
π’ Sharing with others
β Supporting development

