Skip to content

Instantly share code, notes, and snippets.

@duonghuuphuc
Created March 2, 2025 12:51
Show Gist options
  • Save duonghuuphuc/68f48d32fee793556db616848130b085 to your computer and use it in GitHub Desktop.
Save duonghuuphuc/68f48d32fee793556db616848130b085 to your computer and use it in GitHub Desktop.
Case Study: Determining Microservice Boundaries in a Hospital Management System

Case Study: Determining Microservice Boundaries in a Hospital Management System

Background

CityCare Hospital operates with a legacy monolithic Hospital Management System (HMS) that handles various healthcare operations. The hospital administration has decided to migrate to a microservices architecture to improve scalability, maintainability, and performance. Your task is to analyze the monolithic system and propose a microservices-based architecture by identifying service boundaries.

Existing Monolithic System

The HMS is a single large application that includes the following functionalities:

  1. Patient Management: Registers patients, updates their information, and maintains medical history.
  2. Appointment Scheduling: Manages doctor appointments, availability, and patient scheduling.
  3. Doctor and Staff Management: Stores doctor and staff information, including credentials, schedules, and payroll.
  4. Billing & Insurance Processing: Handles patient billing, insurance verification, claims, and payments.
  5. Pharmacy Management: Manages inventory, prescriptions, and medicine stock levels.
  6. Laboratory Management: Supports test requests, reports, and results integration with patient records.
  7. Emergency & Ambulance Services: Tracks emergency cases and ambulance dispatch coordination.
  8. Notifications & Alerts: Sends SMS/Email reminders for appointments, lab results, and payment due dates.

Exercise Instructions

Your goal is to determine the microservice boundaries when migrating to a microservices architecture. Follow these steps:

Step 1: Identify Business Capabilities

  • Break down the monolithic system into distinct business capabilities.
  • Which functionalities can be separated based on domain-driven design principles?

Step 2: Define Microservice Boundaries

  • Based on the business capabilities, group related functionalities into possible microservices.
  • Ensure each microservice aligns with the Single Responsibility Principle (SRP).

Step 3: Consider Data Ownership & Communication

  • Identify which microservices need separate databases.
  • Define how services will communicate (REST API, event-driven messaging, etc.).
  • Decide where to minimize dependencies to avoid tight coupling.

Step 4: Handle Cross-cutting Concerns

  • Identify functionalities like authentication, logging, and monitoring.
  • Decide whether they should be part of individual services or handled centrally.

Step 5: Present Your Solution

  • Create a diagram showing the proposed microservices and their interactions.
  • Provide reasoning behind the service boundaries you defined.

Discussion Questions

  1. How did you determine the boundaries of each microservice?
  2. What challenges did you face in deciding which functionalities belong together?
  3. How would you ensure data consistency across microservices?
  4. Which functionalities require synchronous vs. asynchronous communication?
  5. What are the risks of breaking the system into too many microservices?

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment