- โ
backend/services/cerebrasService.js- Medical image analysis + TB detection - โ
backend/services/llamaService.js- Symptom checker + maternal health - โ
backend/server.js- Main server with all endpoints โ ๏ธ backend/.env- YOU NEED TO CREATE THIS
- โ
frontend/app/components/Header.tsx- Navigation header - โ
frontend/app/components/MedicalImageAnalysis.tsx- Feature 1 - โ
frontend/app/components/MaternalHealth.tsx- Feature 2 - โ
frontend/app/components/TBDetection.tsx- Feature 3 - โ
frontend/app/components/SymptomChecker.tsx- Feature 4 - โ
frontend/app/components/Dashboard.tsx- Feature 5 - โ
frontend/app/page.tsx- Main page combining all components
medai-swasthya/
โโโ backend/
โ โโโ services/
โ โ โโโ cerebrasService.js โ
COPY THIS
โ โ โโโ llamaService.js โ
COPY THIS
โ โโโ server.js โ
COPY THIS
โ โโโ .env โ ๏ธ CREATE THIS
โ โโโ package.json โ
MODIFY THIS
โ
โโโ frontend/
โโโ app/
โ โโโ components/
โ โ โโโ Header.tsx โ
COPY THIS
โ โ โโโ MedicalImageAnalysis.tsx โ
COPY THIS
โ โ โโโ MaternalHealth.tsx โ
COPY THIS
โ โ โโโ TBDetection.tsx โ
COPY THIS
โ โ โโโ SymptomChecker.tsx โ
COPY THIS
โ โ โโโ Dashboard.tsx โ
COPY THIS
โ โโโ page.tsx โ
COPY THIS
โ โโโ layout.tsx (Next.js default - DON'T TOUCH)
โ โโโ globals.css (Next.js default - DON'T TOUCH)
โโโ package.json โ
ALREADY GOOD
cd backendCreate .env file with this content:
CEREBRAS_API_KEY=your_cerebras_api_key_here
HUGGINGFACE_API_KEY=your_huggingface_api_key_here
PORT=3001
NODE_ENV=developmentGet API Keys:
- Cerebras: https://cerebras.ai/ โ Sign Up โ API Keys
- Hugging Face: https://huggingface.co/ โ Settings โ Access Tokens
cd backend
# Install all required packages
npm install express cors dotenv ws multer axios sharp nodemon
npm install @cerebras/cerebras_cloud_sdk
npm install @huggingface/inferenceCopy these 3 files into your backend/ folder:
services/cerebrasService.jsservices/llamaService.jsserver.js
Make sure folder structure is correct:
backend/
โโโ services/
โ โโโ cerebrasService.js
โ โโโ llamaService.js
โโโ server.js
โโโ .env
โโโ package.json
cd backend
npm run devExpected Output:
๐ ============================================
๐ OpenAccess Server Started!
๐ ============================================
๐ก HTTP Server: http://localhost:3001
๐ WebSocket: ws://localhost:3001
๐ฅ Health: http://localhost:3001/health
โ
Cerebras API configured
โ
Hugging Face API configured
โ
Server ready to accept requests!
โ Test Backend: Open browser: http://localhost:3001/health
cd frontend
# Create components directory
mkdir -p app/componentsCopy these 7 files into your frontend/app/ folder:
Components (in app/components/):
Header.tsxMedicalImageAnalysis.tsxMaternalHealth.tsxTBDetection.tsxSymptomChecker.tsxDashboard.tsx
Main Page (in app/):
7. page.tsx
Your structure should look like:
frontend/
โโโ app/
โ โโโ components/
โ โ โโโ Header.tsx
โ โ โโโ MedicalImageAnalysis.tsx
โ โ โโโ MaternalHealth.tsx
โ โ โโโ TBDetection.tsx
โ โ โโโ SymptomChecker.tsx
โ โ โโโ Dashboard.tsx
โ โโโ page.tsx
โ โโโ layout.tsx (already exists)
โ โโโ globals.css (already exists)
cd frontend
npm installAll required packages (lucide-react, tailwindcss, etc.) are already in package.json.
Open NEW TERMINAL (keep backend running):
cd frontend
npm run devExpected Output:
โฒ Next.js 14.x.x
- Local: http://localhost:3000
โ Ready in 2.3s
Open browser: http://localhost:3000
You should see the OpenAccess platform with 5 tabs!
1. Medical Image Analysis Tab
- Upload any medical image
- Select image type (X-Ray/CT/MRI)
- Click "Analyze Image"
- See results in 2-3 seconds
2. Maternal Health Tab
- Enter test vital signs
- Click "Assess Maternal Health Risk"
- See risk assessment with recommendations
3. TB Detection Tab
- Upload chest X-ray
- Click "Detect Tuberculosis"
- See TB detection results
4. Symptom Checker Tab
- Select language (English/Hindi/etc.)
- Type symptoms
- Click "Get AI Diagnosis"
- See differential diagnosis
5. Dashboard Tab
- View automatically on load
- See disease distribution chart
- See regional analysis
- See outbreak predictions
# Check if .env file exists and has correct format
cat backend/.env
# Should have no quotes around values:
# CORRECT: CEREBRAS_API_KEY=csk-abc123
# WRONG: CEREBRAS_API_KEY="csk-abc123"# Make sure all files are in correct folders
ls frontend/app/components/
# Should show: Header.tsx, MedicalImageAnalysis.tsx, etc.
ls frontend/app/
# Should show: page.tsx, layout.tsx, globals.css, components/# Reinstall dependencies
cd backend && npm install
cd ../frontend && npm install# Kill the process
lsof -i :3001 # Mac/Linux
kill -9 <PID>
# Or change port in backend/.env
PORT=3002-
backend/services/cerebrasService.js -
backend/services/llamaService.js -
backend/server.js -
backend/.env(create new with your API keys)
-
frontend/app/components/Header.tsx -
frontend/app/components/MedicalImageAnalysis.tsx -
frontend/app/components/MaternalHealth.tsx -
frontend/app/components/TBDetection.tsx -
frontend/app/components/SymptomChecker.tsx -
frontend/app/components/Dashboard.tsx -
frontend/app/page.tsx
# Terminal 1 - Backend
cd backend
npm run dev
# Terminal 2 - Frontend
cd frontend
npm run dev
# Browser
http://localhost:3000 - Frontend
http://localhost:3001/health - Backend health check- โ See "OpenAccess Server Started!" message
- โ Both API keys show as "configured"
- โ http://localhost:3001/health returns JSON
- โ See "Ready in X seconds" message
- โ http://localhost:3000 loads without errors
- โ Can see 5 navigation tabs
- โ All tabs switch correctly
- โ Can upload images and get analysis
- โ Can enter vital signs and get risk assessment
- โ Can detect TB from X-rays
- โ Can get symptom diagnosis in multiple languages
- โ Can view dashboard analytics
If all checkboxes above are โ , you have a COMPLETE, WORKING OpenAccess platform!
- โ 5 complete features working
- โ Clean, modular code structure
- โ Professional UI with all components
- โ Real AI integrations (Cerebras + Llama)
- โ Production-ready architecture
- โ Complete error handling
- โ Beautiful, accessible interface
- Test all features thoroughly
- Take screenshots of each feature
- Record 3-minute demo video
- Push to GitHub
- Submit for hackathon!
# Check backend is running
curl http://localhost:3001/health
# Check frontend is running
curl http://localhost:3000
# Check Node version (should be 16+)
node --version
# Check if ports are available
lsof -i :3000 # Frontend
lsof -i :3001 # BackendYou now have a complete, production-ready healthcare AI platform with:
- โ Modular, maintainable code structure
- โ All 5 features fully functional
- โ Clean separation of concerns
- โ Easy to debug and extend
- โ Professional quality code
๐
Built with โค๏ธ for accessible healthcare in India ๐ฎ๐ณ