All work

Hospital Inventory Management System

Concurrent inventory management services in Go & Gin with PostgreSQL, JWT role-based access control, near-expiry alerts, and Docker health monitoring.

Hospital Inventory Management System
Backend Systems & Distributed ServicesClient: Healthcare OperationsMay 2025

Built with

Go (Golang)
Gin Web Framework
PostgreSQL
GORM
Docker
JWT / RBAC

Approach

  • High-Throughput Go/Gin REST APIs
  • Role-Based Access Control (RBAC) & JWT Middleware
  • Automated Near-Expiry Alerting Pipelines
  • Batch Excel Inventory Exporting & Audit Logging
  • Docker Containerization with Zero-Downtime Health Checks

High-Concurrency Inventory Control for Clinical Operations

In healthcare facilities, stock discrepancy or expired inventory is not merely a financial loss; it directly impacts patient care workflows. I built a resilient, concurrent backend service in Go (Golang) and the Gin web framework, giving hospital pharmacists and clinical teams real-time visibility into pharmaceutical stock, batch expiry timelines, and audit records.

Architectural Highlights & Implementation

  • Concurrent API Performance in Go: Leveraged Go goroutines and Gin routing to support 50+ concurrent medical staff members executing real-time barcode scans, check-ins, and batch updates without lock contention.
  • Role-Based Access Control (RBAC) & JWT Security: Implemented cryptographic JWT authentication middleware enforcing granular role permissions (Super Admin, Pharmacist, Nurse, Auditor) across all API endpoints to prevent unauthorized stock alterations.
  • Near-Expiry Alerting Engine: Designed background Go worker routines querying PostgreSQL/GORM with composite indexes (expiry_date, batch_id, category), generating automated near-expiry alerts and Excel reports. This cut reporting turnaround by 40% and reduced medication expiry waste by 20%.
  • Operational Resilience & Containerization: Structured the backend within lightweight multi-stage Docker containers with automated health checks (/healthz) and restart policies that guaranteed 99.9% uptime across hospital operational shifts.

Key Engineering Decisions

  1. Why Go & Gin: Selected Go over Node.js for this service due to strict memory footprint constraints on on-premise hospital gateway servers and Go's static typing, ensuring predictable p99 latencies under intake surges.
  2. GORM Connection Pooling: Configured aggressive PostgreSQL connection pooling (SetMaxIdleConns, SetMaxOpenConns, SetConnMaxLifetime) to prevent socket exhaustion during peak outpatient shifts.
  3. Structured Audit Logging: The service records every inventory modification as an immutable transaction log, providing an auditable trail required for healthcare regulatory compliance.

Related reading