Nyaya is a lightweight legal assistant demo with:
- A Go backend that performs retrieval over IPC sections and judgments
- A React + Vite frontend to submit queries and display grounded answers
backend-go- RAG-style retrieval API (/health,/api/retrieve,/api/ingest)client- web UI for querying the backend
- Go 1.24+
- Node.js 20+
- npm 10+
cd backend-go
go run ./cmd/serverDefaults:
PORT=5000NYAYA_DATA_DIR=./data
Open a new terminal:
cd client
npm install
npm run devVite dev server usually runs at http://localhost:5173 and proxies API requests to backend port 5000.
GET /health- service health and index statsPOST /api/retrieve- retrieve answer for queryPOST /api/ingest- reload corpus files and rebuild in-memory index
Sample retrieve request:
{
"query": "difference between culpable homicide and murder",
"topK": 3
}Backend loads corpus from:
backend-go/data/ipcbackend-go/data/judgments
Supported file types: .txt, .md, .json.
cd client
npm run build