Offline-first desktop pharmacy POS for Malawi built with Electron, React, TypeScript, and SQLite.
# PharmaPOS — Phase 1 Scaffold
Offline-first pharmacy POS for small pharmacies in Malawi.
Electron + React + TypeScript + Vite. SQLite added in Phase 2.
## Prerequisites
- **Node.js 20+** (LTS recommended)
- **npm 10+** (comes with Node.js)
- **Windows 10/11 or Ubuntu 22+** (the target pharmacy OS)
- **Python 3.10+** and C++ build tools (needed by `better-sqlite3` native compilation)
### Windows: install build tools
```bash
npm install -g windows-build-tools
# OR install Visual Studio Build Tools with "Desktop development with C++" workload
```
### Ubuntu: install build tools
```bash
sudo apt-get install -y build-essential python3
```
## Setup
```bash
# Clone or copy the project, then:
cd pharmapos
npm install
# Rebuild native modules for Electron's Node version
npx electron-rebuild
```
If `electron-rebuild` fails, try:
```bash
npx electron-vite build
# Then retry:
npx electron-rebuild -f -w better-sqlite3
```
## Run in Development
```bash
npm run dev
```
This starts:
- Vite dev server for the React renderer (hot reload)
- Electron main process
- The app window opens automatically
## Verify Phase 1 is Working
After `npm run dev`, confirm all of these:
1. **Window opens** with a dark lock screen showing the PharmaPOS logo
2. **IPC status** shows "System ready" (green) at the bottom of the lock screen
3. **PIN entry works**: type any 4 digits → unlocks as Owner. Type `0000` → unlocks as Cashier
4. **Sidebar navigation** shows all pages for Owner, only POS for Cashier
5. **All 6 pages render**: POS, Products, Inventory, Reports, Backup & Sync, Settings
6. **Lock** works: press Ctrl+L → returns to lock screen
7. **Header** shows "System Ready" (IPC connected) and "Offline" (sync placeholder)
8. **Sidebar collapse** toggle works
9. **Console** (DevTools → F12) shows:
- `[IPC] Connected: `
- `[App] Info: { version, dataPath, platform, arch }`
## Phase 1 Checklist
| Item | Status |
|------|--------|
| Electron window launches | ◻ |
| IPC ping/pong work …