Web Application

MedCare Pharmacy

A pharmacy inventory and point-of-sale system that tracks every batch from stock-in to expiry, with role-based access for admins, pharmacists, and cashiers.

MedCare Pharmacy on desktop
Overview

About the Project

MedCare Pharmacy is a full inventory and point-of-sale system for a pharmacy. It manages products, suppliers, and stock deliveries, tracks every batch with its expiry date, and sells from those batches first-expiring-first-out (FEFO) so near-expiry stock moves before it goes to waste.

A single versioned REST API (/api/v1) on PostgreSQL holds every business rule, so the web app, a planned Flutter mobile app, barcode scanners, and thermal printers can all use the same backend without duplicating logic.

Project Type

Inventory & POS System

Status

Ongoing Development

Role

Full Stack Developer

Platform

Web (Next.js) + Mobile-ready API

Key Features

What It Does

Point of Sale

Search- and barcode-driven cart with cash or card checkout and printable receipts.

Batch & Expiry Tracking

Every delivery is stored as a batch with an expiry date, sold first-expiring-first-out.

Stock-In & Suppliers

Multi-line delivery receiving against suppliers, recorded atomically.

Role-Based Access

Separate Admin, Pharmacist, and Cashier permissions, enforced by the API.

Reports & Dashboard

Sales trends, top products, and inventory valuation at cost and retail.

Returns & Adjustments

Sale returns and stock adjustments with reasons, restored to the right batch.

Audit Log

A single feed of every stock adjustment and sale return, with who made it.

Mobile-Ready API

Bearer-token auth for a future Flutter app, with barcode and receipt contracts.

Production Hardening

Hashed passwords, rotating refresh tokens, rate limiting, and Zod validation.

Tech Stack

Technologies Used

  • Next.js
  • React
  • PostgreSQL
  • Prisma
  • Tailwind CSS
  • Vercel

Additional Tools

  • Zod
  • Vitest
  • Playwright
  • GitHub
Screenshots

Project Preview

Process

Challenges & Solutions

Key Challenges

  • Selling from the right batch so expiring stock moves first
  • Keeping stock correct when a sale, return, or adjustment fails halfway
  • Letting web, mobile, and hardware clients share the same rules
  • Testing against a real database without touching live data

How I Solved It

  • Built a FEFO allocator that splits each sale line across batches by expiry
  • Wrapped every stock-changing operation in a single database transaction
  • Put all business logic behind one versioned REST API with dual cookie/Bearer auth
  • Ran 93 API integration tests against an isolated Postgres schema on a production build
Outcome

Results & Impact

Less Expired Stock

FEFO selling and expiry alerts surface near-expiry batches first.

Reliable Records

Atomic transactions and an audit log for every stock change.

Ready to Expand

One API ready for a Flutter app, scanners, and thermal printers.

Interested in this project?

Feel free to reach out if you'd like to know more or discuss a similar project.

Contact Me