CareMeet is a full-stack telemedicine platform that connects patients with verified doctors through video consultations, supported by an AI-powered symptom analysis system.
The platform handles the complete consultation lifecycle β from helping users understand their symptoms using AI, to booking appointments, managing payments through a credit system, and conducting video consultations.
This project focuses on building a real-world healthcare workflow with reliable backend handling. Instead of being just a CRUD application, it addresses practical challenges such as scheduling conflicts, safe payment handling, role-based access, and integration with external systems.
User β AI Analysis β Doctor Selection β Booking β Payment β Video β Payout
-
Symptom Input
- User enters symptoms through the AI assistant.
-
AI Processing
-
Backend sends structured prompt to Gemini API.
-
Response is parsed to extract:
- urgency level
- recommended medical specialties
-
-
Doctor Selection
- User browses verified doctors filtered by specialty.
- Available slots are dynamically generated.
-
Booking Validation
-
Backend checks:
- user has sufficient credits
- slot availability (overlap query)
- minimum booking buffer (2 hours)
-
-
Atomic Booking Execution
-
A database transaction is executed:
- deduct credits from patient
- add credits to doctor
- create appointment record
-
If any step fails β everything is rolled back
-
-
Video Consultation
- Secure Vonage session is generated
- Doctor and patient join at scheduled time
-
Payout Flow
- Doctors accumulate credits
- Admin processes payout requests safely with balance validation
- Uses Google Gemini to analyze user symptoms
- Returns structured output (urgency + specialty)
- Includes fallback handling for API failures
- Doctors define availability
- System generates 30-minute slots dynamically
- Prevents overlapping bookings using database checks
- Enforces minimum 2-hour buffer before booking
- Users purchase credits via subscription
- Each consultation deducts fixed credits
- Credits are tracked using a ledger-style transaction model
- Doctor earnings are accumulated and later paid out
- Uses Vonage Video API (WebRTC)
- Session IDs and tokens generated securely on server
- Supports real-time video/audio communication
- Roles:
PATIENT,DOCTOR,ADMIN - Doctors require verification before becoming active
- Access control enforced in both server logic and UI
The application follows a modern full-stack architecture using Next.js:
-
Next.js Server Actions
- Handle data mutations securely on the server
- Reduce need for separate API endpoints
-
Prisma + PostgreSQL
- Manages relational data (users, appointments, transactions)
- Ensures type-safe database operations
-
Clerk Authentication
- Handles user authentication and session management
- Supports role-based workflows
-
External Integrations
- Gemini API β symptom analysis
- Vonage API β video sessions
Booking requires multiple updates (credits + appointment). These are executed inside a single database transaction to ensure:
- no credit loss
- no partial state in case of failure
Payout processing validates and updates doctor balance inside a transaction, preventing:
- duplicate payouts
- inconsistent balances
Instead of relying on frontend checks, the system:
- queries overlapping time slots in database
- ensures no double booking under concurrent requests
All critical inputs (booking, availability, payouts) are validated before hitting the database to prevent invalid data.
Authorization checks are implemented in:
- server actions
- layout-level logic
This ensures restricted access to sensitive operations.
- Prevents double booking using backend overlap checks
- Rolls back booking if any step fails
- Enforces 2-hour buffer for realistic scheduling
- Handles invalid inputs and malformed requests safely
- Includes fallback handling for AI failures
Frontend
- Next.js 15 (App Router)
- React 19
- Tailwind CSS
- Radix UI
Backend
- Node.js
- Next.js Server Actions
Database
- PostgreSQL
- Prisma ORM
Integrations
- Clerk (Authentication)
- Google Gemini (AI)
- Vonage Video API (WebRTC)
git clone https://github.com/Shikhar1504/Doctors_Appointment_Platform.git
cd Doctor
npm installCreate .env.local:
DATABASE_URL=...
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=...
CLERK_SECRET_KEY=...
GEMINI_API_KEY=...
NEXT_PUBLIC_VONAGE_APPLICATION_ID=...
VONAGE_PRIVATE_KEY=...npx prisma generate
npx prisma db push
npm run dev/api/ai-healthβ processes symptom input and returns structured AI response- booking & payout logic handled via server actions
- Full-stack application development with real-world workflows
- Backend correctness using transactions and validation
- Integration of AI and real-time communication systems
- Handling scheduling and payment logic reliably
- Building role-based multi-user systems
Built by Shikhar