Back to Portfolio

Medical Clinic ERP System

Enterprise multi-tenant SaaS for healthcare clinics & suppliers

Project overview

This Medical Clinic ERP System is a digital inventory management platform designed for healthcare institutions. The project focuses on replacing manual stock tracking with a structured digital system that allows clinics to monitor material movement accurately.

In this project, I contributed as a developer responsible for implementing backend logic, operational workflows, and inventory calculation mechanisms.

Healthcare logistics often faces discrepancies between the quantity of products ordered and the quantity actually delivered. To address this, the system was designed so that if there is a difference between the ordered and received quantities, the system records the discrepancy without interrupting the workflow. This approach makes the system more resilient to real-world operational conditions while maintaining consistent and traceable data.

The platform architecture is structured into three main layers: Decision layer — dashboards and operational visibility; Operational layer — daily inventory inflow and outflow processes; Data layer — storage of inventory history and structured records.

The interface follows a safety-focused approach suitable for medical environments. Role-based access control, mandatory input fields, and visual risk indicators help minimize human errors during inventory operations.

As a result, the system helped transform clinic inventory management from a manual, person-dependent process into a digital, traceable, and reliable operational system. The platform also creates a foundation for future capabilities such as AI-driven procurement prediction, OCR document scanning, and B2B supply systems.

4
Applications
20+
Modules
30+
DB Tables
60+
API Endpoints
Real-time
Order & Alerts

The challenge

Medical clinics and suppliers needed one reliable system: orders, inventory, supplier management, compliance, and reporting — in a multi-tenant setup with strict data isolation. Manual processes and legacy tools didn't scale.

The solution

Designed and built the full stack from scratch: Turborepo monorepo (Clinic + Supplier backends & frontends), NestJS + Next.js 14, PostgreSQL (Supabase) with Prisma, JWT + RBAC, and production monitoring via Telegram.

Tech Stack

Backend

NestJSTypeScriptPrismaPostgreSQLJWTRBACTransactions

Frontend

Next.js 14 (App Router)React 18TypeScriptTailwind CSSServer Components

Infrastructure

DockerDocker ComposeAWS EC2NginxVPSSupabaseConnection pooling

Integrations

AWS EC2SupabaseBrevoSolapiGoogle VisionTelegramHIRAData.go.krGrafanaPrometheusHealth ChecksPerformance LoggingTelegram AlertsRate LimitingFirewall ConfigurationSecrets ManagementAudit LoggingGS1 barcode scanning

Architecture & Design

Multi-tenancy

Row-level isolation with tenant_id on every table, JwtTenantGuard, and composite indexes. Scales to thousands of clinics with zero cross-tenant data risk.

Clean Architecture

Controller → Service → Repository → DB. Separation of concerns, testable business logic, and infrastructure-agnostic core.

ACID Transactions

Order creation, inventory updates, and returns wrapped in Prisma transactions. Rollback on any failure; Telegram alerts on production rollbacks.

Production Monitoring

Telegram alerts, Grafana, Prometheus for DB failures and other issues, slow queries, storage thresholds (80%/90%), high-value order failures, and HTTP 5xx. Health check endpoints for Docker and load balancers.

Problem Solving

Problem: Multi-tenant data isolation at scale

Solution: tenant_id on every table, JwtTenantGuard, all queries filtered by tenant. Composite indexes for performance.

Complete isolation, scalable to thousands of tenants, regulation-ready.

Problem: Supabase pgbouncer doesn't support prepared statements

Solution: Detect pgbouncer in connection string, add pgbouncer=true, disable prepared statements, connection retry logic.

Seamless Supabase usage, stable under load.

Problem: Order creation across multiple suppliers

Solution: Order splitting by supplier, each group = separate order with suffix (A, B, C). Single transaction; single webhook with all orders.

Accurate multi-supplier orders, no partial state.

Problem: Manual certificate data entry

Solution: Google Cloud Vision OCR → structured parser → pre-filled form with fallback to manual entry.

Faster registration, fewer errors, better UX.

Problem: Real-time production visibility

Solution: TelegramNotificationService, Grafana, Prometheus for DB, storage, API failures, rollbacks. Only in production with feature flag.

Immediate alerts and manual monitoring.

Impact

100%
Data isolation per tenant
ACID
Financial operations
Real-time
Alerts & notifications
OCR
Certificate automation

Solo lead from requirements to production. The system is live, serving clinics and suppliers with order management, inventory (batch/FIFO), returns, product catalog, and full RBAC. Built for maintainability and scale.