Skip to content
@Syntax-Errors-Medconnect

MedConnect

MedConnect a unified workspace for patients and doctors to coordinate visits, communication and documentation

🏥 MedConnect

Next-Generation Healthcare Management Platform


Live Demo Video Demo


Next.js React Node.js MongoDB TypeScript Tailwind License


A production-ready, full-stack healthcare platform enabling seamless patient-doctor interactions through intelligent appointment scheduling, HD video consultations, AI-powered clinical summaries, and real-time messaging.


FeaturesArchitectureQuick StartAPI ReferenceDeployment



📋 Table of Contents



🚀 Features

Core Platform Capabilities

🔐 Authentication & Authorization

  • JWT-based authentication with access and refresh tokens
  • Google OAuth 2.0 integration
  • Role-based access control (Admin, Doctor, Patient)
  • Secure password hashing with bcrypt
  • HTTP-only secure cookies
  • Token rotation on refresh

📅 Appointment Management

  • Patient-initiated appointment booking
  • Doctor appointment acceptance/rejection
  • Email notifications for appointment updates
  • Status tracking (pending, accepted, rejected, completed)
  • Appointment history and timeline

📹 Video Consultations

  • Agora RTC integration for HD video calls
  • Dynamic secure token generation
  • Call history and duration tracking
  • Appointment-linked video sessions
  • Mute, camera toggle, screen share controls

🤖 AI-Powered Features

  • GROQ AI integration for intelligent summaries
  • Clinical data retrieval and analysis
  • Natural language processing for medical records
  • Automated visit summary generation

💬 Real-time Chat

  • Session-based messaging system
  • Doctor-patient communication
  • Message history and persistence
  • Session management

📊 Clinical Records

  • Doctor-created visit summaries
  • Patient medical history tracking
  • Structured clinical data storage
  • Visit timeline per patient

Role-Based Features

👤 For Patients

  • 📅 Smart Booking — Browse available doctors and book appointments
  • 📹 Video Consultations — Join video calls with doctors via Agora RTC
  • 📋 Medical History — View and manage medical records and visit summaries
  • 🔍 Doctor Search — Find doctors by specialization
  • 💬 Real-time Chat — Communicate with healthcare providers
  • 📊 Appointment Tracking — Track status (pending, accepted, completed)

👨‍⚕️ For Doctors

  • 👥 Patient Management — View and manage patient list
  • Appointment Handling — Accept/reject appointment requests
  • 📝 Visit Summaries — Create detailed clinical visit records
  • 🎥 Video Consultations — Conduct video calls with patients
  • 📊 Patient History — Access complete patient medical history
  • 💬 Chat System — Communicate with patients

⚙️ For Admins

  • 👨‍⚕️ Doctor Management — Add, update, and remove doctor accounts
  • 👥 User Oversight — Manage system users and roles
  • 🔧 System Configuration — Control application settings


🏗️ System Architecture

MedConnect follows a modern, scalable architecture designed for healthcare applications with a clear separation of concerns.

Architecture Diagram


Architecture Layers

┌─────────────────────────────────────────────────────────────────────────────────────┐
│                                   CLIENT LAYER                                       │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐  ┌────────────────┐  │
│  │  Patient Portal │  │  Doctor Portal  │  │  Admin Panel    │  │  Mobile (PWA)  │  │
│  └────────┬────────┘  └────────┬────────┘  └────────┬────────┘  └───────┬────────┘  │
└───────────┼────────────────────┼────────────────────┼───────────────────┼───────────┘
            └────────────────────┴────────────────────┴───────────────────┘
                                          │
                                          ▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│                            FRONTEND LAYER • Next.js 16                               │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐  ┌────────────────┐  │
│  │   App Router    │  │    React 19     │  │   TypeScript    │  │  Tailwind CSS  │  │
│  │   (Pages)       │  │   Components    │  │   Type Safety   │  │     Styling    │  │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘  └────────────────┘  │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐                      │
│  │  Auth Context   │  │   API Client    │  │  Agora RTC SDK  │                      │
│  │  State Mgmt     │  │   lib/api.ts    │  │   Video Calls   │                      │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘                      │
└─────────────────────────────────────────────────────────────────────────────────────┘
                                          │
                                          ▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│                           API GATEWAY • Express.js                                   │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐  ┌────────────────┐  │
│  │  JWT Auth       │  │  Rate Limiting  │  │  Validation     │  │  CORS Config   │  │
│  │  Middleware     │  │  Middleware     │  │  Middleware     │  │                │  │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘  └────────────────┘  │
└─────────────────────────────────────────────────────────────────────────────────────┘
                                          │
         ┌────────────────────────────────┼────────────────────────────────┐
         ▼                                ▼                                ▼
┌─────────────────────┐    ┌─────────────────────┐    ┌─────────────────────────────┐
│   SERVICE LAYER     │    │    DATA LAYER       │    │     EXTERNAL SERVICES       │
├─────────────────────┤    ├─────────────────────┤    ├─────────────────────────────┤
│ • Auth Service      │    │                     │    │ 📹 Agora.io                 │
│ • Appointment Svc   │    │   ┌─────────────┐   │    │    Real-time Video/Audio    │
│ • Video Call Svc    │◄──►│   │  MongoDB    │   │    │                             │
│ • Chat Service      │    │   │   Atlas     │   │    │ 📧 Brevo (Sendinblue)       │
│ • Email Service     │    │   └─────────────┘   │    │    Transactional Emails     │
│ • AI Summary Svc    │    │                     │    │                             │
│ • Medical History   │    │   Mongoose ODM      │    │ 🔐 Google OAuth             │
│                     │    │   Schema Validation │    │    Social Authentication    │
│                     │    │                     │    │                             │
│                     │    │                     │    │ 🤖 GROQ AI                  │
│                     │    │                     │    │    Clinical Summaries       │
└─────────────────────┘    └─────────────────────┘    └─────────────────────────────┘

Data Flow

Flow Path
Request Flow Client → Next.js → API Gateway → Auth Middleware → Controller → Service → Database
Response Flow Database → Service → Controller → Response Formatter → Client
Video Call Flow Client ↔ Agora RTC ↔ Backend Token Service
Email Flow Event Trigger → Email Service → Brevo SMTP → Recipient
AI Flow Visit Data → GROQ AI API → Processed Summary → Client


⚡ Tech Stack

Frontend Technologies

Technology Version Purpose
Next.js 16 React framework with App Router, SSR, and static generation
React 19 UI component library with latest features
TypeScript 5.x Type-safe JavaScript for better DX
Tailwind CSS 4 Utility-first CSS with gradient designs and animations
Agora RTC SDK Latest Real-time video/audio communication

Backend Technologies

Technology Version Purpose
Node.js 18+ JavaScript runtime environment
Express.js 4.x Fast, minimalist web framework
MongoDB 4.4+ NoSQL document database
Mongoose 7.x MongoDB object modeling (ODM)
Passport.js Latest OAuth and authentication middleware
JWT Latest Stateless authentication tokens
bcrypt Latest Secure password hashing

External Services

Service Purpose Console/Docs
Agora.io Real-time HD video/audio console.agora.io
Brevo (Sendinblue) Transactional email delivery brevo.com
Google OAuth Social authentication console.cloud.google.com
GROQ AI Intelligent clinical summaries console.groq.com
MongoDB Atlas Cloud database with backups mongodb.com/atlas


🚀 Quick Start

Prerequisites

Requirement Version Notes
Node.js ≥ 18.0.0 Download
MongoDB ≥ 4.4 Local or MongoDB Atlas
npm or yarn Latest Package manager
Gmail Account For email notifications (App Password required)
Agora Account For video calls (Sign up)
GROQ API Key For AI features (Get key)
Google OAuth For social login (Setup)

1️⃣ Clone the Repository

git clone <repository-url>
cd b2b

2️⃣ Backend Setup

# Navigate to backend directory
cd backend

# Install dependencies
npm install

# Copy environment template
cp .env.example .env

# ⚠️ Edit .env with your actual credentials (see Environment Configuration section)

# Start development server
npm run dev

✅ Backend runs on: http://localhost:5000

3️⃣ Frontend Setup

# Navigate to frontend directory (from project root)
cd frontend

# Install dependencies
npm install

# Copy environment template
cp .env.example .env.local

# ⚠️ Edit .env.local with your settings

# Start development server
npm run dev

✅ Frontend runs on: http://localhost:3000

4️⃣ Access the Application

Open http://localhost:3000 in your browser to access MedConnect.



🔐 Environment Configuration

Backend Environment Variables (.env)

🖥️ Server Configuration

Variable Description Example
NODE_ENV Environment mode development or production
PORT Server port 5000

💾 Database Configuration

Variable Description Example
MONGODB_URI MongoDB connection string mongodb://localhost:27017/medconnect

🔑 JWT Configuration

Variable Description Example
JWT_ACCESS_SECRET Access token secret (min 32 chars) your_super_secure_access_secret_key_here
JWT_REFRESH_SECRET Refresh token secret (min 32 chars) your_super_secure_refresh_secret_key_here
JWT_ACCESS_EXPIRY Access token expiration 15m
JWT_REFRESH_EXPIRY Refresh token expiration 7d

🌐 Frontend & CORS Configuration

Variable Description Example
FRONTEND_URL Frontend application URL for CORS http://localhost:3000
COOKIE_DOMAIN Cookie domain localhost

🔗 Google OAuth Configuration

Variable Description How to Get
GOOGLE_CLIENT_ID Google OAuth client ID Google Cloud Console → APIs & Services → Credentials
GOOGLE_CLIENT_SECRET Google OAuth client secret Same as above
GOOGLE_CALLBACK_URL OAuth callback URL http://localhost:5000/api/oauth/google/callback

📧 Email Configuration (Gmail SMTP)

Variable Description Example
EMAIL_HOST SMTP host smtp.gmail.com
EMAIL_PORT SMTP port 587
EMAIL_SECURE Use TLS false
EMAIL_USER Gmail address your-email@gmail.com
EMAIL_PASSWORD Gmail app password Generate App Password
EMAIL_FROM_NAME Sender display name MedConnect
EMAIL_FROM_ADDRESS Sender email your-email@gmail.com

⚠️ Important: For Gmail, you must generate an App Password. Regular passwords won't work.

📹 Agora Video Configuration

Variable Description How to Get
AGORA_APP_ID Agora application ID Agora Console → Project Management
AGORA_APP_CERTIFICATE Agora app certificate Enable in Agora Console → Project Settings

🤖 GROQ AI Configuration

Variable Description How to Get
GROQ_API_KEY GROQ AI API key GROQ Console → API Keys

Frontend Environment Variables (.env.local)

Variable Description Example
NEXT_PUBLIC_API_URL Backend API base URL http://localhost:5000/api
NEXT_PUBLIC_AGORA_APP_ID Agora App ID for video calls Get from Agora Console

📝 Note: Variables prefixed with NEXT_PUBLIC_ are exposed to the browser.



📁 Project Structure

b2b/
├── 📁 backend/                          # Node.js + Express API Server
│   ├── 📁 src/
│   │   ├── 📄 app.js                    # Application entry point
│   │   ├── 📁 config/                   # Configuration files
│   │   │   ├── 📄 db.js                 # MongoDB connection setup
│   │   │   ├── 📄 env.js                # Environment variables validation
│   │   │   └── 📄 passport.js           # Passport OAuth configuration
│   │   ├── 📁 controllers/              # Request handlers
│   │   │   ├── 📄 auth.controller.js    # Login, register, logout
│   │   │   ├── 📄 appointment.controller.js
│   │   │   ├── 📄 visit.controller.js   # Visit summaries
│   │   │   ├── 📄 chat.controller.js    # Chat messaging
│   │   │   ├── 📄 videoCall.controller.js
│   │   │   ├── 📄 admin.controller.js
│   │   │   ├── 📄 medicalHistory.controller.js
│   │   │   └── 📄 ...
│   │   ├── 📁 models/                   # Mongoose schemas
│   │   │   ├── 📄 user.model.js         # User schema with roles
│   │   │   ├── 📄 appointment.model.js  # Appointment bookings
│   │   │   ├── 📄 visitSummary.model.js # Clinical records
│   │   │   ├── 📄 chatSession.model.js  # Chat sessions
│   │   │   └── 📄 ...
│   │   ├── 📁 routes/                   # API route definitions
│   │   │   ├── 📄 auth.routes.js
│   │   │   ├── 📄 appointment.routes.js
│   │   │   ├── 📄 visit.routes.js
│   │   │   ├── 📄 chat.routes.js
│   │   │   ├── 📄 videoCall.routes.js
│   │   │   ├── 📄 admin.routes.js
│   │   │   └── 📄 ...
│   │   ├── 📁 middleware/               # Custom middleware
│   │   │   ├── 📄 auth.middleware.js    # JWT verification
│   │   │   ├── 📄 validation.middleware.js
│   │   │   └── 📄 rateLimit.middleware.js
│   │   ├── 📁 services/                 # Business logic services
│   │   │   └── 📄 email.service.js      # Email sending logic
│   │   └── 📁 utils/                    # Helper functions
│   │       ├── 📄 tokenGenerator.js     # Agora token generation
│   │       └── 📄 ...
│   ├── 📄 .env                          # Environment variables (git-ignored)
│   ├── 📄 .env.example                  # Environment template
│   ├── 📄 Dockerfile                    # Docker configuration
│   ├── 📄 docker-compose.yml            # Docker Compose setup
│   └── 📄 package.json                  # Dependencies and scripts
│
├── 📁 frontend/                         # Next.js + TypeScript Application
│   ├── 📁 src/
│   │   ├── 📁 app/                      # Next.js App Router (Pages)
│   │   │   ├── 📁 (auth)/               # Authentication pages (grouped)
│   │   │   │   ├── 📁 login/            # User login page
│   │   │   │   └── 📁 register/         # User registration page
│   │   │   ├── 📁 admin/                # Admin dashboard
│   │   │   │   └── 📁 doctors/          # Doctor management
│   │   │   ├── 📁 dashboard/            # Main dashboard (role-based)
│   │   │   ├── 📁 doctor/               # Doctor-specific pages
│   │   │   │   ├── 📁 appointments/     # Manage appointment requests
│   │   │   │   ├── 📁 patients/         # Patient list & details
│   │   │   │   ├── 📁 reports/          # Visit summary creation
│   │   │   │   └── 📁 chat/             # Patient communications
│   │   │   ├── 📁 patient/              # Patient-specific pages
│   │   │   │   ├── 📁 doctors/          # Browse available doctors
│   │   │   │   ├── 📁 appointments/     # View appointment history
│   │   │   │   ├── 📁 book-appointment/ # Schedule appointments
│   │   │   │   ├── 📁 reports/          # Access medical reports
│   │   │   │   └── 📁 chat/             # Doctor communications
│   │   │   ├── 📁 video-call/           # Video consultation room
│   │   │   ├── 📁 medical-history/      # Medical records view
│   │   │   ├── 📄 layout.tsx            # Root layout with providers
│   │   │   ├── 📄 page.tsx              # Landing page
│   │   │   └── 📄 globals.css           # Global styles
│   │   ├── 📁 components/               # Reusable React components
│   │   │   ├── 📄 Navbar.tsx            # Navigation bar
│   │   │   └── 📄 ...
│   │   ├── 📁 context/                  # React Context providers
│   │   │   └── 📄 AuthContext.tsx       # Authentication state
│   │   ├── 📁 lib/                      # Utility functions
│   │   │   └── 📄 api.ts                # API client with interceptors
│   │   └── 📁 types/                    # TypeScript type definitions
│   │       ├── 📄 user.ts
│   │       ├── 📄 appointment.ts
│   │       └── 📄 ...
│   ├── 📁 public/                       # Static assets
│   ├── 📄 .env.local                    # Environment variables (git-ignored)
│   ├── 📄 .env.example                  # Environment template
│   ├── 📄 next.config.ts                # Next.js configuration
│   ├── 📄 tailwind.config.ts            # Tailwind CSS configuration
│   ├── 📄 tsconfig.json                 # TypeScript configuration
│   ├── 📄 docker-compose.yml            # Docker Compose setup
│   └── 📄 package.json                  # Dependencies and scripts
│
├── 📄 architecture-diagram.jpeg         # System architecture diagram
└── 📄 README.md                         # This documentation file


📚 API Reference

Base URL

http://localhost:5000/api

🔐 Authentication Endpoints

Method Endpoint Description Auth Required
POST /api/auth/register Create new user account
POST /api/auth/login User login
POST /api/auth/logout User logout
POST /api/auth/refresh Refresh access token
GET /api/auth/me Get current user profile
POST /api/auth/logout-all Logout from all devices
GET /api/oauth/google Initiate Google OAuth
📝 Request/Response Examples

Register User:

POST /api/auth/register
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securePassword123",
  "role": "patient"
}

Login:

POST /api/auth/login
Content-Type: application/json

{
  "email": "john@example.com",
  "password": "securePassword123"
}

Response:

{
  "success": true,
  "user": {
    "_id": "user_id",
    "name": "John Doe",
    "email": "john@example.com",
    "role": "patient"
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIs..."
}

📅 Appointment Endpoints

Method Endpoint Description Auth Required
POST /api/appointments Create new appointment ✅ (Patient)
GET /api/appointments/doctor Get doctor's appointments ✅ (Doctor)
GET /api/appointments/patient Get patient's appointments ✅ (Patient)
PUT /api/appointments/:id/accept Accept appointment ✅ (Doctor)
PUT /api/appointments/:id/reject Reject appointment ✅ (Doctor)
PUT /api/appointments/:id/complete Mark as completed ✅ (Doctor)
📝 Request/Response Examples

Create Appointment:

POST /api/appointments
Authorization: Bearer <access_token>
Content-Type: application/json

{
  "doctorId": "doctor_object_id",
  "date": "2024-01-15",
  "time": "10:00",
  "reason": "Regular health checkup"
}

Accept Appointment:

PUT /api/appointments/:id/accept
Authorization: Bearer <access_token>

📋 Visit Summary Endpoints

Method Endpoint Description Auth Required
POST /api/visit-summary Create visit summary ✅ (Doctor)
GET /api/patient/visits Get patient's visit history ✅ (Patient)
GET /api/doctor/patients/:id/visits Get specific patient's visits ✅ (Doctor)
📝 Request/Response Examples

Create Visit Summary:

POST /api/visit-summary
Authorization: Bearer <access_token>
Content-Type: application/json

{
  "patientId": "patient_object_id",
  "appointmentId": "appointment_object_id",
  "symptoms": "Fever, headache, fatigue",
  "diagnosis": "Common cold with viral infection",
  "prescriptions": ["Paracetamol 500mg", "Rest for 3 days", "Fluids"],
  "notes": "Follow up in 1 week if symptoms persist",
  "vitals": {
    "bloodPressure": "120/80",
    "temperature": "99.5°F",
    "pulse": "78 bpm"
  }
}

📹 Video Call Endpoints

Method Endpoint Description Auth Required
POST /api/video-calls/generate-token Generate Agora RTC token
GET /api/video-calls/history Get call history
📝 Request/Response Examples

Generate Video Token:

POST /api/video-calls/generate-token
Authorization: Bearer <access_token>
Content-Type: application/json

{
  "channelName": "appointment_12345",
  "role": "publisher"
}

Response:

{
  "success": true,
  "token": "006xxxxxxxxxxxx...",
  "channel": "appointment_12345",
  "uid": 0
}

💬 Chat Endpoints

Method Endpoint Description Auth Required
POST /api/chat/sessions Create chat session
GET /api/chat/sessions Get user's chat sessions
GET /api/chat/sessions/:id Get session by ID
POST /api/chat/sessions/:id/messages Send message
GET /api/chat/sessions/:id/messages Get session messages
📝 Request/Response Examples

Create Chat Session:

POST /api/chat/sessions
Authorization: Bearer <access_token>
Content-Type: application/json

{
  "participantId": "other_user_id"
}

Send Message:

POST /api/chat/sessions/:sessionId/messages
Authorization: Bearer <access_token>
Content-Type: application/json

{
  "content": "Hello, Doctor! I have a question about my prescription."
}

⚙️ Admin Endpoints

Method Endpoint Description Auth Required
POST /api/admin/doctors Create doctor account ✅ (Admin)
GET /api/admin/doctors List all doctors ✅ (Admin)
GET /api/admin/doctors/:id Get doctor details ✅ (Admin)
PUT /api/admin/doctors/:id Update doctor ✅ (Admin)
DELETE /api/admin/doctors/:id Remove doctor ✅ (Admin)
📝 Request/Response Examples

Create Doctor:

POST /api/admin/doctors
Authorization: Bearer <access_token>
Content-Type: application/json

{
  "name": "Dr. Sarah Smith",
  "email": "dr.smith@medconnect.com",
  "password": "securePassword123",
  "specialization": "Cardiology",
  "qualifications": ["MBBS", "MD Cardiology"],
  "experience": 10
}


📱 Frontend Pages

Page Structure Overview

🌐 Public Pages

Route Page Description
/ Landing Page Welcome page with features overview
/login User Login Email/password and Google OAuth login
/register User Registration Create patient account

👤 Patient Pages

Route Page Description
/dashboard Patient Dashboard Overview with quick actions
/patient/doctors Browse Doctors View and select doctors by specialization
/patient/appointments My Appointments View appointment history and status
/patient/book-appointment Book Appointment Schedule new appointments
/patient/reports Medical Reports Access visit summaries and reports
/patient/chat Chat Message doctors

👨‍⚕️ Doctor Pages

Route Page Description
/dashboard Doctor Dashboard Patient overview and statistics
/doctor/appointments Manage Appointments Accept/reject appointment requests
/doctor/patients Patient List View and manage patients
/doctor/patients/[id] Patient Details Detailed patient profile and history
/doctor/reports Visit Summaries Create and manage clinical reports
/doctor/chat Chat Patient communications

⚙️ Admin Pages

Route Page Description
/admin/doctors Doctor Management Add, update, remove doctors

🔗 Shared Pages

Route Page Description
/video-call/[channelName] Video Room HD video consultation room
/medical-history Medical Records Complete medical history


📹 Video Consultations

MedConnect uses Agora RTC for secure, real-time HD video consultations.

Video Call Flow

┌─────────────┐         ┌─────────────┐         ┌─────────────┐         ┌─────────────┐
│   Patient   │         │   Frontend  │         │   Backend   │         │  Agora RTC  │
└──────┬──────┘         └──────┬──────┘         └──────┬──────┘         └──────┬──────┘
       │                       │                       │                       │
       │  Click "Join Call"    │                       │                       │
       │──────────────────────>│                       │                       │
       │                       │                       │                       │
       │                       │  POST /generate-token │                       │
       │                       │──────────────────────>│                       │
       │                       │                       │                       │
       │                       │                       │  Generate Secure      │
       │                       │                       │  Token + Channel      │
       │                       │                       │                       │
       │                       │    Return Token       │                       │
       │                       │<──────────────────────│                       │
       │                       │                       │                       │
       │                       │  Initialize Client    │                       │
       │                       │──────────────────────────────────────────────>│
       │                       │                       │                       │
       │                       │  Join Channel         │                       │
       │                       │──────────────────────────────────────────────>│
       │                       │                       │                       │
       │                       │    Connected          │                       │
       │                       │<──────────────────────────────────────────────│
       │                       │                       │                       │
       │  Show Video UI        │                       │                       │
       │<──────────────────────│                       │                       │
       │                       │                       │                       │

Video Features

Feature Description
HD Video/Audio High-quality real-time streaming
Mute/Unmute Audio control
Camera Toggle Turn camera on/off
Screen Share Share screen during consultation
Call Duration Track consultation time
Secure Tokens Temporary tokens for each session
Call History Record of all consultations


🔒 Security

Authentication Security

Feature Implementation
Password Hashing bcrypt with 12 salt rounds
Access Tokens JWT, 15-minute expiry, HTTP-only cookie
Refresh Tokens JWT, 7-day expiry, stored in database for revocation
Token Rotation New refresh token issued on each refresh
OAuth Google OAuth 2.0 via Passport.js

API Security

Feature Implementation
CORS Configured for specific frontend origins only
Rate Limiting Request throttling middleware
Input Validation Request data sanitization
Security Headers X-Frame-Options, X-Content-Type-Options, X-XSS-Protection
HTTPS Required in production

Frontend Security

Feature Implementation
XSS Protection React automatic escaping
CSRF Prevention Tokens included in API requests
Protected Routes Middleware guards for authenticated pages
Secure Storage No sensitive data in localStorage
Environment Variables Secrets never exposed to client


🚀 Deployment

Production URLs

Service Platform URL
Frontend Vercel medconnectlive.vercel.app
Backend Render
Database MongoDB Atlas

Production Checklist

✅ Set NODE_ENV=production
✅ Use strong, unique JWT secrets (min 32 characters)
✅ Configure production MongoDB URI (MongoDB Atlas recommended)
✅ Update FRONTEND_URL to production domain
✅ Set secure COOKIE_DOMAIN
✅ Enable HTTPS
✅ Set secure cookie flags
✅ Configure rate limiting
✅ Set up monitoring and logging
✅ Configure backup strategy
✅ Set up error tracking (e.g., Sentry)

Deployment Platforms

Vercel (Frontend - Recommended)

# Using Vercel CLI
npm install -g vercel
cd frontend
vercel

# Or connect GitHub repo directly to Vercel Dashboard

Render (Backend)

  1. Connect GitHub repository to Render
  2. Add environment variables in Render dashboard
  3. Render auto-detects Node.js and deploys

Docker Deployment

Backend Dockerfile:

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 5000
CMD ["node", "src/app.js"]

Frontend Dockerfile:

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]

Run with Docker:

# Backend
cd backend
docker build -t medconnect-backend .
docker run -p 5000:5000 --env-file .env medconnect-backend

# Frontend
cd frontend
docker build -t medconnect-frontend .
docker run -p 3000:3000 medconnect-frontend

Other Platforms

Platform Notes
Heroku Add Procfile with web: node src/app.js
DigitalOcean Use App Platform or Droplets
AWS EC2, Elastic Beanstalk, or Lambda
Render Direct deployment from Git
Netlify Frontend only, use Netlify Functions for API


🐛 Troubleshooting

Common Issues

MongoDB Connection Issues

# Check if MongoDB is running
mongod --version

# Common fixes:
# 1. Verify MONGODB_URI format in .env
# 2. Check network connectivity
# 3. If using Atlas, whitelist your IP address
# 4. Verify MongoDB credentials

OAuth Not Working

  • Verify Google OAuth credentials in Google Cloud Console
  • Check that callback URL matches exactly: http://localhost:5000/api/oauth/google/callback
  • Ensure FRONTEND_URL is correctly set
  • Verify authorized redirect URIs in Google Console

Email Not Sending

  • Use Gmail App Password, not your regular password
  • Generate App Password: Google Account → Security → 2-Step Verification → App Passwords
  • Check SMTP settings in .env
  • Verify the email account is not blocked

Video Calls Failing

  • Verify Agora App ID and Certificate in both frontend and backend
  • Check browser permissions for camera/microphone
  • Ensure backend token generation endpoint is working
  • Check Agora Console for app status and usage limits

Frontend Build Errors

# Clear cache and reinstall dependencies
rm -rf .next node_modules
npm install
npm run build

Port Already in Use

# Frontend - use different port
PORT=3001 npm run dev

# Backend - change PORT in .env
PORT=5001

TypeScript Errors

# Regenerate types
npm run build

# Check for missing dependencies
npm install


🧪 Testing

# Backend health check
curl http://localhost:5000/health

# Run backend tests (if configured)
cd backend && npm test

# Run frontend linting
cd frontend && npm run lint

# Type check
cd frontend && npx tsc --noEmit


🎨 UI/UX Features

Feature Description
Modern Design Gradient-based color scheme with violet/fuchsia accents
Responsive Layout Mobile-first design that works on all devices
Smooth Animations Micro-interactions and transitions
Dark Mode Ready Architecture supports theme switching
Accessible WCAG compliant with proper ARIA labels
Loading States Skeleton screens and loading indicators
Error Handling User-friendly error messages
Form Validation Real-time validation feedback




📧 Support

For questions or issues:

  • 📋 Open an issue in the repository
  • 📧 Contact the development team
  • 📖 Check existing documentation


🏥 MedConnect

🌐 Live Demo · 🎬 Video Demo · ⬆️ Back to Top




© 2026 MedConnect

Popular repositories Loading

  1. Syntax_Errors_Frontend Syntax_Errors_Frontend Public

    MedTech

    TypeScript

  2. Syntax_Errors_Backend Syntax_Errors_Backend Public

    medtech

    JavaScript

  3. .github .github Public

    MedConnect a unified workspace for patients and doctors to coordinate visits, communication and documentation

Repositories

Showing 3 of 3 repositories

Top languages

Loading…

Most used topics

Loading…