Patient Management Service
A microservice-based management application I worked on to learn more about designing microservice at management level, utilize different API service such as gRPC, REST, WebSocket, and softwares such as Kafka that handles message queue system
Inspiration
My inspiration for this project came from my interest in system design and understanding how popular e-commerce sites are built to handle complex business logic. While drawing system design diagrams and designing applications in domains such as e-commerce, I became curious about how different components interact to support essential features like shopping carts, order management, inventory tracking, and payment processing. I wanted to explore how these systems handle transactions, maintain data consistency, and communicate across multiple services.
What it does
This project is currently a work in progress, with two microservices implemented so far; a Patient Service and a Billing Service. Built using Java and Spring Boot, these services communicate through gRPC, which utilizes Proto Buffer for microservice communication. For example, when a new patient registers, the Patient Service automatically sends a gRPC request to the Billing Service to create a billing account on their behalf. Docker is also used to containerize the services and provide consistent runtime environments. What initially started as an effort to better understand system design and microservices architecture has evolved into a hands-on exploration of distributed systems, with plans to introduce additional services and explore concepts such as asynchronous communication, API gateways, and fault tolerance.
How I built it
I started by designing the system architecture using Excalidraw and defined the core entities and their relationships. The Patient Service, built with Spring Boot, handles patient registration, profile management, and appointment scheduling. It uses JPA with Hibernate to interact with a PostgreSQL database. For inter-service communication, I implemented gRPC, defining Proto Buffer schemas for patient data transfer. The Billing Service, also built with Spring Boot, is responsible for managing patient billing, invoices, and payment records. It uses Spring Data JPA with MySQL and also has gRPC endpoints for receiving patient data from the Patient Service.
Challenges I ran into
Biggest challenge, simply put, configuring the pom.xml file for each microservice. With addition to new tools such as gRPC, pom.xml had to be updated every time and with the updates, I had to look into compatible versions for each tool. But what I came to realize was that most dependency issues can easily be fixed if we take advantage of the Sync and Rebuild service feature available within Maven.
Accomplishments I'm proud of
Working with Kafka, a message queue system. I remember my first time working with Kafka within IBM cloud environment and I absolutely hated it. The configuration was a nightmare, setting up Kafka in a local environment was an even bigger nightmare. But as I got the hang of it, I started to realize its potential and how important it is for an application that might need to handle large amounts of messages and the importance of it for communication between microservice in a distributed environment.
What I learned
I learned a lot about designing low level system. Before this, my idea of a low level design system was simple: review pre and post condition, look out for edge cases, see if the implementation satisfies all requirements, done. But as I started learning more about Object Oriented Design and Principles, I realized that there are so many moving parts. And the beauty of it, being how one class can be used in so many different ways, without having to implement a class from scratch
What's next
Next step is to add two other services that handle much more complex logic. I will also have to look into how one .proto file is used for all of the different microservice, rather than using separate .proto files for each individual microservice
One thing I'd redo
I have yet to figure this part out, hopefully will be able to as I finish up the rest of the service :)