BarristerBot is a Generative AI-based legal chatbot designed to provide personalized legal advice and solutions according to Pakistani law. The system leverages Retrieval-Augmented Generation (RAG) and Large Language Models (LLMs) to deliver accessible, accurate, and context-aware legal guidance.
You can read the full thesis for this project here: 📄 BarristerBot Thesis (PDF)
📂 Dataset: Pakistan Law Data (Kaggle)
📑 Source of Laws: Ministry of Law and Justice, Pakistan
🔗 Live Demo: barrister-bot.vercel.app
Please note:
- Some features may not work currently due to expired APIs or third-party service limits.
- For full functionality, you can run the project locally (see instructions below).
-🧑⚖ Provides legal advice and answers based on Pakistani law
- 📚 Uses Retrieval-Augmented Generation (RAG) for reliable information retrieval
- 🎙️ Voice-to-text support for interactive communication
- 🔒 PII masking to protect user privacy
- 🔑 Secure authentication with JWT and Google Social Login
- 💾 Conversation history management with Hasura + GraphQL
- 🌐 Fully deployed on Vercel for seamless accessibility
System Architecture of BarristerBot
- Frontend: Next.js (TypeScript)
- Backend: Next.js server components
- LLM: Mistral 8x7B
- Embeddings & RAG Pipeline: LlamaIndex + Together.ai embeddings
- Vector Database: Chroma DB
- Data Management: Hasura + GraphQL
- PII Masking: BERT-based model
- Voice Integration: Google Speech-to-Text
- Authentication: JWT-based + Google Social Login
- Deployment: Vercel
The dataset powering BarristerBot consists of Pakistani legal documents extracted from the official Ministry of Law and Justice website.
- Processed and curated dataset available on Kaggle:
👉 Pakistan Law Data
Figure 2: Secure JWT-based login with Google authentication.
Figure 3: Dark theme interface for better accessibility and comfort.
Figure 4: Voice-enabled legal consultation powered by Google Speech-to-Text.
git clone https://github.com/yourusername/barristerbot.git
cd barristerbotnpm installCreate a .env.local file in the root directory and add:
NEXT_PUBLIC_HASURA_GRAPHQL_URL=your_hasura_url
NEXT_PUBLIC_CHROMADB_URL=your_chroma_db_url
NEXT_PUBLIC_TOGETHER_API_KEY=your_together_ai_api_key
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_google_client_id
NEXT_PUBLIC_GOOGLE_CLIENT_SECRET=your_google_client_secret
JWT_SECRET=your_jwt_secretnpm run devApp will be available at: [(http://localhost:3000/)]
- Expansion of dataset with more legal resources
- Integration with Urdu NLP models for bilingual support
- Improved UI/UX for better accessibility
- Advanced analytics for case tracking and recommendations
This project is licensed under the MIT License – feel free to use, modify, and distribute.
