HIS: Architecting a Scalable Microservices System for Healthcare

Stephen Indie

Stephen Indie Thong Nguyen

At a pivotal moment for my company—facing the loss of key personnel and funding—we embarked on an ambitious project to replace a client's failing, costly legacy system with a modern Hospital Information System (HIS). Due to my proven track record, I was selected as one of two founding engineers tasked with building the entire codebase from the ground up.

Strategic Foundations & Tech Choices

Our mission was to build a robust, scalable, and maintainable platform. We made several strategic decisions:
Backend: We chose NestJS and Apollo GraphQL, building upon the team's existing expertise while upgrading to the latest versions to create a more powerful and structured foundation.
Frontend: We leveled up our stack by adopting React with TypeScript, leveraging auto-generated types from our GraphQL API to ensure type safety and improve developer experience.
Database: While sticking with MongoDB for its performance and team familiarity, we made the crucial switch from TypeORM to Mongoose. This move provided superior performance and flexibility as Mongoose is purpose-built for MongoDB, preparing us for the massive data loads of a hospital environment.

A Microservices-First Architecture

We designed the system based on a microservices architecture to ensure separation of concerns and independent scalability. The core services included:
auth: For user authentication and role-based access control.
his: Handling core hospital operational logic.
report: For data aggregation and reporting.
sm: Managing medical supplies.
These services communicated internally via a high-performance TCP protocol, as documented by NestJS.

From Architect to Team Leader

My co-founder and I began by building the auth microservice, as it was a foundational dependency for all other services and would serve as a blueprint for future development.
After my partner moved to a new role, I stepped up to become the Team Leader for the auth service, guiding the team to completion while also contributing hands-on development to other services as needed.

Proven Under Pressure: A Real-World Success Story

My most significant contribution to the his service was developing the clinical testing module. Through careful optimization, this feature proved its resilience during the pandemic, successfully processing thousands of daily COVID-19 tests at peak times without failure.

Overcoming Complex Challenges

This project pushed my skills in several key areas:
Complex Database Design: Structuring data to manage intricate, multi-step clinical workflows.
Advanced Form Optimization: Engineering large forms with dozens of fields and complex, overlapping validation rules, ensuring high performance on the frontend.
Performance Tuning: Optimizing data queries for massive data tables across both the frontend and backend.

Lasting Impact & A Company-Wide Blueprint

Although the project's scope was later scaled down for smaller clinics due to post-COVID economic shifts, its impact was profound. The architecture and codebase we created became the official company-wide blueprint for all subsequent large-scale applications.
On the DevOps front, while our CTO set up the core infrastructure with Traefik and Portainer, I took ownership of the deployment pipeline. I wrote and maintained the GitLab CI/CD scripts that automatically built our services into Docker images and pushed them to the registry. I then used Portainer to manage the deployment and lifecycle of these containers, ensuring our system remained resilient and easy to update.
Like this project

Posted Jul 5, 2025

Co-architected a microservices HIS with NestJS & React. Led the auth team. The system scaled to handle 1000s of daily COVID tests & became a company blueprint.