A mobile-first Progressive Web App (PWA) for managing dairy inventory, sales, and logistics.
Built with Next.js 14, Supabase, and TanStack Query.
Target Users:
- Salesmen (Mobile users with low internet connectivity)
- Admins (Desktop users for reporting and logistics)
Core Flow:
Factory β Main Store (GVM) β Branch (VEN) β Salesman β Customer
| Element | Value |
|---|---|
| Primary Color (Violet) | #3E2758 |
| Accent Color (Yellow) | #FACC15 |
| Background | #F3F4F6 |
| Surface | #FFFFFF |
| Font | Inter / Sans-serif |
- Framework: Next.js 14 (App Router, TypeScript)
- Database: Supabase (PostgreSQL)
- State Management: TanStack Query (React Query)
- Styling: Tailwind CSS (Mobile-first)
- Icons: Lucide React
- PWA: next-pwa (Webpack-based)
- POS (Point of Sale): Touch-optimized product selection with quantity steppers
- Offline Support: Cached shop list and debt tracking
- Route Management: View assigned shops in route order
- Cash Collection: Record payments and update shop balances
- Expense Tracking: Log fuel and other expenses
- Damage Reporting: Report broken/leaked items
- Stock Receiving: Process daily factory arrivals with GVM/VEN split
- Trip Planning: Assign salesmen to routes with vehicle tracking
- Inventory Dashboard: Real-time stock levels across warehouses
- Analytics: Daily reports, P&L, debtor lists with Excel export
- User Management: Create and manage salesman accounts
Node.js 18+
npm / yarn / pnpm
Supabase accountCreate .env.local:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_keynpm install
# or
yarn installnpm run devnpm run build
npm startneyyar-app/
βββ src/
β βββ app/ # Next.js App Router pages
β β βββ layout.tsx # Root layout with providers
β β βββ login/ # Authentication
β β βββ pos/ # Point of Sale (Salesman)
β β βββ route/ # Shop list
β β βββ admin/ # Admin portal
β βββ components/
β β βββ ui/ # Reusable UI primitives
β β βββ ToastContext.tsx # Toast notification system
β βββ lib/
β β βββ supabase.ts # Supabase client
β β βββ rpc.ts # RPC function wrappers
β β βββ utils.ts # cn() utility for Tailwind
β β βββ utils/ # Utility functions folder
β β βββ index.ts # Barrel export
β β βββ formatters.ts # money(), date formatters
β β βββ toast.ts # Toast notifications
β β βββ rpc.ts # RPC type definitions
β β βββ rpc-helpers.ts # RPC result handlers
β βββ providers/
β βββ QueryProvider.tsx # TanStack Query setup
β βββ SupabaseProvider.tsx # Auth state management
βββ public/
β βββ manifest.json # PWA manifest
β βββ favicon.png # Logo asset
βββ tailwind.config.ts
storehouses- GVM (ID: 1) and VEN (ID: 2)products- Product catalog with pricingshops- Customer shops with debt trackinginventory- Stock levels per warehousesales- Transaction recordssale_items- Line items for each saletrips- Daily route assignmentsexpenses- Salesman expense logsdamage_logs- Broken/leaked item tracking
process_sale_transaction()- Handles sale with inventory deductionprocess_daily_arrival()- Logs factory stock and splits to warehousescollect_payment()- Updates shop balancereport_damage()- Records damaged itemsget_daily_report()- Time-machine analytics
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#3E2758">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">{
"display": "standalone",
"background_color": "#3E2758",
"theme_color": "#3E2758"
}- Layout: Single column, stacked cards
- Navigation: Bottom tab bar (fixed)
- Touch Targets: Minimum 44px height
- Minimalism: Hide secondary info behind "Details" clicks
- Layout: Sidebar + Data Grid
- Density: Higher information density with generous whitespace
- Responsiveness: Tailwind breakpoints (md:, lg:)
- Use Skeletons for loading states (no spinners)
- Use Toast notifications for feedback (no alerts)
- Icons with labels only when necessary
- Generous padding on touch targets
- Run
neyyar_golden_master.sqlin Supabase - Verify Storehouses (ID: 1=GVM, 2=VEN)
- Create admin user with
role='admin'
- Configure
manifest.jsonwith standalone display - Add apple-mobile-web-app meta tags
- Generate 192x192 and 512x512 icons
- Implement POS stock validation (qty β€ inventory)
- Configure React Query cache for offline support
- Restrict number inputs to positive integers
- Morning: Admin receives 100 items
- Sales: Salesman sells 10 items
- Damage: Report 1 damaged item
- Verify: Dashboard shows 89 remaining
- Cash: Reconciliation matches physical money
Proprietary - Neyyar Dairy System Β© 2024