Skip to content

Ranjan-11/doctor-appointment-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# 🏥 Doctor Appointment Microservices Platform

A **scalable enterprise backend system** for booking doctor appointments built using **Spring Boot Microservices Architecture**.

---

## ✨ Project Overview

This project demonstrates a **production-style distributed backend system** where multiple services collaborate to manage doctor appointments, payments, and notifications.

The system implements **modern backend patterns** used by real companies:

* 🧩 Microservices Architecture

* 🔐 JWT Authentication

* 📡 Event Driven Communication (Kafka)

* 🔁 Saga Pattern for Distributed Transactions

* ⚡ Redis Distributed Lock

* 💳 Stripe Payment Integration

* 🔔 Multi-Channel Notification System

---

# 🧱 System Architecture


           👤 Client

              │

              ▼

        🚪 API Gateway

              │

 ┌────────────┼─────────────┐

 │            │             │

 ▼            ▼             ▼

🔐 Auth     👨‍⚕️ Doctor     🧑 Patient

 Service     Service        Service

 │

 ▼

📅 Booking Service

 │

 ▼

💳 Payment Service

 │

 ▼

🔔 Notification Service

 │

 ▼

📡 Kafka Event Bus

 │

 ▼

⚡ Redis Lock

 │

 ▼

🗄️ MySQL Database

---

# 🧩 Microservices

| Service | Description |

| --------------------------- | ----------------------------------------------------- |

| 🚪 **API Gateway** | Central entry point for all APIs |

| 🔐 **Auth Service** | Handles registration, login, OTP verification and JWT |

| 👨‍⚕️ **Doctor Service** | Doctor profiles, schedules, search |

| 🧑 **Patient Service** | Patient management |

| 📅 **Booking Service** | Appointment booking with Saga pattern |

| 💳 **Payment Service** | Stripe checkout & refund system |

| 🔔 **Notification Service** | Email, SMS, WhatsApp, Push notifications |

| 🧭 **Eureka Server** | Service discovery |

---

# 🛠️ Tech Stack

### ⚙️ Backend

* ☕ **Java 21**

* 🌱 **Spring Boot**

* ☁️ **Spring Cloud**

* 🔐 **Spring Security + JWT**

### 🧠 Infrastructure

* 📡 **Apache Kafka**

* ⚡ **Redis**

* 🗄️ **MySQL**

* 🧭 **Eureka Service Discovery**

### 💳 Integrations

* 💳 **Stripe Payment Gateway**

* ☎️ **Twilio SMS**

* 📲 **Firebase Push Notification**

---

# 🚀 Key Features

✔ User Registration with OTP

✔ Secure JWT Authentication

✔ Doctor Search by specialization & location

✔ Appointment Booking System

✔ Distributed Transaction using **Saga Pattern**

✔ Payment Processing with **Stripe**

✔ Event-Driven Architecture with **Kafka**

✔ Redis Distributed Lock to prevent duplicate bookings

✔ Multi-channel notifications

---

# 🔄 Booking Flow


User → API Gateway

     → Booking Service

     → Kafka Event (BookingCreated)

     → Payment Service

     → Payment Success Event

     → Booking Confirmation

     → Notification Service

---

# 📡 Kafka Event Flow


Booking Created

      │

      ▼

Kafka Topic

      │

      ▼

Payment Service

      │

      ▼

Notification Service

---

# ▶️ How To Run The Project

### 1️⃣ Start Infrastructure

Start these services first:


MySQL

Redis

Zookeeper

Kafka

---

### 2️⃣ Start Microservices

Run services in this order:


1 Eureka Server

2 API Gateway

3 Auth Service

4 Doctor Service

5 Patient Service

6 Booking Service

7 Payment Service

8 Notification Service

---

# 📡 API Endpoints

### 🔐 Authentication


POST /api/v1/auth/register

POST /api/v1/auth/login

POST /api/v1/auth/verify-otp

POST /api/v1/auth/logout

---

### 👨‍⚕️ Doctor


GET /api/v1/doctors/search

POST /api/v1/doctors/create

GET /api/v1/doctors/getById/{id}

---

### 🧑 Patient


POST /api/v1/patients/create-patient

GET /api/v1/patients/getById/{id}

---

### 📅 Booking


POST /api/v1/bookings/create-booking

POST /api/v1/bookings/create-with-payment

PUT /api/v1/bookings/cancel/{id}

---

### 💳 Payment


POST /api/v1/payments/checkout/{bookingId}

POST /api/v1/payments/refund/booking/{bookingId}

---

# 🔐 Security

Sensitive credentials are **NOT stored in the repository**.

Environment variables are used for:


Stripe Keys

AWS Credentials

Twilio Tokens

Firebase Credentials

Database Passwords

Create a local .env file before running the system.

---

# 📊 Future Improvements

* 🐳 Dockerize all services

* 📈 Add Prometheus + Grafana monitoring

* 📜 Centralized logging with ELK Stack

* ⚡ API Rate Limiting

* 🔄 CI/CD Pipeline

---

# 👨‍💻 Author

**Ranjan Kumar Singh**

Backend Engineer

Java • Spring Boot • Microservices • Kafka • Redis

About

Doctor Appointment Microservices Platform built using Spring Boot, Kafka, Redis, Stripe ,Saga Pattern and Circuit Breaker.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages