Making justice accessible through AI β one document at a time.
π Live Application: https://nyaay-ai-taupe.vercel.app
π API Documentation: https://nyaayai-tptx.onrender.com/docs
π Backend API: https://nyaayai-tptx.onrender.com
NyaayAI is an AI-powered legal aid platform designed to help citizens understand legal documents without requiring expensive legal consultation.
Users can upload legal documents such as:
- FIRs
- Court Summons
- Legal Notices
- Tax Notices
- Eviction Notices
- Contracts
- Government Communications
- Scanned Legal Documents
The platform automatically analyzes the uploaded document and provides:
β
Plain-language explanation
β
Important clauses and obligations
β
Fraud/Fake notice detection with risk scoring
β
Legal rights and protections
β
Recommended next steps
β
AI-generated reply drafts
β
Legal aid and helpline recommendations
β
Multi-language support
NyaayAI aims to bridge the legal knowledge gap by making legal information understandable and accessible to everyone.
- Upload PDF, image, or scanned legal documents
- OCR-powered text extraction
- AI-driven clause extraction
- Important dates and deadlines detection
- Obligation and penalty identification
- Legal risk assessment
The platform evaluates uploaded notices and identifies potential indicators of:
- Fake legal notices
- Scam communications
- Fraudulent demands
- Suspicious legal threats
Each analysis includes:
- Fraud probability score
- Risk explanation
- Verification recommendations
The AI provides:
- Simplified explanation of legal language
- Citizen-friendly summaries
- Rights and protections applicable to the document
- Suggested actions to take
- Potential legal concerns
Generate professional responses for:
- Legal notices
- Government notices
- Tax communications
- Consumer complaints
- Civil disputes
The generated drafts can be reviewed and modified before use.
Supported Languages:
- English
- Hindi
- Marathi
- Tamil
- Telugu
- Bengali
- Gujarati
Language detection and translation are handled automatically.
Based on case type and user location, NyaayAI can recommend:
- Government legal aid services
- Consumer helplines
- Women's helplines
- Cybercrime reporting channels
- Legal assistance resources
- JWT Authentication
- Password Hashing (bcrypt)
- OAuth2 Password Flow
- Protected User Dashboard
Users can:
- View previous analyses
- Re-open documents
- Re-analyze documents
- Download reports
- Track case history
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Browser β
βββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js Frontend β
β React + TypeScript + Tailwind CSS β
βββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β HTTPS / REST
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI Backend β
β Authentication β’ Analysis β’ OCR β’ AI β
βββββββββ¬ββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββ βββββββββββββββββββββββββββββββββ
β SQLite / β β Groq API (LLaMA 3 70B) β
β PostgreSQL β β OpenAI (Optional Fallback) β
βββββββββββββββββ β Claude (Optional Fallback) β
βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββ
β OCR Services β
β Tesseract β
β EasyOCR β
β PyMuPDF β
βββββββββββββββββββββ
- Next.js 14 (App Router)
- React
- TypeScript
- Tailwind CSS
- Lucide React
- Python 3.13
- FastAPI
- SQLAlchemy
- SQLite
- PostgreSQL (Production Ready)
- Pydantic
- Pydantic Settings
- Groq API (LLaMA 3 70B)
- OpenAI GPT-4o (Optional)
- Anthropic Claude (Optional)
- PyMuPDF
- Pytesseract
- EasyOCR
- pdf2image
- Pillow
- Google Cloud Vision (Optional)
- spaCy
- LangDetect
- JWT Tokens
- python-jose
- Passlib (bcrypt)
- OAuth2
| Service | Platform |
|---|---|
| Frontend | Vercel |
| Backend | Render |
| Database | SQLite / PostgreSQL |
NyaayAI/
βββ backend/
β βββ app/
β β βββ api/
β β β βββ auth.py
β β β βββ routes.py
β β β βββ deps.py
β β β
β β βββ core/
β β β βββ config.py
β β β βββ security.py
β β β
β β βββ db/
β β β βββ database.py
β β β βββ crud.py
β β β
β β βββ models/
β β β βββ db_models.py
β β β βββ user_models.py
β β β βββ schemas.py
β β β
β β βββ services/
β β β βββ llm_service.py
β β β βββ ocr_service.py
β β β βββ fraud_service.py
β β β βββ guidance_service.py
β β β βββ legal_aid_service.py
β β β βββ translation_service.py
β β β βββ resource_service.py
β β β βββ pipeline.py
β β β
β β βββ main.py
β β
β βββ requirements.txt
β βββ .env
β
βββ frontend/
βββ src/
β βββ app/
β βββ components/
β βββ context/
β βββ lib/
β βββ types/
β
βββ package.json
βββ next.config.js
βββ .env.local
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health Check |
| POST | /auth/register |
Register User |
| POST | /auth/login |
Login User |
| GET | /auth/me |
Current User |
| POST | /analyze-document |
Upload & Analyze Document |
| POST | /case-assistant |
Ask Questions About Case |
| GET | /support/options |
Legal Aid Resources |
| POST | /analysis/translate |
Translate Analysis |
| GET | /health |
API Health Status |
- Python 3.10+
- Node.js 18+
- Tesseract OCR
- Groq API Key
cd backend
python -m venv venv
# Windows
venv\Scripts\activate
# Linux / Mac
source venv/bin/activate
pip install -r requirements.txt
python -m spacy download en_core_web_smCreate .env
GROQ_API_KEY=gsk_your_key_here
SECRET_KEY=change-this-in-production
DATABASE_URL=sqlite:///./nyaay_ai.db
LLM_PROVIDER=groqRun Backend:
uvicorn app.main:app --reload --port 8000Backend:
http://localhost:8000
Swagger Docs:
http://localhost:8000/docs
cd frontend
npm installCreate .env.local
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_USE_MOCK=falseRun:
npm run devFrontend:
http://localhost:3000
| Setting | Value |
|---|---|
| Root Directory | backend |
| Build Command | pip install -r requirements.txt |
| Start Command | uvicorn app.main:app --host 0.0.0.0 --port $PORT |
Environment Variables:
GROQ_API_KEY=your_key
SECRET_KEY=your_secret
DATABASE_URL=sqlite:///./nyaay_ai.db| Setting | Value |
|---|---|
| Framework | Next.js |
| Root Directory | frontend |
Environment Variables:
NEXT_PUBLIC_API_URL=https://nyaayai-tptx.onrender.com
NEXT_PUBLIC_USE_MOCK=falseGROQ_API_KEY=gsk_...
SECRET_KEY=...
DATABASE_URL=sqlite:///./nyaay_ai.db
LLM_PROVIDER=groqNEXT_PUBLIC_API_URL=https://nyaayai-tptx.onrender.com
NEXT_PUBLIC_USE_MOCK=false| Problem | Solution |
|---|---|
| Failed to fetch | Backend may be sleeping on Render free tier |
| CORS error | Add frontend URL to allow_origins |
| Database error | Verify DATABASE_URL |
| OCR not working | Ensure Tesseract is installed |
| Vercel build fails | Confirm frontend root directory |
| Groq errors | Verify GROQ_API_KEY |
- Voice-based legal assistance
- AI legal chatbot for follow-up questions
- Lawyer referral network
- Case tracking dashboard
- PDF report export
- WhatsApp integration
- Regional language expansion
- PostgreSQL migration with Alembic
- Mobile application (Android & iOS)
Millions of people struggle to understand legal notices, government communications, and court documents.
NyaayAI aims to make legal information understandable, accessible, and actionable for everyone through responsible AI.
Justice should not depend on whether someone can afford a lawyer.
FastAPI β’ Next.js β’ Groq LLaMA β’ OCR β’ SQLAlchemy β’ Tailwind CSS β’ JWT Authentication
This project is licensed under the MIT License.