Skip to content

🏥 A scalable, containerized Healthcare Microservices System built with Java 17, Spring Boot, Kafka, gRPC, and PostgreSQL. Features include secure authentication, real-time analytics, and robust patient/billing management.

Notifications You must be signed in to change notification settings

khan-sk-dev/Healthcare-Microservices-System

Repository files navigation

🏥 Healthcare Microservices System

Healthcare Microservices Banner

Java Spring Boot gRPC Kafka PostgreSQL Docker

A scalable and modular Healthcare Management System built using a microservices architecture. This enterprise-grade solution enables seamless patient management, billing operations, analytics, and more, all while maintaining high security standards and performance.


📋 Table of Contents


🌟 Key Features

  • Microservices Architecture: Modular, scalable, and maintainable services
  • API Gateway: Centralized entry point with routing and cross-cutting concerns
  • Authentication & Authorization: Secure user access control
  • Patient Management: Comprehensive patient data management
  • Billing Operations: Streamlined healthcare billing processes
  • Analytics: Real-time and historical data analysis
  • Containerization: Docker-based deployment for consistency across environments

🔧 Tech Stack

Layer Tech
Backend Java 17, Spring Boot
API Gateway Spring Cloud Gateway
Inter-Service Communication gRPC
Asynchronous Messaging Apache Kafka
Database PostgreSQL
Build Tool Maven
Containerization Docker, Docker Compose
Testing JUnit, Integration Tests

📂 Project Structure

📁 analytics-service       → Tracks and logs analytics data
📁 api-gateway             → Handles routing and cross-cutting concerns
📁 api-requests            → Shared DTOs across microservices
📁 auth-service            → Handles user authentication and security
📁 billing-service         → Manages billing operations and payment records
📁 grpc-requests           → Protobuf contracts for gRPC communication
📁 infrastructure          → Kafka, DB configurations, Docker setup
📁 integration-tests       → System-wide integration tests
📁 patient-service         → Manages patient records and data
📁 .vscode, .gitignore     → Dev environment configurations
📄 docker-compose.yml      → Spin up the entire system locally

🏗 Architecture

Comprehensive architecture diagram coming soon!

The system follows a clean microservices architecture with:

  • Bounded contexts: Each service handles a specific business domain
  • API Gateway: Single entry point for external clients
  • Service Discovery: Automatic registration and discovery of services
  • Circuit Breaking: Preventing cascading failures across services
  • Distributed Tracing: Tracking request flows across services

🚀 Getting Started

✅ Prerequisites

  • Java 17+
  • Docker & Docker Compose
  • Maven 3.8+
  • Kafka & PostgreSQL (auto-configured in Docker)

📦 Run Locally

# Clone the repository
git clone https://github.com/khan-sk-dev/Healthcare-Microservices-System.git
cd Healthcare-Microservices-System

# Start all services using Docker Compose
docker-compose up --build

🔄 Inter-Service Communication

gRPC

Used for internal synchronous communication between microservices (e.g., patient-servicebilling-service).

Each service contains:

  • Protobuf .proto definitions inside grpc-requests
  • protobuf-maven-plugin setup in pom.xml
  • gRPC server/client configurations

Kafka

Used for asynchronous messaging (e.g., notifications, logging).

Kafka Topics Example:

spring.kafka.bootstrap-servers=kafka:9092
spring.kafka.consumer.group-id=healthcare-group
spring.kafka.template.default-topic=healthcare-events

Kafka topics are produced and consumed in services like notification-service and analytics-service.


🔐 Security

  • auth-service implements Spring Security
  • JWT for token handling
  • Login and token verification endpoints
  • Secured internal and public APIs
  • Role-based access control

🧪 Testing

  • Unit tests across microservices
  • Integration tests using integration-tests module
  • JUnit and Spring Boot Test used for coverage
  • Continuous integration with automated test execution

📜 Environment Variables

Each microservice supports the following .env or system variables:

Variable Description
SPRING_DATASOURCE_URL PostgreSQL DB URL
KAFKA_BOOTSTRAP_SERVERS Kafka broker location
JWT_SECRET Secret key for token signing
SERVER_PORT Custom port per microservice

📘 Useful Commands

# Clean and install all services
mvn clean install

# Compile Protobuf contracts
mvn protobuf:compile

# View running services
docker ps

# View service logs
docker-compose logs -f [service-name]

# Run specific service
docker-compose up -d [service-name]

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


👨‍💻 Author

صہیب خانGitHub


Star this repo if you find it useful!

Stars

About

🏥 A scalable, containerized Healthcare Microservices System built with Java 17, Spring Boot, Kafka, gRPC, and PostgreSQL. Features include secure authentication, real-time analytics, and robust patient/billing management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published