12 KiB
12 KiB
TindaGrid — Implementation Task Checklist
A phased, actionable roadmap for building the offline-first micro-ERP, POS, local AI assistant, and crowdsourced retail data platform.
📌 Phase 1: Environment & Cloud Infrastructure Setup
- 1.1 Flutter Mobile & Web PWA Setup
- Initialize Flutter project targeting Android (minSdk 24), Web (Offline-First PWA), and later iOS.
- Configure
web/manifest.json(standalone display mode, theme colors, app icons). - Configure
flutter_service_worker.jswith offline-first caching strategy. - Call
navigator.storage.persist()on web initialization to prevent browser cache eviction. - Configure state management (
flutter_riverpodorbloc). - Set up Soft UI design system with minimalism, Google Fonts (
Outfit&Inter), Light & Dark themes, and bilingual Taglish/English support (refer to ui_ux_design.md).
- 1.2 NestJS Monorepo Microservices Workspace Setup
- Initialize NestJS monorepo workspace in
backend/withnest-cli.json. - Configure
apps/directory for microservices (api-gateway,sync-service,catalog-service,storefront-service,b2b-analytics-service). - Configure
libs/directory for shared code (@lib/database,@lib/common,@lib/contracts). - Set up Prisma or Drizzle ORM in
libs/databaseconfigured for PostgreSQL. - Configure environment variables (
.env) and validation (@nestjs/config).
- Initialize NestJS monorepo workspace in
- 1.3 Neon.tech Database Setup
- Create free PostgreSQL project on neon.tech.
- Enable PostGIS extension (
CREATE EXTENSION IF NOT EXISTS postgis;). - Test serverless connection pooling strings from NestJS.
- 1.4 Cloudflare R2 Storage Setup
- Create an R2 bucket (e.g.,
tindagrid-storefronts). - Configure CORS policy allowing uploads from mobile/web origins.
- Generate S3-compatible API access keys (Access Key ID & Secret).
- Create an R2 bucket (e.g.,
- 1.5 Free Backend Deployment (Render / Vercel)
- Connect GitHub repository to Render (Free Web Service).
- Set up a
/healthendpoint in NestJS. - Configure a free ping monitor (cron-job.org or UptimeRobot) every 13 minutes to prevent 15-minute idle sleep.
💾 Phase 2: Local SQLite Database & Offline Engine (Flutter)
- 2.1 SQLite Schema & Migration Setup (
driftorpowersync)products: Barcode, name, category, cost price, selling price, current stock, is_tingi.inventory_logs: Product ID, change quantity, reason (restock, sale, damage, audit).sales&sale_items: Timestamp, payment method (Cash/GCash), total amount, profit.debts&debt_items: Customer name, phone, item list, borrowed date, due date, status.payables: Supplier/bodega debts, due dates, reminder notes.gcash_ledger: Transaction type (Cash-In/Cash-Out/Payment), amount, fee charged, reference number.gcash_fee_config: Fee brackets (min amount, max amount, fixed fee, percentage fee).sync_queue: Pending local changes queued for background upload.
- 2.2 Merchant Authentication & PIN Recovery (Zero-Friction & $0 SMS Cost)
- Implement Phone Number (
09xx-xxx-xxxx) + 4–6 Digit Store PIN authentication. - Support immediate offline usage without mandatory registration (register on sync/backup).
- Implement multi-method PIN recovery:
- Trusted device unlock via
local_auth(Fingerprint / Face ID / Screen Lock PIN). - Security question & answer recovery (Pet name, mother's maiden name, favorite snack).
- Optional backup email for 6-digit OTP reset.
- Trusted device unlock via
- Issue 30-day JWT token saved to Flutter secure storage (
flutter_secure_storage).
- Implement Phone Number (
- 2.3 Delta Synchronization & Multi-Device Cloud Sync Engine
- Implement local change tracker logging mutations to
sync_queue. - Implement manual "Sync Now" button + background worker on internet detection (
connectivity_plus). - Support multi-device login syncing store sales/inventory to owner's laptop or secondary phone.
- Implement cloud disaster recovery (auto-restore full catalog & ledgers on new device login).
- Handle conflict resolution (last-write-wins for inventory counts, additive for financial ledgers).
- Implement local change tracker logging mutations to
🛒 Phase 3: Barcode POS & Inventory Management (Flutter Mobile & Web)
- 3.1 Scanner & Audio/Haptic Feedback
- Integrate
mobile_scannerwith custom viewfinder overlay and flash toggle for Android/iOS. - Configure audio feedback: High beep for success, low double-buzz for failure.
- Configure haptic feedback via
vibration(crisp 50ms pulse vs heavy double pulse).
- Integrate
- 3.2 Barcode & Checkout Fallbacks on Flutter Web (Without Scanner Guns)
- Integrate laptop/webcam barcode scanning via HTML5
getUserMedia. - Build Smartphone Companion Scanner Mode (pair web POS with phone camera via QR code).
- Implement instant predictive search bar (type 2 letters to find items) + keyboard Enter.
- Implement 2-digit Price Look-Up (PLU) shortcut numbers for fast keyboard-only entry.
- Support USB/wireless barcode scanner guns via Flutter
HardwareKeyboardlistener.
- Integrate laptop/webcam barcode scanning via HTML5
- 3.3 Barcode Auto-Fill & Quick Add
- Query local SQLite/IndexedDB database on barcode detection.
- Query crowdsourced NestJS barcode API if not found locally.
- Auto-open "Quick-Add Product" modal with barcode pre-filled if unrecognized.
- 3.4 Tingi / Sachet Quick-Tap Visual Grid
- Grid of customizable picture buttons for unbarcoded goods (eggs, ice, candy, sachets).
- Quick quantity multipliers (+1, +5, +10).
- 3.5 Cart & Checkout
- Dynamic cart with real-time total and estimated merchant profit.
- Dual-payment selector: Cash (with auto change calculator) vs. GCash.
📱 Phase 4: GCash Float Ledger, Fee Scheduler & Rate Card PDF
- 4.1 GCash Cash-In & Cash-Out Ledger
- Dedicated ledger for Cash-In, Cash-Out, and Store Sales payments.
- Real-time float calculation (GCash E-Wallet Balance vs. Physical Cash Drawer).
- 4.2 Customizable Fee Schedule (Editable Rates)
- UI to create and edit custom fee brackets (e.g., ₱1–₱500 = ₱10; ₱501–₱1,000 = ₱15).
- Support flat percentage rates (e.g., 1.5% or 2%).
- Automatic fee calculation at checkout based on transaction amount.
- 4.3 Printable Rate Card PDF Generator
- Integrate Flutter packages:
pdfandprinting. - Design branded, high-contrast PDF layout for GCash service fees.
- Support printable formats: Standard A4, A5, and 58mm/80mm POS thermal receipt.
- Options to direct-print to Bluetooth thermal printer or export as image/PDF to share or laminate.
- Integrate Flutter packages:
- 4.4 On-Device GCash Receipt OCR
- Camera scanner using
google_mlkit_text_recognition. - Regex parser extracting 13-digit GCash Reference Number from customer screen.
- Duplicate check against existing logged reference numbers to prevent screenshot scams.
- Camera scanner using
📝 Phase 5: Bi-Directional Debt Tracker (Utang & Payables)
- 5.1 Receivables (Pautang sa Tao)
- Customer directory with contact number and credit limit.
- Itemized debt logging with partial payment tracking.
- 1-tap shareable debt reminder via SMS, Messenger, or WhatsApp.
- 5.2 Payables (Utang sa Bodega)
- Supplier debt ledger tracking upcoming due dates for delivery vans or wholesale agents.
- In-app banner alert for debts due within 48 hours.
🤖 Phase 6: Mini Offline Local AI Assistant
- 6.1 Deterministic Intent-to-SQL Engine (Primary / Budget Phones)
- Taglish NLP tokenizer and regex slot-filler (dates, names, metrics).
- Map intents to parameterized local SQLite queries:
INTENT_TOP_DEBTORS: Query customers with largest unpaid balance.INTENT_LOW_STOCK: Query products below minimum safety threshold.INTENT_SALES_SUMMARY: Query sales grouped by date and payment mode (Cash vs. GCash).INTENT_GCASH_PROFIT: Query total fees collected from Cash-In/Cash-Out.
- 6.2 Optional SLM Pipeline (Capable Phones with >=3GB RAM)
- Evaluate
llama_cpp_dartor ONNX Runtime Mobile with SmolLM2-135M-Instruct (4-bit Q4_K_M). - System prompt constraining model to valid SQLite
SELECTqueries only. - Device RAM check fallback (devices <3GB automatically route to deterministic engine).
- Evaluate
- 6.3 Assistant UI
- Bottom-sheet chat drawer with voice-to-text / text input.
- Quick-action suggestion chips ("Sino may utang?", "Mababang stock", "Benta kahapon").
☁️ Phase 7: Central NestJS Monorepo Microservices & Neon Database
- 7.1 Microservices & Shared Libraries Implementation
apps/api-gateway: Unified HTTP/REST gateway, JWT merchant auth, rate limiting, and request routing.apps/sync-service: Delta synchronization workers (POST /sync/push,GET /sync/pull) & conflict resolution.apps/catalog-service: Crowdsourced global barcode registry (GET /barcodes/:code,POST /barcodes).apps/storefront-service: Store profiles, PostGIS spatial queries, and Cloudflare R2 pre-signed photo upload URLs.apps/b2b-analytics-service: Rate-limited B2B API protected by API keys (X-API-Key) for FMCG retail data feeds.libs/database&libs/common: Shared Prisma client, Neon connection pool, DTOs, guards, and logging interceptors.
- 7.2 PostGIS Spatial Queries
- Store geographic point using
ST_SetSRID(ST_MakePoint(lng, lat), 4326). - Implement radius query (
ST_DWithin) to find stores within X meters.
- Store geographic point using
- 7.3 Hybrid Deployment Configuration
- Set up single-container unified launcher for $0 MVP on Render / Vercel (<150 MB RAM).
- Configure independent microservice Dockerfiles for future horizontal scaling.
🌐 Phase 8: Storefront Discovery & Cloudflare Pages Web Link
- 8.1 Storefront Profile & Photo Upload
- Flutter camera capture for physical storefront photo.
- Client-side WebP compression (max 200 KB) using
flutter_image_compress. - Direct S3 upload to Cloudflare R2 via pre-signed URL.
- 8.2 Draft vs. Public Storefront Toggle
- Store settings toggle controlling visibility in public directory.
- 8.3 Public Storefront Web App (Cloudflare Pages)
- Lightweight standalone web app (HTML/CSS/JS or simple Flutter Web / Svelte) deployed on Cloudflare Pages.
- Dynamic store page URL:
tindagrid.com/:store-slug. - Display verified photo, address, operating hours, GPS pin on Leaflet/OpenStreetMap, and live product catalog.
- 8.4 Flutter Merchant Web PWA Build & Cloudflare Pages Deployment
- Configure production build:
flutter build web --pwa-strategy offline-first --wasm. - Deploy PWA to Cloudflare Pages for
app.tindagrid.com. - Verify PWA installation prompt ("Install App" / "Add to Home Screen") on Chrome & Edge.
- Test complete offline functionality (disconnect internet and verify app loads & registers sales from Cache).
- Configure production build:
🚀 Phase 9: Testing, Optimization & Deployment
- 9.1 Offline Stress Testing
- Test offline transactions with 500+ items logged without internet.
- Test reconnecting to internet and verify delta sync integrity.
- 9.2 Performance & Memory Optimization
- Verify Flutter app memory stays below 150 MB on entry-level Android devices.
- Confirm NestJS production bundle runs under 150 MB RAM on Render.
- 9.3 Build Automation
- Set up GitHub Actions CI workflow to build release Android APK.
- Test release APK installation on budget Android devices (Android 10–14).