This repository contains a minimal, modular prototype of JurisAI: a mock-trial system where two parties upload documents, submit arguments, and an AI Judge (via Groq LLM) produces a verdict. The goal is a starting point to iterate toward production.
Requirements: Node 18+, npm, MongoDB running locally (or set MONGODB_URI).
cd server
npm install
# Set up environment variables in .env (see .env.example)
# MONGODB_URI=mongodb://localhost:27017/jurisai
# GROQ_API_KEY=your_groq_api_key
# GROQ_API_URL=https://api.groq.com/openai/v1/chat/completions (check specific endpoint)
npm run devServer will be running on http://localhost:5100.
cd jurisai
npm install
npm run devThe frontend will verify the server connection and allow you to create cases.
server/: Express backend, Mongoose models, Groq client wrapper, API routes.jurisai/: React (Vite + TS) frontend with upload, argument panels, and SSE.
- Create a Case: Enter a title and select a case type (Civil/Criminal) on the home page.
- Upload Documents:
- Upload PDFs, DOCX, or Text files for both Plaintiff and Defense sides.
- The system parses these files and attaches them to the case context.
- Arguments:
- Parties take turns submitting arguments.
- Arguments are stored and broadcasted in real-time.
- AI Verdict:
- Click "Request Verdict" to have the AI Judge analyze the case context, documents, and arguments.
- The AI will generate an Interim Order or Final Judgment based on the stage of the trial.
- Surrender: A party can choose to surrender, effectively ending the trial with a default judgment for the opposing side.
The backend exposes a REST API at http://localhost:5100/api.
Establishes a Server-Sent Events (SSE) connection for real-time updates (case creation, uploads, arguments, verdicts).
Creates a new legal case.
- Body:
{ "title": "Case Title", "type": "civil" } - Returns:
{ "caseId": "...", "title": "...", "type": "..." }
Uploads a document for a specific case and side.
- Body: Form-data with
file(binary),caseId,side(plaintiff/defense),documentName(optional). - Returns:
{ "caseId": "...", "message": "Uploaded and parsed" }
Retrieves full details of a specific case, including metadata, arguments, and past verdicts.
Submits an argument for a specific side.
- Body:
{ "caseId": "...", "side": "plaintiff", "text": "Argument content..." } - Returns: Created argument object.
Requests an AI-generated verdict based on current case state.
- Body:
{ "caseId": "...", "contextNote": "Optional context..." } - Returns:
{ "verdictId": "...", "text": "Verdict content...", "verdictType": "interim/final" }
Formal surrender by one party.
- Body:
{ "caseId": "...", "side": "defense" } - Returns: Verdict object confirming surrender.
- Groq Integration:
server/lib/groqClient.jshandles communication with the Groq API. IfGROQ_API_KEYis not set, the server currently mocks the verdict for local testing. - File Parsing: Uses
pdf-parsefor PDFs andmammothfor DOCX files. - YouTube Demo: Watch the Demo