- AI Specialist Finder: Intelligent doctor recommendations based on symptoms analysis
- AI Prescription Generator: Automated prescription creation with structured medical protocols
- Hospital Guide Chat: Interactive AI assistant for hospital navigation and information
- Role-Based Dashboards: Tailored interfaces for admins, doctors, nurses, and patients
- Patient Data Management: Secure CRUD operations for comprehensive patient records
- Appointment System: Advanced scheduling and management capabilities
- Medical Records: Complete digital health record management
- Billing & Payments: Streamlined financial management with rupee-based calculations
- Secure Authentication: Role-based access control
- Real-time Analytics: Live dashboard with performance metrics
- Responsive Design: Mobile-first approach for all devices
- Data Visualization: Interactive charts and reporting tools
| Frontend |
|
| Styling |
|
| Backend & Database |
|
| AI & Analytics |
|
| Development |
|
Before you begin, ensure you have the following installed:
- Node.js (18.0 or later)
- npm or yarn
- Git
-
Clone the repository
git clone https://github.com/LoganthP/Hospital-Management-System.git cd Hospital-Management-System -
Install dependencies
npm install # or yarn install -
Set up environment variables
cp .env.local.example .env.local
Configure your environment variables:
# AI Configuration GOOGLE_GENAI_API_KEY=your_google_ai_api_key # Firebase Configuration NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
-
Start the development server
npm run dev # or yarn dev -
Open your browser Navigate to
http://localhost:9002to see the application.
src/
βββ app/ # Next.js App Router pages
β βββ ai-prescriptions/ # AI prescription generator
β βββ appointments/ # Appointment management
β βββ billing/ # Billing and payments
β βββ dashboard/ # Main dashboard
β βββ doctor-data/ # Doctor management
β βββ medical-records/ # Patient medical records
β βββ patient-data/ # Patient management
β βββ search-records/ # Record search functionality
β βββ specialist-finder/ # AI specialist finder
βββ components/
β βββ layout/ # Layout components
β βββ ui/ # Reusable UI components
βββ ai/
β βββ flows/ # AI workflow definitions
βββ hooks/ # Custom React hooks
βββ lib/ # Utility functions
flowchart TD
A[User Opens HMS Web App] --> B[Frontend Interface]
B --> C[Login and Registration Module]
C --> D[Firebase Authentication]
D --> E[Role Based Access Control]
E --> F[Admin Dashboard]
E --> G[Doctor Dashboard]
E --> H[Patient Dashboard]
F --> I[Manage Doctors Patients Staff]
G --> J[View Appointments and Records]
H --> K[Book Appointments and View Reports]
I --> L[Application Service Layer]
J --> L
K --> L
L --> M[Firebase Firestore Database]
M --> N[Patient Records Collection]
M --> O[Doctor Data Collection]
M --> P[Appointments Collection]
M --> Q[Real Time Data Sync]
Q --> R[Frontend Visualization and UI Updates]
- Real-time patient statistics
- Appointment tracking and trends
- Revenue analytics in Indian Rupees (βΉ)
- Interactive charts and visualizations
// Example usage
const recommendation = await findSpecialist({
symptoms: "chest pain, shortness of breath",
urgency: "high"
});// Generate prescriptions automatically
const prescription = await generatePrescription({
name: "Patient Name",
diagnosis: "Hypertension"
});- Admin: Full system access and management
- Doctor: Patient records, prescriptions, appointments
- Nurse: Patient care, basic record updates
- Patient: Personal records, appointment booking
- Primary: Teal (#008080) - Trust and health
- Secondary: Light Gray (#F0F0F0) - Clean backgrounds
- Accent: Blue (#007BFF) - Interactive elements
- Success: Green (#28A745)
- Warning: Orange (#FFC107)
- Error: Red (#DC3545)
- Font: Inter - Clean, modern sans-serif
- Heading Scale: rem-based scaling
- Body Text: Optimized for readability
# Development
npm run dev # Start development server with Turbopack
npm run genkit:dev # Start AI development environment
npm run genkit:watch # Watch mode for AI flows
# Production
npm run build # Build for production
npm run start # Start production server
# Quality
npm run lint # Run ESLint
npm run typecheck # TypeScript type checking- Turbopack: Enabled for faster development builds
- TypeScript: Strict mode enabled
- Image Optimization: Configured for external sources
- Port: 9002 (customizable)
- Custom color schemes: Hospital-themed palette
- Component library: shadcn/ui integration
- Responsive design: Mobile-first approach
- Dark mode: Class-based toggle support
/api/ai/specialist-finder- Get doctor recommendations/api/ai/prescriptions- Generate prescriptions/api/ai/hospital-guide- Chat assistant
/api/patients- Patient CRUD operations/api/doctors- Doctor management/api/appointments- Appointment scheduling/api/billing- Financial operations
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage- Push to GitHub
- Connect repository to Vercel
- Configure environment variables
- Deploy automatically
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:18-alpine AS runner
WORKDIR /app
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
EXPOSE 3000
CMD ["npm", "start"]- Core Web Vitals: Optimized for excellent scores
- Bundle Size: Minimized with tree shaking
- Image Optimization: Next.js automatic optimization
- Caching Strategy: Aggressive caching for static assets
- Authentication: Firebase Auth integration
- Data Validation: Zod schema validation
- API Security: Rate limiting and input sanitization
- HIPAA Compliance: Privacy-first design principles
- ESLint: Follow the configured rules
- Prettier: Code formatting
- TypeScript: Strict type checking
- Conventional Commits: For clear commit history