A modern telemedicine platform that connects patients with verified doctors for virtual consultations. Built with Next.js 15, Prisma, and Vonage Video API.
- Features
- Tech Stack
- Prerequisites
- Installation
- Environment Setup
- Project Structure
- User Workflows
- Database Schema
- Development
- Deployment
- Secure sign-in/sign-up with Clerk
- Role-based access control (Patient, Doctor, Admin)
- Email verification required
- Browse doctors by specialty
- View doctor profiles with detailed information
- Book appointments with time-slot selection
- Video consultations via Vonage Video API
- Manage appointments (view, cancel)
- Credit-based payment system (2 credits/appointment)
- Complete profile setup (specialty, experience, credentials)
- Doctor verification by admin
- Set daily availability slots
- Manage incoming appointments
- Add notes to appointments
- Mark appointments as completed
- Request payouts for earned credits
- Real-time earnings dashboard
- Verify/reject doctor applications
- Review doctor credentials
- Manage payout requests
- Monitor platform activity
| Layer | Technology |
|---|---|
| Frontend | Next.js 15, React 19, Tailwind CSS, Shadcn UI |
| Backend | Next.js Server Actions |
| Database | PostgreSQL (Neon), Prisma ORM |
| Authentication | Clerk |
| Video | Vonage Video API |
| Styling | Tailwind CSS + Radix UI Components |
- Node.js 18+ and npm/yarn
- PostgreSQL database (Neon free tier)
- Clerk account for authentication
- Vonage account for video conferencing
git clone https://github.com/anshi78/Doclink.git
cd my-appnpm installCreate .env file in root:
# Database (Neon PostgreSQL)
DATABASE_URL="postgresql://user:password@host/dbname?sslmode=require"
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxx
CLERK_SECRET_KEY=sk_test_xxx
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
# Vonage Video API
NEXT_PUBLIC_VONAGE_APPLICATION_ID=your_app_id
VONAGE_PRIVATE_KEY=lib/private.key# Generate Prisma client
npx prisma generate
# Run migrations
npx prisma migrate dev --name initnpm run dev- Create app at clerk.com
- Copy Publishable & Secret keys
- Add redirect URLs for localhost & production
- Create project at neon.tech
- Copy connection string
- Add to
DATABASE_URLin.env
- Create account at vonage.com
- Generate Application ID and Private Key
- Save private key to
lib/private.key
my-app/
βββ actions/ # Server actions (DB operations)
β βββ admin.js
β βββ appointments.js
β βββ doctor.js
β βββ payout.js
β βββ patient.js
βββ app/ # Next.js app directory
β βββ (auth)/ # Auth pages
β βββ (main)/ # Protected pages
β β βββ admin/
β β βββ appointments/
β β βββ doctor/
β β βββ doctors/
β β βββ video-call/
β βββ layout.js
βββ components/ # Reusable components
β βββ ui/
β βββ appointment-card.jsx
β βββ doctor-card.jsx
βββ lib/ # Utilities & config
β βββ prisma.js
βββ prisma/ # Database schema
β βββ schema.prisma
βββ public/ # Static assets
- Sign up β Get 2 free credits
- Browse doctors by specialty
- View doctor profile & availability
- Select time slot β Add medical details
- Book appointment β Credits deducted
- Join video call during appointment time
- Consultation with doctor (30 min)
- Sign up as doctor β Submit credentials
- Email verification β Complete onboarding
- Wait for admin verification
- Set daily availability (e.g., 9 AM - 5 PM)
- System creates 30-min auto-slots
- Manage incoming appointments
- Conduct video consultations
- Complete appointment β +2 credits earned
- Request payout when ready
- Review pending doctor applications
- Verify approved doctors
- Review payout requests
- Process payments to PayPal
| Action | Credits | Direction |
|---|---|---|
| Patient books | -2 | Patient β Doctor |
| Cancel appointment | +2 | Refund to patient |
| Doctor completes | +2 | Earned by doctor |
| Payout | $8 per credit | Doctor β Bank |
# Start development server
npm run dev
# Build production
npm run build
# Start production server
npm run start
# View database (Prisma Studio)
npx prisma studio
# Create migration
npx prisma migrate dev --name <name>- Push to GitHub
- Go to vercel.com
- Import repository
- Add environment variables
- Deploy!
npm install -g vercel
vercel- β Real-time appointment management
- β Video consultations (Vonage API)
- β Credit-based payments
- β Doctor verification system
- β Admin dashboard
- β Payout management
- β Responsive design (mobile-ready)
- β Dark mode theme
For issues or questions:
- Open a GitHub issue
- Contact: support@doclink.app
MIT License - see LICENSE file for details
Made with β€οΈ | AI-Appointment Team