Skip to content

StaticB1/tuckshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TuckShop POC - Two-Way Sync

A proof-of-concept demonstrating the two-way synchronization between Admin and POS apps via file exchange (simulating WhatsApp transfer).

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                      DATA OWNERSHIP                                 │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   ADMIN (Owner's Phone)              POS (Shop Device)              │
│   ═════════════════════              ═════════════════              │
│                                                                     │
│   Controls:                          Controls:                      │
│   ✏️ Product names                   🛒 Sales transactions          │
│   ✏️ Prices (cost & selling)         🛒 Stock levels                │
│   ✏️ Active/inactive status          🛒 Receipt numbers             │
│                                                                     │
│         admin_config.json                pos_backup.json            │
│   ┌──────────────────────┐        ┌─────────────────────┐          │
│   │ • Product prices     │───────►│ Import prices       │          │
│   │ • No stock levels!   │        │ KEEP local stock!   │          │
│   └──────────────────────┘        └─────────────────────┘          │
│                                                                     │
│   ┌──────────────────────┐        ┌─────────────────────┐          │
│   │ View sales reports   │◄───────│ • Sales data        │          │
│   │ See stock levels     │        │ • Stock levels      │          │
│   └──────────────────────┘        └─────────────────────┘          │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

Key Concept

When POS imports config from Admin:

  • ✅ Prices are updated
  • ✅ Product names are updated
  • ✅ Stock levels are PRESERVED (not overwritten!)

This allows the Admin to change prices anytime without affecting the shop's inventory counts.

Run the Test

npm install
npm test

Output

The test will:

  1. Initialize a POS with 5 products
  2. Make 3 sales (stock decreases)
  3. Export POS backup → data/pos_backup.json
  4. Admin imports backup and sees sales
  5. Admin changes prices (Coca-Cola ↑, Chips ↓)
  6. Export Admin config → data/admin_config.json
  7. POS imports config
  8. Verify: Prices changed, but stock PRESERVED!

Files

  • schema.sql - Database schema
  • test.js - Complete test script
  • data/pos_backup.json - POS → Admin (sales + stock)
  • data/admin_config.json - Admin → POS (prices only, no stock!)

Next Steps

Build actual mobile apps (Capacitor/React Native) that:

  1. Use SQLite for local storage
  2. Export/import via Android Share Intent
  3. Transfer files via WhatsApp

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors