MediInsight AI is a full-stack healthcare GenAI application built with React, TypeScript, Node.js, Groq, and a local retrieval pipeline. It combines multimodal imaging support, wellness planning, appointment intake, mental wellness chat, and document question answering into one interview-ready product.
- Frontend: https://frontend-black-rho-86.vercel.app
- Backend: https://backend-gilt-iota-74.vercel.app
- Backend health check: https://backend-gilt-iota-74.vercel.app/api/test
The application is designed to feel like a real product rather than a basic API demo:
- Groq powers every LLM-backed response in the backend.
- A local RAG pipeline ingests PDF and TXT documents, chunks them, generates lightweight local embeddings, and retrieves relevant context for grounded answers.
- The frontend exposes clean healthcare workflows with environment-driven API configuration.
- The backend is modularized into controllers, services, routes, and RAG-specific logic for easier maintenance and extension.
- AI-assisted X-ray and imaging analysis powered by Groq vision inference
- Personalized diet and sleep plan generation powered by Groq text inference
- Mental wellness support chat with contextual conversation history
- Document QA page for uploading files and asking grounded questions
- Retrieval-augmented generation with local chunk search and citations
- Appointment intake workflow for care coordination demos
- Frontend: React, TypeScript, React Router, Tailwind CSS
- Backend: Node.js, Express, Multer
- LLM Inference: Groq
- RAG: Local text extraction, chunking, hashed embeddings, local vector persistence
- Utilities: pdf-parse, pdf-img-convert, Lucide React
graph TD
A[React Frontend] -->|HTTP requests| B[Express API]
B --> C[Groq Text Models]
B --> D[Groq Vision Model]
B --> E[Local RAG Pipeline]
E --> F[Persisted Vector Index JSON]
The document QA feature uses a local retrieval pipeline:
- A user uploads a PDF or TXT file to
POST /api/rag/upload - The backend extracts text from the document
- The text is chunked into overlapping passages
- Each chunk is converted into a lightweight local embedding
- Chunks and embeddings are stored in a local persisted vector index at
healthcare-plus/backend/data/rag-index.json - The user asks a question through
POST /api/rag/query - The backend embeds the question, retrieves the most relevant chunks locally, and sends only the grounded context plus the question to Groq
- The backend returns the final answer along with chunk citations and file names
healthcare-plus/backend/
├── index.js
├── .env.example
├── package.json
└── src/
├── config/
├── controllers/
├── middleware/
├── rag/
├── routes/
├── services/
└── utils/
The backend supports loading .env from either:
healthcare-plus/backend/.env- the repo root
.env
Required:
GROQ_API_KEY
Optional:
PORTdefault:3001GROQ_TEXT_MODELdefault:llama-3.3-70b-versatileGROQ_VISION_MODELdefault:meta-llama/llama-4-scout-17b-16e-instructREACT_APP_API_BASE_URLfor the frontend, default:http://localhost:3001/api
Example backend .env:
GROQ_API_KEY=your_groq_api_key
PORT=3001
GROQ_TEXT_MODEL=llama-3.3-70b-versatile
GROQ_VISION_MODEL=meta-llama/llama-4-scout-17b-16e-instruct- Node.js 18, 20, or 22
- npm
- A Groq API key
Note: Node 25.x is not recommended in this repo because the PDF-to-image dependency used by the imaging workflow is not compatible with it in this environment.
Backend:
cd healthcare-plus/backend
npm installFrontend:
cd healthcare-plus/frontend
npm installCreate one of the supported .env files and set GROQ_API_KEY.
cd healthcare-plus/backend
npm run devcd healthcare-plus/frontend
npm startFrontend runs on http://localhost:3000 by default and targets http://localhost:3001/api unless REACT_APP_API_BASE_URL is overridden.
| Endpoint | Method | Description |
|---|---|---|
/api/test |
GET |
Basic backend and Groq connectivity check |
/api/analyze-image |
POST |
Analyze uploaded image or PDF imaging study |
/api/health-plans |
POST |
Generate a wellness plan |
/api/mental-health-chat |
POST |
Get a mental wellness assistant response |
/api/rag/upload |
POST |
Upload and index a PDF or TXT file |
/api/rag/query |
POST |
Ask grounded questions against indexed documents |
Legacy compatibility:
/api/HealthPlansremains available as an alias for/api/health-plans
/home page/xray-diagnosisimaging workflow/health-planswellness plan generator/appointmentsappointment intake flow/mental-healthwellness chat/document-qadocument question answering with citations/services,/about,/contact,/privacy
Groq is used for all AI features:
- Imaging analysis uses Groq vision inference in the backend service layer
- Wellness plan generation uses Groq text inference
- Mental wellness chat uses Groq text inference with short-lived in-memory conversation history
- RAG answers use Groq text inference after local retrieval selects the relevant context
The Groq integration lives in:
healthcare-plus/backend/src/services/groqClient.jshealthcare-plus/backend/src/services/groqService.js
- Start backend and frontend
- Open the app in the browser
- Test wellness plan generation on
/health-plans - Test mental wellness chat on
/mental-health - Test document QA on
/document-qa
- Upload a PDF or TXT file in the Document QA page
- Confirm the success message reports indexed chunks
- Ask a question clearly answered in the uploaded file
- Verify the response includes an answer and matching citations
curl http://localhost:3001/api/testcurl -X POST http://localhost:3001/api/rag/query \
-H "Content-Type: application/json" \
-d '{"question":"What does the document recommend?"}'- Replaced legacy provider-specific inference setup with Groq-backed services
- Modularized the backend into maintainable layers
- Added centralized error handling and async route wrappers
- Added environment-aware config loading
- Removed hardcoded frontend API URLs
- Added a grounded document QA workflow with persisted local retrieval state
- Removed unused frontend server stubs and dead route files
- The local vector store uses a lightweight embedding strategy so the entire stack runs locally without paid vector infrastructure.
- Indexed chunks are persisted to disk for local reuse across backend restarts.
- The appointment flow remains a polished frontend demo and does not persist data to a database.
Created by Ayan113
