AI-powered hospital, equipment, ambulance, and patient coordination platform.
Swasth Setu is designed as a connected healthcare operations network, not just a hospital listing product. It helps patients discover care faster, and it helps hospitals manage internal operations and collaborate with other hospitals during shortages, support requests, and emergency situations.
The platform serves two primary sides of the network:
- Patients / public users
- Hospitals / hospital admins
The goal is to connect the full flow:
- patients search hospitals, doctors, facilities, and medical shops
- patients book appointments, raise issues, and request help
- hospitals manage doctors, equipment, ambulances, appointments, and issues
- hospitals collaborate with other hospitals for equipment and support
- AI improves discovery, summarization, and operational decision support
This repository is structured as an MVP-first hackathon codebase, but the architecture is modular enough to scale.
- Hospital discovery by city, state, treatment, specialty, facilities, and availability
- Hospital detail pages with doctors, reviews, ratings, and CTAs
- Appointment booking flow
- Public issue feed and issue creation
- Medical shop discovery
- Map-based hospital and medical shop exploration
- Global search across hospitals, doctors, equipment, and shops
- AI assistant page
- Emergency mode for quick hospital and support recommendations
- Protected hospital admin dashboard
- Doctor, equipment, ambulance, appointment, and issue management
- Hospital network page for cross-hospital equipment search
- Realtime notifications and updates
- Chat support
- Analytics and AI insight sections for dashboard workflows
- Semantic hospital search
- Semantic equipment search
- Semantic medical shop search
- Review summarization
- AI assistant chat
- Emergency interpretation and guidance
- Dashboard insights
- Next.js (App Router)
- TypeScript
- Tailwind CSS
- Framer Motion
- Zustand
- Socket.IO client
- Recharts
- Leaflet / React Leaflet
- Node.js
- Express
- TypeScript
- MongoDB
- Mongoose
- Socket.IO
- Multer / multipart upload handling
- Hugging Face embeddings for semantic similarity
- OpenRouter / LLM-based text generation flows
- RAG-ready retrieval pipeline
- Frontend deployment target: Vercel
- Backend can be deployed separately on any Node.js-compatible platform
Hackathonn/
|-- client/ # Next.js frontend
| |-- app/ # App Router pages, layouts, route groups
| |-- components/ # Reusable UI and feature components
| |-- hooks/ # Shared React hooks
| |-- lib/ # API helpers, utilities
| |-- services/ # Frontend service layer for backend APIs
| |-- socket/ # Socket.IO client setup
| |-- store/ # Zustand state stores
| |-- types/ # Shared frontend types
| `-- public/ # Static frontend assets if added
|
|-- server/ # Express backend
| |-- src/
| | |-- config/ # Env, DB, external service config
| | |-- controllers/ # Request handlers
| | |-- middleware/ # Auth, RBAC, uploads, error handling
| | |-- models/ # Mongoose schemas and models
| | |-- routes/ # API route definitions
| | |-- scripts/ # Seed and utility scripts
| | |-- services/ # Business logic
| | |-- sockets/ # Realtime event handling
| | |-- types/ # Backend-specific shared types
| | `-- utils/ # Query builder, helpers, embedding text builders
| `-- dist/ # Generated build output
|
|-- .gitignore
`-- README.md
The backend follows a modular service-oriented structure:
- Routes define the API endpoints
- Controllers handle HTTP request / response flow
- Services contain business logic
- Models represent MongoDB collections
- Middleware handles authentication, authorization, validation, uploads, and errors
- Socket handlers manage realtime events
- Utilities provide shared helpers such as pagination, filtering, similarity scoring, and embedding text building
Typical request flow:
Route -> Controller -> Service -> Model / DB
Realtime flow:
Socket Event -> Socket Handler -> Service -> DB / Emit Update
The current platform is centered around these collections:
- User
- Hospital
- Doctor
- Equipment
- Ambulance
- Appointment
- Issue
- Review
- Message
- MedicalShop
The frontend is built with reusable feature modules and service-based API access:
app/contains route groups for public and hospital experiencescomponents/contains reusable building blocks for landing, dashboard, discovery, chat, media, reviews, and moreservices/centralizes backend callsstore/manages auth, toasts, and notification statesocket/manages a shared Socket.IO clienthooks/contains reusable logic like auth syncing, socket listeners, async state, and notifications
This keeps the UI modular while avoiding unnecessary overengineering for a hackathon MVP.
The backend exposes REST APIs for:
/api/auth/api/hospitals/api/doctors/api/equipment/api/ambulances/api/appointments/api/issues/api/reviews/api/messages/api/medical-shops/api/analytics/api/ai/api/search
List APIs support filtering, sorting, and pagination through reusable query utilities.
Socket.IO is used for lightweight realtime workflows such as:
- chat messages
- issue creation / updates
- equipment updates
- appointment updates
- notification events
The frontend reuses a shared socket client and listens only where needed to avoid duplicate listeners.
The repository already includes practical AI features:
- semantic hospital search
- semantic equipment search
- semantic medical shop search
- review summarization
- assistant chat
- emergency interpretation
- dashboard insight generation
For semantic search, the backend converts structured records into descriptive text and then creates embeddings.
Examples:
- hospital embedding text includes name, city, state, specialties, departments, and facilities
- equipment embedding text includes name, type, and section
- medical shop embedding text includes name, area, city, and medicines
These embeddings are stored in MongoDB as numeric vectors and compared using cosine similarity.
Current retrieval pattern:
User query -> query embedding -> candidate fetch from MongoDB -> similarity scoring -> ranked results
This is a practical hackathon approach that keeps infrastructure simple while still supporting semantic search.
RAG stands for Retrieval-Augmented Generation.
Simple idea:
- retrieve relevant data from your own system
- pass that context to the LLM
- generate a grounded answer using that retrieved information
In Swasth Setu, the retrieval side already exists through semantic search and structured DB queries. The generation side already exists through review summarization, assistant chat, emergency interpretation, and dashboard insights.
So the project is best described as:
- AI-enabled today
- RAG-ready by architecture
- partially retrieval-augmented in practice
User question
-> semantic or structured retrieval
-> relevant hospitals / equipment / reviews / issues
-> context passed into AI service
-> generated answer or summary
This makes the system useful even if the AI layer is unavailable, because the core workflows still run on standard APIs and database logic.
The backend includes analytics endpoints for hospital dashboards using MongoDB aggregation pipelines.
These endpoints provide:
- overview counts
- status distributions
- issue trends
- appointment trends
- equipment distributions
- top issue types
- most used equipment types
This makes the dashboard more demo-friendly and more realistic for operations use cases.
git clone <your-repo-url>
cd Hackathonncd client
npm install
npm run devCreate client/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:5000cd server
npm install
npm run devCreate server/.env using server/.env.example as the base.
Typical backend values include:
PORTMONGO_URIJWT_SECRETCLOUDINARY_CLOUD_NAMECLOUDINARY_API_KEYCLOUDINARY_API_SECRET- AI provider keys depending on the configured services
Frontend:
cd client
npm run build
npm run startBackend:
cd server
npm run build
npm run startA simple end-to-end demo flow for this project:
- Patient searches for a hospital
- Patient opens hospital details and reviews
- AI summarizes reviews
- Patient books an appointment
- Patient raises an issue
- Hospital admin sees and resolves the issue
- Hospital admin searches equipment from another hospital
- Dashboard and AI insight cards show operational context
This repository is already beyond a simple scaffold. It includes:
- working frontend structure and pages
- modular backend architecture
- REST APIs for the core modules
- realtime plumbing
- semantic search flows
- dashboard analytics
- AI-assisted features
It should be viewed as a serious hackathon MVP with scalable architecture, not a finished production healthcare product.
- AI features are intentionally assistive, not mandatory for core flows
- the app is designed to remain usable even if AI services fail
- temporary local runtime folders such as
.next/,dist/,node_modules/, andtmp-runtime-logs/are excluded from Git
This repository currently has no explicit license file. Add one before public reuse if needed.