Skip to content

Repository files navigation

πŸ₯ AI-Appointment Booking System

A modern telemedicine platform that connects patients with verified doctors for virtual consultations. Built with Next.js 15, Prisma, and Vonage Video API.

Next.js React Prisma PostgreSQL Tailwind CSS


πŸ“‹ Table of Contents


✨ Features

πŸ” Authentication

  • Secure sign-in/sign-up with Clerk
  • Role-based access control (Patient, Doctor, Admin)
  • Email verification required

πŸ‘₯ Patient Features

  • 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)

πŸ‘¨β€βš•οΈ Doctor Features

  • 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

πŸ‘¨β€πŸ’Ό Admin Features

  • Verify/reject doctor applications
  • Review doctor credentials
  • Manage payout requests
  • Monitor platform activity

πŸ›  Tech Stack

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

πŸ“¦ Prerequisites

  • Node.js 18+ and npm/yarn
  • PostgreSQL database (Neon free tier)
  • Clerk account for authentication
  • Vonage account for video conferencing

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/anshi78/Doclink.git
cd my-app

2. Install Dependencies

npm install

3. Configure Environment Variables

Create .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

4. Set Up Database

# Generate Prisma client
npx prisma generate

# Run migrations
npx prisma migrate dev --name init

5. Start Development Server

npm run dev

Open http://localhost:3000


βš™οΈ Environment Setup

Clerk

  1. Create app at clerk.com
  2. Copy Publishable & Secret keys
  3. Add redirect URLs for localhost & production

Neon PostgreSQL

  1. Create project at neon.tech
  2. Copy connection string
  3. Add to DATABASE_URL in .env

Vonage

  1. Create account at vonage.com
  2. Generate Application ID and Private Key
  3. Save private key to lib/private.key

πŸ“ Project Structure

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

πŸ‘₯ User Workflows

Patient

  1. Sign up β†’ Get 2 free credits
  2. Browse doctors by specialty
  3. View doctor profile & availability
  4. Select time slot β†’ Add medical details
  5. Book appointment β†’ Credits deducted
  6. Join video call during appointment time
  7. Consultation with doctor (30 min)

Doctor

  1. Sign up as doctor β†’ Submit credentials
  2. Email verification β†’ Complete onboarding
  3. Wait for admin verification
  4. Set daily availability (e.g., 9 AM - 5 PM)
  5. System creates 30-min auto-slots
  6. Manage incoming appointments
  7. Conduct video consultations
  8. Complete appointment β†’ +2 credits earned
  9. Request payout when ready

Admin

  1. Review pending doctor applications
  2. Verify approved doctors
  3. Review payout requests
  4. Process payments to PayPal

πŸ’³ Credit System

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

πŸ”¨ Development

# 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>

🚒 Deployment

Deploy to Vercel

  1. Push to GitHub
  2. Go to vercel.com
  3. Import repository
  4. Add environment variables
  5. Deploy!
npm install -g vercel
vercel

🎯 Key Features

  • βœ… 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

πŸ“ž Support

For issues or questions:


πŸ“„ License

MIT License - see LICENSE file for details


Made with ❀️ | AI-Appointment Team

About

A modern telemedicine platform that connects patients with verified doctors for virtual consultations. Built with Next.js 15, Prisma, and Vonage Video API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages