
ClinicPlus is a full-stack medical clinic management platform built with modern web technologies. It provides a comprehensive solution for clinic operations, including patient management, doctor profiles, appointment scheduling, medical history tracking, and administrative controls.
graduateion_project/
├── app/ # Next.js App Router
│ ├── (public)/ # Public-facing pages (no auth required)
│ │ ├── page.tsx # Home page
│ │ ├── doctors/ # Doctors listing
│ │ ├── doctors/[id]/ # Individual doctor profile
│ │ ├── about/ # About/Team page
│ │ └── statics/ # Analytics/Statistics page
│ │
│ ├── (dashboard)/ # Protected dashboard routes
│ │ ├── admin/ # Admin dashboard
│ │ │ ├── users/ # User management
│ │ │ ├── doctors/ # Doctor management
│ │ │ └── ... # Admin features
│ │ └── profile/ # User profile pages
│ │
│ ├── api/ # Backend API routes
│ │ ├── auth/[...nextauth]/ # Authentication endpoints
│ │ ├── profile/ # Profile management APIs
│ │ ├── admin/ # Admin operation APIs
│ │ ├── doctors/ # Public doctor APIs
│ │ └── upload/ # File upload API
│ │
│ ├── Components/ # Shared UI components
│ ├── layout.tsx # Root layout with metadata
│ └── globals.css # Global styles
│
├── components/
│ └── ui/ # Reusable UI primitives (shadcn)
│
├── models/ # Mongoose database models
│ ├── User.ts # User schema
│ ├── Doctors.ts # Doctor schema
│ ├── Review.ts # Review schema
│ ├── MedicalHistory.ts # Medical history schema
│ └── UpcomingDates.ts # Appointments schema
│
├── lib/ # Utility libraries
│ ├── db.ts # Database connection
│ ├── auth.ts # Auth configuration
│ └── ... # Helper functions
│
├── types/ # TypeScript type definitions
├── public/ # Static assets
├── next.config.ts # Next.js configuration
├── tsconfig.json # TypeScript configuration
├── tailwind.config.ts # Tailwind CSS configuration
└── package.json # Dependencies & scripts
/admin dashboardAdmin Access Control: Defined by AUTH_ADMINS environment variable (comma-separated email list)
GET /api/doctors # List all doctors (with search & pagination)
GET /api/doctors/[id] # Get doctor by ID
POST /api/doctors/[id]/reviews # Submit a review (requires auth)
GET /api/profile # Get user profile
PATCH /api/profile # Update user profile
GET /api/profile/doctor/medical-history # Get medical history
POST /api/profile/doctor/medical-history # Add medical history
GET /api/profile/doctor/appointments # Get appointments
POST /api/profile/doctor/appointments # Add appointment
GET /api/admin/users # List all users
GET /api/admin/users/[id] # Get user details
PATCH /api/admin/users/[id] # Update user
GET /api/admin/doctors # List all doctors
POST /api/admin/doctors # Add new doctor
GET /api/admin/doctors/[id] # Get doctor details
PATCH /api/admin/doctors/[id] # Update doctor
DELETE /api/admin/doctors/[id] # Delete doctor
POST /api/upload # Upload file to Cloudinary
GET/POST /api/auth/[...nextauth] # NextAuth authentication
Home Page → Browse Doctors → View Doctor Profile → (Optionally Sign Up)
Sign In (Google OAuth)
↓
Dashboard/Profile
↓
├─ Edit Profile Settings
├─ View Medical History
├─ Book Appointments
├─ Rate/Review Doctors
└─ Manage Account
Sign In (Google OAuth)
↓
Doctor Profile Page
↓
├─ Update Professional Info
├─ View Patient Reviews
├─ Manage Appointments
└─ View Medical History (if also a patient)
Sign In (Google OAuth - must be in AUTH_ADMINS)
↓
Admin Dashboard (/admin)
↓
├─ Users Management
│ ├─ View User List
│ ├─ Edit User Details
│ └─ Manage User Roles
│
├─ Doctors Management
│ ├─ View Doctor Cards
│ ├─ Add New Doctor
│ ├─ Edit Doctor Profile
│ └─ Remove Doctor
│
└─ System Analytics
User clicks "Sign In"
↓
Google OAuth Redirect
↓
NextAuth validates credentials
↓
User session created
↓
├─ If new user → Create User document in MongoDB
├─ If existing user → Load profile
└─ If admin email in AUTH_ADMINS → Grant admin access
↓
Redirect to appropriate page (profile/dashboard)
Create .env.local file with the following variables:
# Database
MONGODB_URI=mongodb://...
# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_secret_key
# Admin Access (comma-separated emails)
AUTH_ADMINS=admin@example.com,doctor@example.com
# Cloudinary (for image uploads)
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
# Optional (for metadata)
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Install dependencies
npm install
# Start development server
npm run dev
# Open browser
http://localhost:3000
npm run dev # Start development server
npm run build # Build for production (with Turbopack)
npm run start # Start production server
Feature
Description
Public Website
SEO-optimized pages with metadata, Open Graph support
Doctor Directory
Search, filter, and paginate through doctor listings
Review System
Authenticated users can rate and review doctors
User Profiles
Personalized profile management for patients
Doctor Profiles
Professional profile with appointments and reviews
Medical History
Track patient medical records and history
Appointments
Schedule and manage upcoming appointments
Admin Dashboard
Full CRUD operations for users and doctors
Google OAuth
Secure authentication via Google Sign-In
Image Upload
Cloudinary integration for profile pictures
Analytics
Statistics and data visualization
Responsive UI
Mobile-first design with Tailwind CSS
NEXTAUTH_URL to production URLNEXT_PUBLIC_SITE_URL to production URLAUTH_ADMINS emailsnpm run build successfullyIssue: .next/static/development/_buildManifest.js.tmp.* errors Solution:
.next foldernpm run devIssue: Schema not found during populate Solution: Import required models in route file before using populate
Issue: Passing MongoDB ObjectId to Client Components Solution: Convert to string: String(doc._id)
For detailed setup instructions and troubleshooting, refer to:
README.md - Quick start guidePROJECT_GUIDE_EN.md - Comprehensive English guidePROJECT_GUIDE_AR.md - Comprehensive Arabic guideBuilt with: Next.js 16, TypeScript, MongoDB, NextAuth, Tailwind CSS, shadcn/ui, MUI, Chart.js, Cloudinary
Check out the live project or dive into the source code on GitHub