Unified digital rails for patients, clinicians, and hospital desksβbuilt for Indiaβs urban density and rural reach.
- Frontend:
Frontend/ - Backend:
backend/ - AI Service:
ai-implemen/ai-service/
# Frontend
cd Frontend
npm install
npm run dev # http://localhost:3000
# Backend
cd backend
npm install
npm run dev # http://localhost:5000
# AI Service
cd ai-implemen/ai-service
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000- Build a single βSetuβ that coordinates care across patients, clinicians, and frontβdesk staff.
- Reduce queueing, lost paper prescriptions, and disconnected records.
- Deliver AIβpowered prescription literacy and triage without compromising safety.
- Urbanβrural gap: Access deserts persist due to doctor concentration in cities.
- Fragmented records: Patients carry paper files that are easy to lose.
- Manual front desks: Walkβins, bed assignment, and billing donβt scale.
- Prescription opacity: Patients struggle to decode handwritten instructions.
- AI adoption gap: Digital health rails exist, but hospitalβside intelligence lags.
Swasthya Setu is a triβportal platform backed by a unified API and an AI microservice:
- Next.js 13 Frontend for patients, doctors, and receptionists.
- Express API orchestrating Supabase auth, appointments, and operations.
- FastAPI AI Service for OCR + Gemini summarization and chat.
- Supabase for Postgres, Auth, and Storage.
ββββββββββββββββββββββ βββββββββββββββββββββββ
β Next.js Frontend β β AI Service β
β β’ Patient app β REST β (FastAPI + Gemini) β
β β’ Doctor portal βββββββββ€ β’ OCR + synthesis β
β β’ Receptionist ops β β β’ AI triage chat β
βββββββββββ²βββββββββββ βββββββββββ²ββββββββββββ
β REST / Webhooks β
β β
βββββββββββ΄βββββββββββ ββββββββββββ΄βββββββββββ
β Express API β SQL β Supabase β
β (Node.js + Supabaseβββββββββ€ β’ Auth & row-level β
β client) β β security β
β β’ Auth routes β β β’ Postgres tables β
β β’ Appointments β β β’ Storage buckets β
β β’ Billing & beds β ββββββββββββββββββββββββ
ββββββββββββββββββββββ
| Layer | Stack | Why it fits |
|---|---|---|
| Frontend | Next.js 13 (App Router), TypeScript, Tailwind | Fast UX, strong typing, reusable UI |
| Backend | Node.js (ESM), Express, Supabase JS, Multer | Rapid API development + storage |
| AI Service | FastAPI, Gemini SDK, Pydantic, Pillow | Async inference + schema validation |
| Data | Supabase Postgres + Storage | Managed infra with RLS |
- Unified onboarding with hospital selection.
- Smart appointment booking (15βminute slots, conflict checks).
- Prescription literacy via OCR + AI report synthesis.
- AI triage & OTC guidance with strict guardrails.
- Hospital discovery with geo filters + offline fallback.
- Dashboard snapshot with autoβcompletion of expired appointments.
- Analytics for 30βday volume and unique patients.
- Appointment cockpit + Jitsi links for video visits.
- Prescription workflows with AIβassisted analysis.
- Operational KPIs (walkβins, beds, billing, revenue).
- Walkβin ticketing with sequential tokens.
- Bed & admission control with occupancy tracking.
- Billing with invoice numbering and payment status.
- Prescription OCR Pipeline: image β OCR β structured JSON β patientβfriendly report.
- Guardrails: triage levels, OTCβonly suggestions, emergency escalation.
- Caching: reduces duplicate AI calls for the same input.
Patient_Profile,Doctor_Profile,receptionist_profileappointments,walkin_tickets,admissions,bed_managementinvoices,appointment_requests,notificationsprescriptions,Prescription_Reportshospitals
| Method | Path | Purpose |
|---|---|---|
POST |
/auth/signup/{role} |
Roleβbased registration |
POST |
/auth/signin/{role} |
Roleβbased login |
GET |
/auth/hospitals |
Hospital directory |
POST |
/patient/appointments/book |
Patient booking |
POST |
/patient/prescriptions/save |
Save AI report |
POST |
/chat/send |
AI triage chat |
POST |
/analyze |
OCR + report synthesis |
NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_AI_SERVICE_URL=http://localhost:8000
NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
NEXT_PUBLIC_PAGE_SIZE=20
PORT=5000
LOCAL_URL=http://localhost:5000
SUPABASE_URL=...
SUPABASE_ANON_KEY=...
SUPABASE_SERVICE_ROLE_KEY=...
SUPABASE_PRESCRIPTION_BUCKET=prescriptions
SUPABASE_PRESCRIPTION_TABLE=Prescription_Reports
SUPABASE_HOSPITALS_TABLE=hospitals
AI_SERVICE_URL=http://localhost:8000
GEMINI_API_KEY=...
GEMINI_VISION_MODEL=gemini-2.5-flash
GEMINI_TEXT_MODEL=gemini-2.5-flash
GEMINI_CHAT_MODEL=gemini-2.5-flash
SUPABASE_URL=...
SUPABASE_SERVICE_ROLE_KEY=...
SUPABASE_PRESCRIPTION_BUCKET=prescriptions
npm run lintandnpm run buildfor frontend changes.- Manual smoke tests for backend endpoints.
- AI service health check:
GET /healthzandPOST /analyze.
- Frontend can be hosted on Vercel.
- Backend + AI service can run on container platforms (Railway, Render, ECS, etc.).
- Supabase remains the managed Postgres/Auth/Storage layer.
- FHIR interoperability (ABDM alignment)
- Offlineβfirst PWA support
- Multilingual AI responses
- Advanced analytics & operational forecasting
- NITI Aayog & RMI, βReimagining Healthcare in India through Blended Finance,β 2021.
- ABDM: https://abdm.gov.in/
- eSanjeevani milestone: https://pib.gov.in/PressReleasePage.aspx?PRID=1952423