Skip to content

๐Ÿฅ QuickClinic is a healthcare appointment system built using Spring Boot Microservices Architecture. It features modular services for Patients, Doctors, Appointments, Notifications (via Kafka), and secure Authentication using JWT. Designed for scalability, maintainability, and real-world deployment.

Notifications You must be signed in to change notification settings

aryan735/QuickClinic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

65 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš‘ QuickMedic - Hospital Management Microservices

QuickMedic is a scalable microservices-based hospital management system built using Spring Boot, designed with clean REST APIs, role-based security, modular architecture, and now includes service discovery and API gateway integration.


๐Ÿš€ Features

โœ… Authentication & Authorization

  • JWT-based authentication
  • Role-based access control (USER, ADMIN)

โœ… Admin Capabilities

  • Grant admin role to users
  • View all users or fetch by ID
  • Delete users and clean associated roles

โœ… User Capabilities

  • Secure registration (BCrypt password encoding)
  • Login to receive JWT tokens

โš™๏ธ Microservices Architecture

Microservice Description
Service Registry Built with Eureka Server for service discovery
API Gateway Central entry point using Spring Cloud Gateway
UserAuth Service Handles login, registration, and role-based auth
(Planned) Patient Service Will handle patient records & appointment mgmt

๐Ÿ’ป Tech Stack

  • Java 17
  • Spring Boot 3.0.5
  • Spring Cloud 2022.0.5
  • Spring Security + JWT
  • Eureka Server & Client
  • Spring Cloud Gateway
  • MySQL (user data)

๐Ÿ‘‰ Planned Additions:

  • Redis (for caching)
  • Kafka (for event streaming)
  • Docker (for containerization & deployment)

๐Ÿ“‚ Key API Endpoints

Endpoint Method Access Description
/public/register POST Public Register a new user
/public/login POST Public Login & receive JWT token
/admin/grant-admin/id/{id} POST ADMIN Grant admin privileges
/admin/get-user-details/id/{id} GET ADMIN Fetch specific user details
/admin/get-users GET ADMIN Get all registered users
/admin/delete-user-by-Id/{id} DELETE ADMIN Delete user and roles

โœ… All routes are now accessible through the API Gateway (http://localhost:8085/...)


๐Ÿ›  Run Locally

git clone https://github.com/aryan735/QuickClinic
cd QuickClinic
mvn clean install

Start services in order:

  1. Service Registry (Eureka)
  2. UserAuth Service
  3. API Gateway

โœ… Configure application.yml / application.properties for MySQL and Eureka


๐Ÿ“ฆ Git Hygiene

This project uses a .gitignore to exclude:

  • Build artifacts (target/)
  • IDE configs (.idea/, *.iml)
  • Logs, OS temp files
  • Environment secrets (.env)

๐Ÿ”ฎ Planned Enhancements

  • โœ… Service Registry with Eureka
  • โœ… Spring Cloud Gateway
  • โ˜‘๏ธ Patient microservice
  • โ˜‘๏ธ Redis caching
  • โ˜‘๏ธ Kafka for audit/event streaming
  • โ˜‘๏ธ Dockerized deployment
  • โ˜‘๏ธ Swagger UI integration
  • โ˜‘๏ธ API rate limiting & monitoring

QuickClinic Patient Microservice & Kafka Setup Documentation


๐ŸŒ Project Context

This documentation captures all the core changes and configurations made to the Patient Microservice in the QuickClinic project. It includes:

  • Microservice setup and structure
  • Kafka integration setup using Docker Compose
  • JavaMailSender configuration
  • Git commands and best practices for commit

๐Ÿ“‚ Directory Structure (Updated)

QuickClinic/
โ”œโ”€โ”€ quickclinic-patient/
โ”‚   โ”œโ”€โ”€ src/main/java/com/quickclinic/patient/
โ”‚   โ”‚   โ”œโ”€โ”€ controller/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ PatientController.java
โ”‚   โ”‚   โ”œโ”€โ”€ dtos/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ PatientRequestDto.java
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ PatientResponseDto.java
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ PatientUpdateDto.java
โ”‚   โ”‚   โ”œโ”€โ”€ entity/PatientModel.java
โ”‚   โ”‚   โ”œโ”€โ”€ repository/PatientRespository.java
โ”‚   โ”‚   โ”œโ”€โ”€ service/PatientService.java
โ”‚   โ”‚   โ”œโ”€โ”€ exceptions/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ GlobalException.java
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ExceptionModel.java
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ PatientException.java
โ”‚   โ”‚   โ”œโ”€โ”€ client/UserClient.java
โ”‚   โ””โ”€โ”€ resources/application.yml
โ”œโ”€โ”€ docker/
โ”‚   โ””โ”€โ”€ kafka-init.sh
โ”œโ”€โ”€ docker-compose.yml

๐Ÿš€ Kafka + JavaMailSender Setup

application.yml (Patient Microservice)

spring:
  kafka:
    bootstrap-servers: localhost:9092
    consumer:
      group-id: patient-mail-group
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
      properties:
        spring:
          json:
            trusted:
              packages: com.quickclinic.patient.dtos
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer

  mail:
    host: smtp.gmail.com
    port: 587
    username: your-email@gmail.com
    password: your-password
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true

docker-compose.yml

version: '3.8'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:7.4.0
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    ports:
      - "2181:2181"

  kafka:
    image: confluentinc/cp-kafka:7.4.0
    ports:
      - "9092:9092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    depends_on:
      - zookeeper

kafka-init.sh

#!/bin/bash

sleep 10

kafka-topics.sh --create \
  --bootstrap-server kafka:9092 \
  --replication-factor 1 \
  --partitions 3 \
  --topic patient-mail-topic \
  --if-not-exists

Ensure the script uses LF line endings, not CRLF. VS Code โž” Bottom-right corner โž” Set to LF


๐Ÿ“ƒ Git Commands Used

# Stage docker folder & files
git add docker/
git add docker-compose.yml

# Optional: re-stage LF-safe script
git rm --cached docker/kafka-init.sh
git add docker/kafka-init.sh

# Commit message
git commit -m "chore(docker): added docker-compose setup and Kafka topic initializer script"

# Push to GitHub
git push origin main

# Later commit for config updates:
git add .
git commit -m "Added kafka config, database config, java mail sender config"
git push origin main

๐Ÿ”Œ Kafka Integration (Infrastructure Setup)

We have integrated self-hosted Kafka into QuickClinic using Docker Compose to enable asynchronous communication between microservices.

๐Ÿ“ฆ Technologies Used

  • Kafka (via confluentinc/cp-kafka:7.4.0)
  • Zookeeper (via confluentinc/cp-zookeeper:7.4.0)
  • Docker Compose

๐Ÿ“‚ Location

Kafka and Zookeeper are defined in the docker-compose.yml file at the root of the project.

โœ… Current Status

  • Kafka & Zookeeper are fully set up and running using Docker.
  • Docker Compose ensures Kafka runs alongside other services in both development and production environments.
  • Topics can be managed via CLI (kafka-topics).

๐Ÿ”œ Upcoming Integration Plan

We will use Kafka for event-driven communication:

  • PatientService will publish events (e.g., patient.registered)
  • NotificationService will consume those events and send confirmation emails

Kafka will allow our services to remain decoupled, scalable, and more resilient.


๐Ÿ›ฐ๏ธ Kafka Integration (Self-Hosted)

  • Set up Kafka & Zookeeper via Docker Compose for local development and production deployment.
  • Patient microservice:
    • Publishes PatientRegisteredEvent to topic patient.registered upon new application.
  • Notification service:
    • Listens to patient.registered topic using Kafka Consumer.
    • Sends a confirmation email with full application data to the patient.
  • Fully logged with SLF4J for observability and debugging.

๐Ÿ“ Last Updated: July 2025

๐Ÿ™Œ Author

Aryan Raj ๐Ÿ“ง aryanraj.dev.net@gmail.com ๐Ÿ”— LinkedIn ๐Ÿ”— X

About

๐Ÿฅ QuickClinic is a healthcare appointment system built using Spring Boot Microservices Architecture. It features modular services for Patients, Doctors, Appointments, Notifications (via Kafka), and secure Authentication using JWT. Designed for scalability, maintainability, and real-world deployment.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published