2026 · Full-stack + desktop packaging — architecture, backend, frontend, Electron shell, licensing
H3M POS
Retail point-of-sale & back-office platform — checkout, inventory, purchasing, ledgers, shifts, and analytics
- Next.js
- Express
- Prisma
- PostgreSQL
- Electron
- TypeScript
- Redux Toolkit
- TanStack Query
Overview
Small and mid-size retailers need a real POS — multi-currency, multi-warehouse, tax-aware, with supplier and customer ledgers — but they don't have IT staff, a server room, or a reliable internet connection. H3M POS is designed so a shop owner can run the installer on one ordinary Windows PC and be selling in minutes, fully offline, while the same codebase still deploys as a normal containerised web app for multi-terminal shops.
Highlights
One-file desktop install — an Electron shell boots a bundled PostgreSQL 16 cluster, runs migrations, seeds a fresh store on first launch, spawns the compiled API, and serves the UI, all invisible to the user.
Offline-first, cloud-optional — everything works with no network; Google Drive backup is a bolt-on with a scheduled pg_dump, DPAPI-encrypted OAuth token, and graceful degradation when offline.
Money done properly — every monetary row stores its own currency and the exchange rate applied at the time, with all arithmetic going through integer-cent half-up rounding, never bare floats.
Concurrency-safe checkout — idempotency-key replay protection plus row locks inside a transaction, so two registers can't oversell the same item or double-charge a retried request.
Bilingual, full RTL — English/Arabic across roughly 1,960 translation keys per language, with right-to-left as a first-class layout mode.
Signed, machine-bound licensing — Ed25519-signed license files bound to a hardware fingerprint, a roll-back-resistant expiry clock, and a code-integrity manifest.
Scale
~46,000 LOC
App source
~50 Prisma models, 27 migrations
Data model
38 App Router screens, ~1,960 keys × 2 languages
UI
32 discrete permissions
Access control
~160 test files
Automated tests
Tech stack
Backend
Node 20, Express 4, TypeScript (strict), Prisma 5, PostgreSQL 16, Zod, JWT, bcryptjs, express-rate-limit
Frontend
Next.js 14 (App Router), React 18, Redux Toolkit, TanStack Query 5, react-hook-form + Zod, next-intl (EN/AR, RTL), Recharts, jsbarcode
Desktop
Electron 30, electron-builder (NSIS, per-user), bundled PostgreSQL 16, DPAPI via safeStorage
Testing & crypto
Vitest for backend unit + HTTP integration and frontend components, Node crypto Ed25519, SHA-256 integrity manifest
What was hard
Making PostgreSQL invisible — detecting first run vs. upgrade, running initdb once, migrating on every launch, and seeding exactly once on a provably-empty database, all from an Electron main process.
Correctness under concurrent registers — idempotent checkout and stock decrement required row-level locking and a replay cache; a fuzz test firing 30 concurrent checkouts surfaced two race conditions later fixed at the query level.
A licensing scheme built to survive the shipped, obfuscated bundle, with no single readable pass/fail boolean.
Need something similar?
Related services: Web platforms, Point of sale & desktop software, Security & access control