/hospital-management-system

A secure, real-time platform for video consultations, chat, notifications, appointment bookings, and file uploads with seamless payment integration.

Primary LanguageTypeScript

🌿 AVM Ayurvedic

Bridging ancient Ayurvedic wisdom with modern technology

Website Frontend Backend Demo



🌟 Show Your Support

If you find this project useful, please consider giving it a star on GitHub! Your support helps us grow and improve.


🚀 Key Features

📹 Video Consultations 🤖 AI-Powered Wellness 📅 Smart Booking 💳 Secure Payments
📊 Admin Dashboard 🔔 Real-time Notifications 🔐 Robust Authentication 🖼️ Secure File Uploads

💻 Tech Stack

🎨 Frontend

Next JS TypeScript React TailwindCSS Radix UI Socket.io-client WebRTC Simple Peer OAuth
Google Axios React Query Stripe Firebase Framer Motion Zod React Hook Form Recharts

⚙️ Backend

Node.js Express.js MongoDB AWS Stripe JWT NGINX Socket.io Google AI Joi Winston

🛠 DevOps & Tools

SEO Google Analytics Vercel Analytics Open Graph Twitter Card Figma Clean Architecture SOLID Principles Nginx Git GitHub GitHub Actions Vercel ESLint Prettier npm Postman


🏗️ Architecture Highlights

  • 🧱 Clean Architecture: Modular, scalable, and maintainable
  • 🔒 Secure Transactions: Stripe payment gateway integration
  • 🚀 Real-time Communication: Powered by Socket.io
  • 📊 Comprehensive Logging: Winston for robust error tracking
  • 🧩 Reusable Components: Enhancing code reusability and consistency

Explore Services | Book Consultation | More About Our Services

Contributions are welcome! Please feel free to submit a Pull Request.

AVM Ayurvedic Project Setup

⚡ Quick Start

# Clone and install
git clone https://github.com/sinanptm/avm-ayurvedic
cd avm-ayurvedic
pnpm install

# Set up environment files and start
pnpm dev

⚙️ Detailed Setup Guide

1️⃣ Installation
  1. Clone the repository:

    git clone https://github.com/sinanptm/avm-ayurvedic
    cd avm-ayurvedic
  2. Install dependencies:

    pnpm install
    
2️⃣ Environment Configuration
  1. Server Environment (.env in /server):
# Database
MONGODB_URL=mongodb://localhost:27017/AVM

# Server Configuration
PORT=8000
NODE_ENV=dev
CLIENT_URL=http://localhost:3000

# Email Service
SENDER_EMAIL=test@example.com
NODEMAILER_PASSKEY=test-nodemailer-passkey

# Authentication
ACCESS_TOKEN_SECRET=test-access-token-secret
REFRESH_TOKEN_SECRET=test-refresh-token-secret

# AWS S3
AWS_REGION=eu-north-1
AWS_ACCESS_KEY_ID=test-aws-access-key-id
AWS_SECRET_ACCESS_KEY=test-aws-secret-access-key
S3_BUCKET_NAME=test-avm-ayurvedic-bucket

# Payment Processing
STRIPE_PUBLISHABLE_KEY=pk_test_XXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_SECRET_KEY=sk_test_XXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_WEBHOOK_SECRET=whsec_XXXXXXXXXXXXXXXXXXXXXXXX

# AI Integration
GEMINI_API_KEY=test-gemini-api-key
  1. Client Environment (.env in /client):
# Environment
NEXT_PUBLIC_ENV=development

# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:8000/api
NEXT_PUBLIC_BASE_API_URL=http://localhost:8000

# Firebase Authentication
NEXT_PUBLIC_FIREBASE_API_KEY=test-firebase-api-key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=test-firebase-auth-domain
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=test-firebase-messaging-sender-id
NEXT_PUBLIC_FIREBASE_APP_ID=test-firebase-app-id
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=test-firebase-measurement-id

# Payment Integration
NEXT_PUBLIC_STRIPE_KEY=pk_test_XXXXXXXXXXXXXXXXXXXXXXXX

# Video Call Integration
NEXT_PUBLIC_METERED_TURN_USERNAME=test-metered-turn-username
NEXT_PUBLIC_METERED_TURN_CREDENTIAL=test-metered-turn-credential
3️⃣ Third-Party Services Setup

1. Stripe Integration

  • Tutorial: Watch Stripe Setup Guide
  • Steps:
    1. Install Stripe CLI:
      npm install -g stripe
    2. Authenticate with Stripe:
      stripe login
    3. Important: Add Stripe API keys to your server's .env file:
      STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key
      STRIPE_SECRET_KEY=sk_test_your_secret_key
      STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret

2. Metered TURN Server

  • Reference: Metered Website
  • Steps:
    1. Sign up for a Metered account
    2. Navigate to the TURN server section in your dashboard
    3. Key Step: Generate TURN credentials
    4. Important: Update the client's .env file with:
      NEXT_PUBLIC_METERED_TURN_USERNAME=your_turn_username
      NEXT_PUBLIC_METERED_TURN_CREDENTIAL=your_turn_credential

3. Google Gemini AI

  • Tutorial: Watch Gemini AI Setup Guide
  • Steps:
    1. Access Google Cloud Console
    2. Create a new project or select an existing one
    3. Navigate to APIs & Services dashboard
    4. Key Step: Enable the Gemini API for your project
    5. Create API credentials (API key)
    6. Important: Add the API key to your server's .env file:
      GEMINI_API_KEY=your_gemini_api_key

4. AWS S3

  • Tutorial: Watch AWS S3 Configuration Guide

  • Steps:

    1. Sign in to the AWS Management Console
    2. Navigate to S3 and create a new bucket
    3. Configure bucket settings (e.g., region, access control)
    4. Key Step: Generate AWS access keys from the IAM dashboard
    5. CORS: Check this issue
    6. Important: Update your server's .env file with:
      AWS_REGION=your_selected_region
      AWS_ACCESS_KEY_ID=your_access_key_id
      AWS_SECRET_ACCESS_KEY=your_secret_access_key
      S3_BUCKET_NAME=your_bucket_name

    eg: S3 Policy should be like this:

    {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Sid": "PublicReadGetObject",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::avm-ayurvedic-2/*"
      }
    ]

}

5. Nodemailer Setup

  • Tutorial: Watch Nodemailer Configuration Guide
  • Steps:
    1. Enable 2-Step Verification for your Gmail account
    2. Key Step: Generate an App Password in your Google Account settings
    3. Important: Update your server's .env file with:
      SENDER_EMAIL=your_gmail_address
      NODEMAILER_PASSKEY=your_generated_app_password

6. Firebase Configuration

  • Tutorial: Watch Firebase Setup Guide
  • Steps:
    1. Go to the Firebase Console
    2. Create a new Firebase project
    3. Add a web app to your project
    4. Key Step: Copy the Firebase configuration object
    5. Important: Update your client's .env file with:
      NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
      NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
      NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
      NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
      NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
      NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id

⚠️ Security Note: Always keep your API keys and credentials secure. Never commit them to version control. Use environment variables as shown in the examples above.

4️⃣ Admin Dashboard Configuration
  1. Database Setup:
// Insert into 'doctors' collection
{
  "_id": { "$oid": "66f43da6474baf6855725456" },
  "email": "your-admin-email@example.com",
  "password": "$2a$10$g4YLaUSEWC/tJvq0jmbw6e1aS423WTqepWqH6V8PjRtrfXMxOjcca",
  "image": "",
  "isBlocked": false,
  "name": "Admin",
  "phone": "2312371239",
  "role": "admin",
  "qualifications": [],
  "token": "",
  "isVerified": false,
  "createdAt": { "$date": "2024-09-25T16:43:18.340Z" },
  "updatedAt": { "$date": "2024-10-09T02:36:37.556Z" }
}
  1. Initial Login:
  • Email: your configured admin email
  • Password: 1Admin@pass (can change this later)
5️⃣ Running the Application

Option A: Single Command (Recommended)

# From root directory
npm run dev

Option B: Individual Services

# Terminal 1 - Server
cd server
npm run dev

# Terminal 2 - Client
cd client
npm run dev

# Terminal 3 - Stripe (only if running servers separately)
stripe listen --forward-to localhost:8000/webhook
6️⃣ Access Points
  • Client Application: http://localhost:3000
  • Server API: http://localhost:8000/api
  • Admin Dashboard: http://localhost:3000/admin
  • Doctor Dashboard: http://localhost:3000/doctor
7️⃣ How to Change Admin Password
  1. Create a new doctor/patient account through the application
  2. Go to your MongoDB database
  3. Find the newly created account's password hash
  4. Copy this password hash
  5. Locate the admin document in the doctors collection
  6. Replace the admin's password field with the copied hash
  7. You can now use the new account's password to login as admin

GitHub Stars GitHub Forks Open Issues Closed Issues

For additional help or issues, please open a GitHub issue or contact me through email or any links from my profile.

Made with ❤️ by sinanptm