Skip to content

CoderGUY47/medicare-connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

127 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

<br/><br/>


Full-Stack Healthcare Appointment & Management Platform

Book consultations with verified specialists, manage prescriptions, track payments, and coordinate care β€” all in one place.

Live Demo Β  Backend API


πŸ“Έ Screenshots

🏠 Homepage

Desktop

Homepage Desktop
Mobile

Homepage Mobile

πŸ“Š Patient Dashboard

Desktop

Dashboard Desktop
Mobile

Dashboard Mobile

✨ Features

πŸ§‘β€βš•οΈ For Patients

  • πŸ” Find Doctors β€” Search & filter by specialization, fee, availability
  • πŸ“… Book Appointments β€” Real-time slot selection with Stripe payment
  • πŸ’Š Prescriptions β€” View electronic prescriptions issued by doctors
  • πŸ’³ Payment History β€” Track all consultation payments with spending chart
  • πŸ”” Notifications β€” Real-time alerts for appointments & payments
  • πŸ‘€ Profile Management β€” Update personal info, photo, and contact details

🩺 For Doctors

  • πŸ“‹ Appointment Management β€” Confirm, complete, or reject bookings
  • πŸ“ Issue Prescriptions β€” Write and manage patient prescriptions
  • πŸ“Š Earnings Dashboard β€” Track consultation revenue and history
  • πŸ₯ Profile Setup β€” Specialization, fees, availability schedule

πŸ›‘οΈ For Admins

  • πŸ‘₯ User Management β€” View, search, and suspend all users
  • βœ… Doctor Verification β€” Approve or reject doctor applications
  • πŸ“ˆ Platform Analytics β€” Stats overview across all roles
  • πŸ›οΈ Full Oversight β€” Manage appointments, payments, and reviews

πŸ” Authentication

  • Credentials login (email + password via JWT)
  • Google OAuth via Better Auth
  • Role-based access β€” patient, doctor, admin, nurse, lab, pharmacist

πŸ› οΈ Tech Stack

Layer Technology
Frontend Next.js 16 (App Router, Turbopack), TypeScript, Tailwind CSS v4
UI Components Radix UI, shadcn/ui, Framer Motion, Recharts
Backend Express.js, TypeScript, Node.js
Database MongoDB Atlas (via Mongoose + native driver)
Auth Better Auth (JWKS), JWT (HTTPOnly cookies)
Payments Stripe Checkout (server-side sessions)
Icons Lucide React, React Icons
Deployment Vercel (frontend + backend as serverless)

πŸ—‚οΈ Project Structure

medicare-connect/
β”œβ”€β”€ frontend/                  # Next.js 16 App Router
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/               # Pages & API routes
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/     # Role-based dashboards
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ patient/   # Patient pages
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ doctor/    # Doctor pages
β”‚   β”‚   β”‚   β”‚   └── admin/     # Admin pages
β”‚   β”‚   β”‚   β”œβ”€β”€ find-doctors/  # Doctor search & booking
β”‚   β”‚   β”‚   β”œβ”€β”€ login/         # Auth pages
β”‚   β”‚   β”‚   └── success/       # Post-payment confirmation
β”‚   β”‚   β”œβ”€β”€ components/        # Shared UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ NotificationBell.tsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ context/           # AuthContext (global auth state)
β”‚   β”‚   β”œβ”€β”€ lib/               # mockDb (localStorage + MongoDB sync)
β”‚   β”‚   └── utils/             # backendUrl helper
β”‚   └── public/assets/         # Static assets & screenshots
β”‚
└── backend/                   # Express API server
    └── index.ts               # All routes, middleware, seeding

πŸš€ Getting Started

Prerequisites

  • Node.js 20+
  • MongoDB Atlas account
  • Stripe account
  • Google OAuth credentials

1. Clone the repository

git clone https://github.com/CoderGUY47/medicare-connect.git
cd medicare-connect

2. Setup the Backend

cd backend
npm install

Create backend/.env:

MONGODB_URI=mongodb+srv://<user>:<pass>@cluster.mongodb.net/medi-doc
JWT_SECRET=your_jwt_secret_key
PORT=5000
CLIENT_URL=http://localhost:3000

Start the backend:

npm run dev

3. Setup the Frontend

cd frontend
npm install

Create frontend/.env.local:

NEXT_PUBLIC_SERVER_URL=http://localhost:5000
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
BETTER_AUTH_SECRET=your_better_auth_secret
BETTER_AUTH_URL=http://localhost:3000
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

Start the frontend:

npm run dev

Open http://localhost:3000


πŸ”‘ Demo Credentials

Role Email Password
πŸ§‘β€βš•οΈ Patient patient@gmail.com patient123
🩺 Doctor doctor@gmail.com doctor123
πŸ›‘οΈ Admin admin@gmail.com admin123
πŸ’Š Pharmacist pharmacist@gmail.com pharmacist123
πŸ”¬ Lab lab@gmail.com lab123
πŸ₯ Nurse nurse@gmail.com nurse123

πŸ’‘ Demo accounts are available until June 29, 2026. Register for a permanent account anytime.


πŸ’³ Stripe Test Cards

Card Number
βœ… Success 4242 4242 4242 4242
❌ Decline 4000 0000 0000 0002

Use any future date for expiry and any 3-digit CVV.


πŸ”Œ API Endpoints

Method Endpoint Auth Description
POST /api/auth/login ❌ Login with credentials
POST /api/auth/logout ❌ Logout
GET /api/db-dump ❌ Sync all collections
POST /api/db-sync ❌ Push local data to MongoDB
GET /doctors ❌ List all doctors
GET /doctors/:id ❌ Single doctor profile
POST /appointments βœ… Book appointment
GET /appointments/:userId βœ… Get user appointments
GET /payments/:userId βœ… Get payment history
POST /payment-confirm ❌ Stripe webhook sync
GET /reviews/:doctorId ❌ Get doctor reviews
POST /reviews βœ… Submit review
GET /users βœ… Admin All users

🧩 Key Architectural Decisions

  • Hybrid Storage: Data is stored in both localStorage (fast reads) and MongoDB (persistence). They sync bidirectionally β€” the backend is the source of truth but locally added records (e.g. just-paid appointments) are merged, not overwritten.
  • Seed Guarantee: Seed appointments and payments for demo accounts are always injected if missing, ensuring a rich demo experience on every reload.
  • SSR-safe Charts: Recharts ResponsiveContainer is wrapped with a mounted guard and explicit-height parent div to prevent the width(-1) SSR error.
  • JWT + JWKS: Custom credentials use server-signed JWTs stored as HTTPOnly cookies. Google OAuth tokens are validated via JWKS (Better Auth's public key endpoint).

πŸ“¦ Deployment

Both the frontend and backend are deployed on Vercel:

Service URL
Frontend https://medicare-connect-ten.vercel.app
Backend API https://backend-nu-rosy-20.vercel.app

The backend runs as a serverless Express function via Vercel's Node.js runtime.


πŸ“„ License

This project is open source and available under the MIT License.


Built with ❀️ using Next.js, MongoDB & Stripe

🌐 Live Demo Β· πŸ› Report Bug Β· ✨ Request Feature

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors