Back to Portfolio
MediLex ERP Case Study
Full Stack Flagship Project

MediLex – Healthcare & Inventory Management System

A comprehensive clinical ERP application designed to optimize medical record maintenance, doctor allocation, prescription flows, supplier acquisitions, billing ledgers, and inventory forecasting within a relational DBMS framework.

0+Database TablesThird Normal Form (3NF)
0+REST APIsSecure RESTful Routes
0+Core ModulesIntegrated Workflows
-0%Operational ErrorManual Process Reduction

Project Overview

MediLex digitalizes hospital workspaces through a centralized platform linking patient healthcare folders directly to resource warehouses. It optimizes the manual coordination between patient registrations, electronic prescriptions, billing collections, and apothecary warehouses, allowing clinical establishments to run with absolute technical consistency.

The Problem Statement

Healthcare setups face administrative fragmentation. Medical charts are frequently delayed, prescription drug dispensing is prone to errors, and warehouses risk low stocks or expired items. Furthermore, without unified databases, billing units fail to map clinical services accurately, resulting in inventory deficits and administrative leakages.

The Solution Engineered

An ERP combining patient registration, doctor schedules, medicine warehouse monitoring, and billing. Stored procedures track medicine inventories in real-time, warning clinics when items near critical safety levels. Patient records sync automatically with active bills, and Express.js REST APIs with JWT encryption safeguard confidential health files.

System Architecture & Orchestration

Explore how client-side events propagate through custom Express middleware and transaction engines down to the MSSQL database engine.

Click a Layer to Trace Data Flow

Architecture Module DetailsFRONTEND

React Frontend Layer

React, TypeScript, Vite, Tailwind CSS, React Query

Highly responsive SPA built with robust state boundaries. Uses React Query for state caching, eliminating redundant backend traffic by up to 60%. Designed in standard custom responsive layouts with Lucide badges.

  • Type-safe forms with TypeScript validation schemas
  • Recharts dashboards pulling from structured endpoints
  • Responsive glassmorphic UI matching recruiter guidelines
  • Global loading screens & page transitions
Enterprise Architecture CertifiedVerified Layer

Relational Database & SQL Playground

Review our Third Normal Form (3NF) design schemas and execute advanced relational SQL queries with the interactive runner.

Pre-Compiled Database Queries

Schema Highlights
  • 20+ relational tables structured in strict Third Normal Form (3NF).
  • Indexes optimized on foreign keys, reducing sub-query latency by 70%.
  • Triggers auditing stock level adjustments and automated alerts logs.
SQL Console - Microsoft SQL Server 16.0
SELECT 
    m.MedicineID, 
    m.BrandName, 
    m.GenericName, 
    m.QuantityInStock, 
    m.ReorderLevel,
    s.SupplierName
FROM Medicines m
INNER JOIN Suppliers s ON m.SupplierID = s.SupplierID
WHERE m.QuantityInStock <= m.ReorderLevel
ORDER BY m.QuantityInStock ASC;
Query executed successfully in 12ms.4 rows returned.
IDBrand NameGeneric NameStockReorder LevelSupplier
MED-004Amoxicillin 500mgAmoxicillin Trihydrate45100Lanka Pharma Ltd
MED-012Atorvastatin 20mgAtorvastatin Calcium3050Apex Diagnostics
MED-029Insulin Glargine 100 U/mlInsulin Glargine (rDNA origin)1220Novo Ceylon Supplies
MED-087Paracetamol 500mgAcetaminophen80200State Pharmaceuticals Corporation

Authentication & RBAC Security

Tracing JWT token generation, header authorizations, and Express middleware route protections.

01

Secure Credential Login

User enters login coordinates over SSL. Express backend hashes passwords with bcrypt and verifies records against the DB.

02

JWT Token Generation

Server signs a unique JWT containing UserID and Role flags, setting expiry times and returning the encrypted cookie.

03

Bearer Token Request

Axios interceptors append the JWT inside the authorization header for subsequent CRUD operations.

04

Role Gate Validation

Express middlewares extract roles and block unauthorized request patterns (e.g. pharmacists accessing billing).

Key Contributions & Leadership

1

Relational Database Design

Designed the complete relational schema supporting 20+ tables. Implemented 3NF validations, primary/foreign key mappings, and indexing strategies to optimize complex JOIN queries.

2

RESTful API Engineering

Engineered Express.js backends with robust routers, strict schemas validations, and unified error handling, driving smooth front-to-back communications.

3

JWT & Role-Based RBAC Integration

Designed high-security auth boundaries isolating EHR files, preventing unauthorized actions between Doctors, Pharmacists, and Administrative staff.

4

Stored Procedures and DB Objects

Authored specialized database triggers monitoring stock levels, database UDFs, SQL views, and stored procedures handling bulk acquisitions.

Key Learnings & Future Improvements

1

Architectural Scalability

Learned the value of database schema isolation. Structuring tables properly in 3NF makes writing APIs significantly more predictable and type-safe.

2

Performance Profiling

Understanding index strategies on foreign keys was critical. Optimized query routines from 3+ seconds to under 15ms by introducing composite indices and pre-compiling views.

3

State Management Parity

Integrating React Query cached responses, dropping backend network traffic overheads by up to 60% and ensuring instant data renders on screen.

4

Proposed Upgrades: Real-time WebSockets

Future updates will implement WebSockets (Socket.io) to stream stock notifications instantly across pharmacists screen when stocks near threshold values.