A lightweight, offline inventory management application for micro businesses and small vendors — a fast local dashboard backed by safe, atomic JSON storage on disk. No cloud database, no user accounts, no internet dependency.
- Overview
- Features
- Architecture
- How a Stock Operation Flows
- Product Lifecycle
- Installation
- Quick Start
- Settings
- Import, Export & Reports
- Scanning, Labels & Images
- Multi-Location, Transfers & Purchasing
- Installing & Working Offline
- Accounts, Roles & Sync
- Folder Structure
- API Reference
- Screenshots
- Roadmap
- Contributing
- Author
- License
QuickStock Sync helps small vendors track stock levels, record sales, dispatches, and restocks, and generate shareable inventory summaries — all running locally with zero configuration.
It's built as a small, dependency-light Node.js / Express service with a vanilla HTML + TailwindCSS frontend — no React, no build step, no cloud dependency. Just clone, install, and run.
|
📊 Inventory Dashboard Responsive grid with search, status filtering, sorting, and live summary cards. 🏷️ Full SKU Management Create, edit, delete products with SKU code, category, quantity, threshold, and unit. 🚦 Automatic Status Every product is auto-classified as In Stock, Low Stock, or Out of Stock. 🔁 Stock Operations Sale, Dispatch, Restock, and Manual Adjustment — applied instantly, logged forever. ↺ One-Click Undo Revert the most recent stock-changing action instantly. |
📜 Permanent History Timestamp, SKU, action, quantity, and remaining stock — survives every restart. 📤 Summary Generator Plain Text, Markdown, WhatsApp, or Email format — copy to clipboard in one click. 🌗 Dark / Light Mode Toggle instantly, easy on the eyes in the warehouse or the office. 🛡️ Hardened API Helmet headers, rate limiting, strict validation, path-traversal protection. 💾 Safe Storage Atomic writes, automatic backups, and recovery from corrupted JSON. |
|
⚙️ Configurable Settings v1.1.0 Port, data directory, backup location, automatic backups, default theme, and low-stock threshold default — all editable from a Settings page, no code changes required. See Settings. |
📁 Import, Export & Reports v1.2.0 Bulk import/export via CSV or Excel with a dry-run preview, plus printable HTML reports (inventory, low stock, activity history) ready for browser print-to-PDF. See Import, Export & Reports. |
|
📷 Scan & Print v1.3.0 Camera-based barcode/QR scanning (with manual/hardware-scanner fallback) for instant lookups, plus printable QR labels — single, filtered, or bulk-selected. See Scanning, Labels & Images. |
🖼️ Product Images v1.3.0 Attach a photo to any product — shown as a thumbnail on its card, stored as a file (not bloating the JSON), and migrated automatically with the data directory. |
|
🏬 Multi-Location & Transfers v1.4.0 Track stock per location, transfer between them with full undo support, and add locations right from Settings. Single-location use is completely unaffected — the location picker only appears once you actually have more than one. See Multi-Location, Transfers & Purchasing. |
🏭 Suppliers & Purchase Orders v1.4.0 Manage suppliers and run a full draft → ordered → received purchase-order workflow. Receiving restocks the right location automatically and logs it like any other restock. |
|
📲 Installable & Offline-First v1.5.0 Install QuickStock Sync to a home screen or desktop like a native app. The dashboard shell loads instantly from cache and keeps showing last-known data if the connection to the server briefly drops; sales, dispatches, restocks, adjustments, and transfers made while offline are queued and synced automatically the moment you're back online. See Installing & Working Offline. |
|
|
🔐 Accounts, Roles & Sync v2.0.0 Optional login (off by default) with two roles — staff and admin. Sync inventory between two instances over your LAN or the internet: a peer is just a URL, so "cloud sync" and "LAN sync" are the same feature. See Accounts, Roles & Sync. |
flowchart LR
subgraph Client["🖥️ Browser"]
UI["index.html + Tailwind"]
APIJS["api.js — fetch client"]
APPJS["app.js — UI logic"]
end
subgraph Server["🟢 Node.js / Express"]
ROUTES["Routes"]
MW["Middleware<br/>Helmet · Rate Limit · Validation"]
CTRL["Controllers"]
SVC["Services<br/>Inventory · History · Summary"]
STORE["Storage Layer<br/>Atomic Write · Backup · Recovery"]
end
subgraph Disk["🗄️ Local Disk"]
INV["data/inventory.json"]
HIST["data/history.json"]
BAK["data/backups/*.bak.json"]
end
UI --> APPJS --> APIJS -- "fetch /api/*" --> MW --> ROUTES --> CTRL --> SVC --> STORE
STORE -- "atomic write + backup" --> INV
STORE -- "atomic write + backup" --> HIST
STORE -- "backup copy" --> BAK
STORE -. "read" .-> INV
STORE -. "read" .-> HIST
style Client fill:#F2EFE6,stroke:#D98E04,color:#1F2318
style Server fill:#1F2318,stroke:#D98E04,color:#F2EFE6
style Disk fill:#F2EFE6,stroke:#2F6D3B,color:#1F2318
Every sale, dispatch, restock, or adjustment follows the same safe, logged path:
sequenceDiagram
autonumber
participant U as 🧑 Vendor
participant UI as Dashboard
participant API as REST API
participant SVC as Inventory Service
participant HIST as History Service
participant FS as JSON Storage
U->>UI: Click "Sale" · enter quantity
UI->>API: POST /api/inventory/sale
API->>SVC: applyStockOperation(id, "sale", qty)
SVC->>FS: read inventory.json
FS-->>SVC: current stock
alt Sufficient stock
SVC->>FS: atomic write updated inventory.json
SVC->>HIST: logAction(sale, qty, remaining)
HIST->>FS: atomic write history.json
SVC-->>API: updated product + status
API-->>UI: 200 OK
UI-->>U: ✅ Toast — "Sale recorded"
opt Stock ≤ threshold
SVC-->>SVC: 🟡 terminal LOW STOCK warning
end
else Insufficient stock
SVC-->>API: 400 Validation error
API-->>UI: error message
UI-->>U: ⚠️ Toast — "Not enough stock"
end
stateDiagram-v2
[*] --> InStock: Product created
InStock --> LowStock: quantity ≤ minThreshold
LowStock --> InStock: Restock above threshold
LowStock --> OutOfStock: quantity reaches 0
OutOfStock --> InStock: Restock above threshold
OutOfStock --> LowStock: Restock at/below threshold
InStock --> [*]: Delete
LowStock --> [*]: Delete
OutOfStock --> [*]: Delete
note right of LowStock
🟡 Terminal warning logged
the moment stock crosses
at or below threshold
end note
Requires Node.js 18+.
git clone https://github.com/SHalimoosavi/SYJ-QuickStock-Sync.git
cd SYJ-QuickStock-Sync
npm installnpm start
The server starts on http://localhost:3000 by default. Open that URL in a browser to use the dashboard.
To use a different port, copy .env.example to .env and set PORT:
cp .env.example .env
Click the ⚙️ gear icon in the dashboard header to open the Settings page. Everything is persisted to config/settings.json, which is created automatically on first run.
| Setting | Applies | Notes |
|---|---|---|
| Server port | On restart | The PORT environment variable, if set, always wins over this value. |
| Data directory | Immediately | Relative to the project folder, or an absolute path (e.g. an external drive). Existing inventory.json/history.json are copied to the new location automatically — nothing is deleted from the old one. |
| Backup location | Immediately | Same migration behavior as the data directory. |
| Automatic backups | Immediately | Toggle on/off, and set how many timestamped backups to keep per file. |
| Default theme | Immediately | Applied to the current browser right away; new browsers/sessions start from this default until they toggle manually. |
| Low-stock threshold default | Immediately | Used whenever a new product's "Min threshold" field is left blank. |
You can also edit config/settings.json directly while the server is stopped — config/settings.example.json documents its shape.
Click the Data button in the dashboard header.
Export — download the full inventory as CSV or Excel (.xlsx) with one click.
Import — upload a CSV or Excel file with the columns skuCode, name, category, quantity, minThreshold, unit, description. Rows whose skuCode matches an existing product update it; every other row creates a new one. Click Preview import first to dry-run the file — you'll see exactly how many rows would be created/updated and any row-level errors before anything is written. Then Confirm import to apply it.
flowchart LR
F["📄 CSV / Excel file"] --> P["Preview<br/>(dry run)"]
P -->|"looks right"| C["Confirm import"]
P -->|"fix & retry"| F
C --> W["Upsert by SKU<br/>+ history log entry per row"]
W --> INV["data/inventory.json"]
Printable reports — three report types (Full Inventory, Low Stock, Activity History) open as clean, print-ready pages in a new tab. Use your browser's print dialog (or the on-page button) to print or save as PDF — no PDF library involved.
Scan — click 📷 Scan to open the camera. It uses the browser's native BarcodeDetector API (QR, EAN-13/8, UPC-A/E, Code128) with zero extra dependencies. If your browser doesn't support it, or camera access is denied, it falls back to a manual text field — which also happens to be exactly what a USB/Bluetooth barcode scanner needs, since those act like a keyboard typing the code plus Enter.
A scanned code is matched against each product's SKU code or its optional barcode field. A match jumps straight to Sale/Dispatch/Restock/Edit; no match offers to create a new product with the code pre-filled.
Labels — every product can generate a printable QR label (the 🏷 button on its card, or from the product form). QR was chosen over 1D barcodes (Code128/EAN) because it doesn't require symbology-specific checksum digits to print correctly at small sizes, and most phone cameras read it natively.
Bulk printing — toggle ☑ Select to add checkboxes to product cards, pick the ones you want, and a floating bar lets you print all of them as one label sheet. You can also print labels for an entire filtered view via the Data panel.
Product images — attach a PNG/JPEG/WEBP (max 2MB) to any product from the product form. Images are stored as individual files under data/images/ rather than embedded in inventory.json, and they migrate automatically if you change the data directory in Settings.
QuickStock Sync tracks stock per location, not as one flat number. A "Main Warehouse" location is created automatically, and if you never add a second one, nothing about the app changes — every screen and endpoint defaults to that single location. Add a second location and the location picker starts appearing where it matters.
flowchart LR
subgraph Store["🏬 Locations"]
L1["Main Warehouse"]
L2["Store B"]
end
P["Product: Widget"] -->|"stock[locationId]"| L1
P -->|"stock[locationId]"| L2
L1 -- "⇄ Transfer" --> L2
SUP["🏭 Supplier"] -->|"Purchase Order"| PO["Draft → Ordered → Received"]
PO -- "Receive items" --> L1
style Store fill:#F2EFE6,stroke:#D98E04,color:#1F2318
Locations — manage them from Settings → Locations. Rename, promote a location to default, or delete one (only once it has zero stock).
Transfers — the ⇄ Transfer button on a product card moves stock between two locations in one atomic operation, fully logged and fully undoable — undo/redo works correctly even when chained back and forth across a transfer.
Suppliers & Purchase Orders — open 🏭 Purchasing to manage suppliers and run purchase orders through a real workflow:
stateDiagram-v2
[*] --> Draft: Create PO
Draft --> Ordered: Mark ordered
Draft --> Cancelled: Cancel
Ordered --> PartiallyReceived: Receive some items
Ordered --> Received: Receive all items
Ordered --> Cancelled: Cancel
PartiallyReceived --> Received: Receive remaining items
Received --> [*]
Cancelled --> [*]
note right of PartiallyReceived
Each receipt restocks the
PO's destination location
immediately — no separate
confirmation step
end note
Receiving items against a PO restocks the destination location the same way a manual restock would, so it shows up identically in the activity history — just with a note pointing back to the PO number. Cancelling or deleting a PO is blocked once anything has actually been received, so the audit trail always matches what really happened to your stock.
Install it like an app. Open the dashboard in a supporting browser (Chrome, Edge, or Android/desktop Chromium browsers) and click ⬇ Install app when it appears next to the app title — or use the browser's own "Install"/"Add to Home Screen" option. iOS Safari doesn't fire that prompt, but Share → Add to Home Screen works the same way.
The shell works offline. A service worker caches the dashboard's HTML, CSS, and JS, so it opens instantly — including with no network at all — and falls back to last-known data for the main views (inventory, settings, locations, suppliers, purchase orders, history, summary) if the server becomes briefly unreachable, instead of showing a blank error page. Printable reports, labels, and CSV/Excel exports are always fetched fresh — those are never served from cache.
flowchart LR
A["Sale / Dispatch / Restock /<br/>Adjustment / Transfer"] --> B{"Server reachable?"}
B -- "Yes" --> C["Applied immediately"]
B -- "No" --> D["Queued in IndexedDB"]
D --> E{"Back online?"}
E -- "Background Sync event<br/>(Chromium browsers)" --> F["Replayed automatically —<br/>even if the tab is closed"]
E -- "'online' browser event<br/>(all browsers)" --> F
F --> C
style D fill:#F2EFE6,stroke:#A66600,color:#1F2318
style F fill:#F2EFE6,stroke:#2F6D3B,color:#1F2318
What gets queued while offline: Sale, Dispatch, Restock, Adjustment, and Transfer — the "quick action while walking the floor" operations. A badge next to the app title shows ⚠ Offline or ↻ Syncing N queued…, and each queued action shows its own toast ("saved offline — will sync automatically").
What doesn't get queued: creating/editing/deleting a product, uploading an image, changing settings, importing a file, and purchase-order actions. Several of these need an immediate server-generated id to chain a follow-up step (like uploading a photo right after creating a product), which doesn't have a safe offline story — those still show a normal error if there's no connection, the same as before this release.
Authentication is off by default — every screen and endpoint works exactly like earlier versions until you turn it on. To enable it:
- Open Settings → Accounts and create at least one account (it'll offer to make your very first one an admin automatically).
- Open Settings → Security and turn on Require login.
From then on, opening the dashboard shows a login screen until you sign in. There are two roles:
| Staff | Admin | |
|---|---|---|
| View inventory, history, reports, labels | ✅ | ✅ |
| Sale / Dispatch / Restock / Adjustment / Transfer / Undo | ✅ | ✅ |
| Scan barcodes/QR | ✅ | ✅ |
| Create / edit / delete products, upload images | ✅ | |
| Settings, locations, suppliers, purchase orders | ✅ | |
| Import/export, user accounts, sync | ✅ |
The last remaining admin account can't be demoted or deleted — there's always a way back in. Sessions last 12 hours and live in server memory, so a server restart signs everyone out (a deliberate, simple tradeoff over persisting sessions to disk).
A sync peer is just a URL — a LAN IP like http://192.168.1.50:3000 and a remote/cloud address work identically, so "LAN sync" and "cloud sync" are the same feature under the hood.
flowchart LR
A["Instance A<br/>(e.g. warehouse PC)"] -- "Sync now" --> B["Instance B<br/>(e.g. shop tablet, or<br/>a remote/cloud instance)"]
B -- "changes since<br/>last sync" --> A
A -- "changes since<br/>last sync" --> B
style A fill:#F2EFE6,stroke:#D98E04,color:#1F2318
style B fill:#F2EFE6,stroke:#D98E04,color:#1F2318
Pairing is explicit and mutual. Every instance has its own syncSecret, shown in Settings → Sync. To add a peer, you paste in their URL and their secret — so each side has to deliberately share its secret before the other can sync with it. There's no discovery, no auto-pairing; this is intentional, since it's the only way to be sure you're syncing with the instance you actually meant to.
"Sync now" is one action, both directions: it pulls the peer's changes since your last sync, merges them in, then pushes your own changes back to them.
Conflict resolution is last-write-wins by timestamp, at the whole-record level:
- If the same product was edited on both sides since the last sync, whichever edit happened more recently wins — in full, not field-by-field.
- History merges by simple union — it's an append-only log, so there's nothing to actually conflict.
- If a product's SKU code already exists locally under a different id than the incoming one, it's never silently merged — that's reported back as a conflict so you can resolve it by hand, rather than risking a corrupted duplicate SKU.
.
├── server.js # Application entry point
├── .github/workflows/ci.yml # CI — install, syntax-check, boot-check, PWA asset check on Node 18/20/22
├── scripts/generate-icons.js # Regenerates the PWA icon set (pure Node, no dependencies)
├── config/
│ ├── settings.json # Runtime settings (git-ignored, created on first run)
│ └── settings.example.json # Documents the settings.json shape
├── src/
│ ├── controllers/ # Request handlers
│ ├── routes/ # Express route definitions
│ ├── services/ # Business logic (inventory, history, summary, settings, import/export, reports, images, labels, locations, suppliers, purchase orders, users, sessions, sync)
│ ├── storage/ # Atomic JSON read/write + backup/recovery + live reconfiguration
│ ├── middleware/ # Error handling, validation, auth (sessions + roles)
│ └── utils/ # Logger, ID generation, status calculation, errors, atomic file I/O, CSV parser, password hashing
├── public/
│ ├── index.html # Dashboard UI
│ ├── manifest.json # Web app manifest (installable PWA)
│ ├── sw.js # Service worker — app-shell caching, API fallback, background sync
│ ├── icons/ # Generated PWA icons (any + maskable + apple-touch + favicon)
│ ├── css/custom.css # Design tokens and component styles
│ └── js/ # api.js (fetch client) + app.js (UI logic) + print.js (report/label print trigger) + offlineQueue.js (IndexedDB write queue, shared with sw.js)
├── data/ # inventory.json, history.json, locations.json, suppliers.json, purchase-orders.json, images/, backups/ (default location); users.json + sync-peers.json are git-ignored (contain secrets)
├── logs/ # Reserved for optional file logging
├── .env.example
├── CHANGELOG.md
├── LICENSE
└── package.json
All endpoints are prefixed with /api and return JSON in the shape { success, data | error }.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/inventory |
List products (supports search, status, sortBy, order) |
GET |
/api/inventory/:id |
Get a single product |
POST |
/api/inventory |
Create a product |
PUT |
/api/inventory/:id |
Update a product |
DELETE |
/api/inventory/:id |
Delete a product |
POST |
/api/inventory/sale |
Record a sale (id, quantity, reason, locationId) |
POST |
/api/inventory/dispatch |
Record a dispatch |
POST |
/api/inventory/restock |
Record a restock |
POST |
/api/inventory/adjustment |
Manual signed adjustment |
POST |
/api/inventory/transfer |
Move stock between locations (id, fromLocationId, toLocationId, quantity) |
POST |
/api/inventory/undo |
Undo the most recent stock action |
GET |
/api/summary?format= |
Generate summary (plain|markdown|whatsapp|email) |
GET |
/api/history |
List history (supports skuId, locationId, limit) |
GET |
/api/settings |
Get current settings and effective (active) storage/port info |
PUT |
/api/settings |
Update settings — returns restartRequired: true if the port changed |
GET |
/api/export/inventory?format= |
Download inventory (csv|xlsx) |
POST |
/api/import/inventory |
Bulk import (format, contentBase64, dryRun) — always targets the default location |
GET |
/api/reports/inventory |
Printable full-inventory report (HTML) |
GET |
/api/reports/low-stock |
Printable low-stock report (HTML) |
GET |
/api/reports/history |
Printable activity-history report (HTML, supports limit) |
GET |
/api/inventory/lookup?code= |
Look up a product by SKU code or barcode (used by the scanner) |
GET |
/api/inventory/:id/image |
Serve a product's image |
POST |
/api/inventory/:id/image |
Upload/replace a product's image (mimeType, contentBase64) |
DELETE |
/api/inventory/:id/image |
Remove a product's image |
GET |
/api/labels/:id |
Printable QR label for one product (HTML) |
GET |
/api/labels?ids= | ?search=&status= |
Bulk printable labels (HTML) |
GET/POST |
/api/locations | /api/locations/:id |
Manage locations (PUT/DELETE also by :id) |
GET/POST |
/api/suppliers | /api/suppliers/:id |
Manage suppliers (PUT/DELETE also by :id) |
GET/POST |
/api/purchase-orders | /api/purchase-orders/:id |
Manage purchase orders (supports ?status=&supplierId=) |
POST |
/api/purchase-orders/:id/order |
Mark a draft PO as ordered |
POST |
/api/purchase-orders/:id/receive |
Record received quantities (receipts: [{ skuId, quantityReceived }]) — restocks automatically |
POST |
/api/purchase-orders/:id/cancel |
Cancel a PO (only before anything's been received) |
GET |
/api/auth/me |
Current session, whether login is required, and whether first-run setup is needed |
POST |
/api/auth/login | /api/auth/logout |
Sign in / sign out |
POST |
/api/auth/setup |
Create the first account (always admin) — only works before any account exists |
GET/POST |
/api/users | /api/users/:id |
Manage accounts, admin only (PUT/DELETE also by :id) |
GET |
/api/sync/identity |
This instance's id, name, and sync secret (admin only) |
GET/POST |
/api/sync/peers | /api/sync/peers/:id |
Manage sync peers, admin only (DELETE also by :id) |
POST |
/api/sync/peers/:id/sync-now |
Pull and push changes with one peer |
GET |
/api/sync/export?since= |
Peer-facing: export changes since a timestamp — authenticated by shared secret (X-Sync-Secret header), not login |
POST |
/api/sync/import |
Peer-facing: import a peer's exported changes — same shared-secret authentication |
GET |
/api/health |
Health check |
Add screenshots of the dashboard, dark mode, and summary generator here before publishing.
| Dashboard | Dark Mode | Summary Generator |
|---|---|---|
| screenshot | screenshot | screenshot |
- v1.1.0 — Settings page (port, data/backup directories, automatic backups, default theme, low-stock threshold default)
- v1.2.0 — CSV/Excel import & export, printable reports
- v1.3.0 — Barcode/QR scanning, label generation, bulk printing, product images
- v1.4.0 — Multi-store/warehouse support, stock transfers between locations, supplier management, purchase order tracking
- v1.5.0 — Offline-first PWA, installable desktop/mobile experience, background sync
- v2.0.0 — Multi-user support with roles, optional authentication, LAN sync, optional cloud sync while preserving offline mode
This completes the originally planned roadmap. QuickStock Sync remains fully usable with zero configuration beyond npm install && npm start — every feature added since v1.0.0 is either invisible until you opt in (accounts, sync) or purely additive (locations, images, PWA).
Issues and pull requests are welcome! Please:
- Keep changes focused and scoped to one concern
- Include JSDoc comments on new functions
- Avoid introducing external runtime dependencies where the standard library or existing packages already cover the need
Released under the MIT License.
