MediCare is a comprehensive healthcare platform designed to seamlessly connect doctors and patients through advanced appointment scheduling, real-time consultations, secure payments, and AI-powered health assistance. Built with modern web technologies, it provides a robust foundation for healthcare accessibility and communication.
- Features
- Tech Stack
- Getting Started
- Environment Variables
- Installation
- Usage
- Folder Structure
- API Endpoints
- Real-time Features
- Contributing
- License
- Acknowledgments
- Role-based access control with Clerk authentication (Patient, Doctor, Admin)
- Secure user management with email verification and profile management
- Doctor verification system with credential upload and approval workflow
- Professional profiles with specialty, experience, and credentials
- Availability management for appointment scheduling
- Patient consultation through video calls and chat
- Earnings tracking and payout management
- Doctor discovery by specialty and availability
- Credit-based appointment booking with flexible subscription plans
- Real-time consultations via video calls and messaging
- Health assistant chatbot powered by AI
- WebRTC video calling with camera, microphone, and screen sharing
- Socket.IO chat system supporting text messages and file sharing
- Appointment-based communication with secure room management
- Health Assistant Chatbot using MedAlpaca-7B model via Hugging Face API
- Medical conversation context with appropriate safety disclaimers
- Quick health questions and symptom guidance
- Credit-based system for appointment bookings
- Subscription plans with automatic credit allocation
- Secure payment processing integration ready
- Email notifications for appointments and system updates
- Real-time notifications for chat messages and calls
- Next.js 15.3.3 - React framework with App Router
- React 19 - Latest React with concurrent features
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icon library
- Prisma ORM - Type-safe database client
- PostgreSQL - Robust relational database
- Next.js API Routes - Serverless API endpoints
- Clerk - Complete authentication solution
- JWT tokens - Secure session management
- Role-based permissions - Fine-grained access control
- Socket.IO - Real-time bidirectional communication
- WebRTC - Peer-to-peer video calling
- Custom signaling server - WebRTC connection management
- Hugging Face API - AI model integration
- MedAlpaca-7B - Medical conversation AI
- Nodemailer - Email service integration
- ESLint - Code linting and formatting
- Locomotive Scroll - Smooth scrolling animations
- React Hook Form - Form state management
- Zod - Schema validation
- Node.js (v18 or later recommended)
- npm or yarn package manager
- PostgreSQL database (local or cloud)
- Clerk account for authentication
- Hugging Face account for AI chatbot
Create a .env.local file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/medicare"
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="your_clerk_publishable_key"
CLERK_SECRET_KEY="your_clerk_secret_key"
NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in"
NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up"
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL="/onboarding"
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL="/onboarding"
# AI Chatbot
HUGGINGFACE_API_KEY="your_huggingface_api_key"
# Email Service
EMAIL_USER="[email protected]"
EMAIL_PASS="your_app_specific_password"
# Real-time Servers
NEXT_PUBLIC_CHAT_SERVER_URL="http://localhost:3002"
NEXT_PUBLIC_SIGNALING_SERVER_URL="http://localhost:3001"
# Application
NEXT_PUBLIC_APP_URL="http://localhost:3000"-
Clone the repository
git clone <repository-url> cd MediCare/my-app
-
Install dependencies
npm install
-
Set up the database
npx prisma generate npx prisma db push
-
Start the development servers
# Main Next.js application npm run dev # In separate terminals: # Chat server node chat-server.js # Signaling server for video calls node signaling-server.js
-
Open your browser Navigate to http://localhost:3000
- Sign up and complete the onboarding process
- Browse doctors by specialty and availability
- Purchase credits or subscribe to a plan
- Book appointments with available doctors
- Join video calls and chat with doctors
- Use the AI health assistant for quick health questions
- Sign up and complete professional verification
- Set up your profile with credentials and specialties
- Manage availability and appointment slots
- Conduct consultations via video calls and chat
- Track earnings and manage payouts
- Access admin dashboard for user management
- Verify doctor credentials and approve registrations
- Monitor platform activity and resolve issues
- Manage system settings and configurations
my-app/
βββ app/ # Next.js App Router
β βββ (auth)/ # Authentication pages
β βββ (main)/ # Main application pages
β β βββ admin/ # Admin dashboard
β β βββ doctor/ # Doctor dashboard
β β βββ appointments/ # Appointment management
β β βββ onboarding/ # User onboarding
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
βββ components/ # Reusable UI components
β βββ ui/ # Base UI components
β βββ chatbot-modal.tsx # AI chatbot interface
β βββ video-call-modal.tsx # Video calling interface
β βββ header.tsx # Navigation header
βββ actions/ # Server actions
βββ lib/ # Utility functions
βββ prisma/ # Database schema and migrations
βββ public/ # Static assets
βββ chat-server.js # Socket.IO chat server
βββ signaling-server.js # WebRTC signaling server
βββ package.json # Dependencies and scripts
POST /api/auth/verify- Verify user credentialsGET /api/auth/user- Get current user information
GET /api/appointments- List user appointmentsPOST /api/appointments- Create new appointmentPUT /api/appointments/:id- Update appointmentDELETE /api/appointments/:id- Cancel appointment
GET /api/doctors- List available doctorsGET /api/doctors/:id- Get doctor detailsPOST /api/doctors/verify- Submit verification documents
GET /api/credits- Get user credit balancePOST /api/credits/purchase- Purchase creditsGET /api/subscriptions- Get subscription plans
GET /api/chat/:appointmentId- Get chat historyPOST /api/chat/send- Send chat message
- Room-based messaging tied to appointments
- File sharing and media support
- Real-time notifications for new messages
- Connection status tracking
- Peer-to-peer connections for high-quality calls
- Camera and microphone controls
- Screen sharing capabilities
- Call state management and reconnection
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Use Prettier for code formatting
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js Team for the amazing React framework
- Clerk for seamless authentication
- Prisma for type-safe database access
- Hugging Face for AI model hosting
- Radix UI for accessible components
- Socket.IO for real-time communication
- WebRTC for peer-to-peer video calling
Built with β€οΈ for better healthcare accessibility
For support or questions, please open an issue in the repository or contact the development team.