Apotek POS
A full-stack pharmacy management platform built as a TypeScript monorepo with React 19, Hono, and Cloudflare D1. Handles point-of-sale checkout, product catalog, procurement workflows, stock inventory, employee payroll, and financial reporting — deployed on the edge with strict end-to-end type safety.
Tech Stack
Project Overview
Pharmacy management system built as a pnpm/Turborepo monorepo with three packages: a React 19 + Vite SPA frontend, a Hono API on Cloudflare Workers, and a shared type-only contracts package. The backend uses Cloudflare D1 (SQLite) with Drizzle ORM across 27 database tables, Better Auth for authentication with 2FA support, and audit logging on every mutation. The frontend features 17 domain modules with centralized TanStack Router, server-state caching via TanStack Query, and data grids powered by TanStack Table — all written in strict TypeScript.
Project Goals
- Build a centralized, type-safe monorepo for end-to-end pharmacy operations
- Replace manual inventory tracking with real-time stock management and alerts
- Streamline procurement from supplier ordering to goods receipt and payment
- Enforce role-based access control with audit logging for every transaction
The Challenge
- Inventory and procurement tracked across disconnected spreadsheets
- No real-time visibility into stock levels or low-stock alerts
- Cashier checkout and cash drawer reconciliation handled manually
- No structured audit trail for financial and inventory transactions
The Solution
Built a complete monorepo pharmacy platform with 16 backend domain modules and 17 frontend feature modules. The system runs on Cloudflare Workers with D1 persistence, featuring real-time POS checkout with cash drawer lifecycle, full procurement workflow (supplier to purchase order to goods receipt to payment), session-based stock opname, employee payroll management, and audit-logged financial reporting — backed by 135 test files and strict TypeScript across all three packages.
Key Features
Product Catalog
Products with categories, units, margins, sale units, and configurable low-stock thresholds.
Point of Sale
Cart-based checkout with cash drawer session lifecycle, payment processing, and real-time transaction logging.
Procurement Pipeline
Suppliers, purchase orders, goods receipts, supplier payments, and side-by-side price comparison.
Financial Reports
Cash drawer session history, cashier transaction reports, and owner dashboard with sales analytics.
Stock Opname
Session-based stock counting with variance tracking, summary analytics, and finalization workflow.
Employee & Payroll
Employee CRUD, role management, salary configuration, and payment tracking with transfer or cash methods.
Audit Logging
Every mutation writes audit entries in the same D1 batch — no business action goes unlogged.
Type-Safe Contracts
Shared @apotek/shared package enforces API and domain type safety across frontend and backend.
Edge Deployment
Cloudflare Workers + D1 with Drizzle ORM migrations, security headers, and CI/CD via GitHub Actions.
Auth & 2FA
Better Auth with email verification, password reset, role-based route guards, and optional two-factor auth.
Screenshots
Dashboard
Kasir
Kelola Produk
Peringatan Stok Rendah
Stok Opname
Pengaturan Produk
Pesanan Barang
Penerimaan Barang
Pembayaran Supplier
Perbandingan Harga
Kelola Supplier
Kelola Pegawai
Pembayaran Gaji
Kelola Role
Laporan Kas
Laporan Transaksi Kasir
Like this project? Let's build something great together!
I'm always open to discussing new projects, creative ideas, or opportunities to be part of your vision.