Malamal.store — A Multi-Tenant Inventory Management SaaS Platform
A complete inventory management system built as a Progressive Web App (PWA) that enables small businesses to manage products, orders, and teams through a role-based access control system. Features include real-time analytics, POS terminal, restock queue management, barcode scanning, and WhatsApp integration — optimized for offline-first usage in regions with unreliable connectivity.
Overview
Malamal.store is a comprehensive inventory management SaaS platform designed specifically for small to medium businesses in South Asia (Bangladesh, India). The application was built as a PWA to ensure functionality even in areas with poor internet connectivity, allowing shop owners and managers to continue processing sales and managing inventory offline.
Core Architecture
The platform implements a multi-tenant SaaS architecture with three distinct user roles:
- Super Admin: Platform-level governance — manages all workspaces, approves new registrations, monitors system health
- Admin (Owner): Workspace-level control — owns the store, manages products, orders, staff, and settings
- Manager: Operational staff — day-to-day tasks with permission-gated access
The application uses Redux Toolkit for state management with middleware handling offline data persistence via localStorage, simulating a real backend experience.
Key Features
Feature | Description
| Product Management | Full CRUD with barcode, batch numbers, expiry tracking, and stock thresholds |
| Order Management | Create, track, and manage orders with payment records and due dates |
| POS Terminal | Full-screen point-of-sale interface with receipt generation |
| Analytics Dashboard | Revenue charts, profit margins, order volume, category analysis |
| Restock Queue | Automated low-stock alerts with priority-based processing |
| Team Management | Invite managers with granular permission controls |
| Expiry Alerts | Track near-expiry products for pharmacy/business compliance |
| PWA Support | Installable app with offline mode and background sync |
| Multi-Language | Full English and Bengali (Bangla) localization |
| WhatsApp Integration | Quick customer support via WhatsApp button |
Technical Implementation
- Frontend: Next.js 16 with App Router, React 19, TypeScript
- State: Redux Toolkit with custom offline middleware
- Styling: Tailwind CSS v4 with custom design tokens
- Forms: React Hook Form + Zod validation
- Charts: Recharts for analytics visualization
- i18n: i18next with Bengali and English locales
- PWA: Service workers with cache-first strategy
The Challenge
Real-World Problems Addressed
1. Fragmented Data in Small Businesses
- Small retailers in Bangladesh typically manage inventory on paper or spreadsheets
- No unified system for tracking products, orders, and customers
- Stockouts happen frequently because there's no automated alerting
2. Lack of Digital Literacy
- Interfaces must be extremely simple and intuitive
- Many users are not tech-savvy; the app needs to work in Bengali
- Onboarding must be frictionless, not overwhelming
3. Connectivity Issues
- Internet in rural/suburban Bangladesh is unreliable
- Cloud-only solutions fail when connectivity drops
- Users need offline access to continue operations
4. Team Management Complexity
- Shop owners need to delegate tasks without giving full access
- Managers need different permission levels for different responsibilities
- Security concerns — cost/pricing data should be owner-only
5. Billing in Local Currency
- Support for Bangladeshi Taka (BDT), Indian Rupee, USD, EUR
- Tax calculations vary by workspace
- Pricing display must handle multiple currencies
The Solution
Design Decisions
1. PWA-First Architecture
Built the entire application as an installable PWA from day one:
- Service workers cache all assets for offline use
- Redux state persists to localStorage automatically
- On reconnect, sync queue handles pending operations
- Works seamlessly in Chrome and Safari browsers
2. Role-Based Permission System
Implemented granular permissions per role:
- Managers get specific permissions (view_analytics, delete_products, restock_products, etc.)
- Profit data completely hidden from Manager role
- CSV exports restricted to Admin only
- Certain pages (Settings, Team, Suppliers) completely blocked for Managers
3. Niche-Specific Features
Tailored the app for Bangladeshi context:
- Bengali localization for all UI elements
- WhatsApp integration for support (common communication channel)
- BDT (৳) as default currency with support for others
- Pharmacy-specific features: expiry tracking, batch numbers, controlled substances flag
4. Onboarding Wizard
3-step wizard guides new admins through initial setup:
Name the store
Add first product
Invite a manager
Each step is simple and completable in under 2 minutes.
5. Automated Restock Queue
- Products automatically added to queue when stock drops below threshold
- Priority badges (HIGH/MEDIUM/LOW) based on severity
- One-click restock processing with supplier tracking
6. Real-Time Analytics
- Revenue and order charts update instantly
- Profit calculations based on cost price vs selling price
- Category profitability analysis
The Outcome
Results Achieved
1. Complete Offline Capability
- App functions 100% offline after initial load
- All core operations (product lookup, order creation, checkout) work without internet
- Data persists across browser sessions
2. Role-Gated Security
- Managers cannot see profit data or cost margins
- Permission system strictly enforced on every route
- No data leakage between roles
3. Full Localization
- Complete Bengali (Bangla) translation for all UI strings
- Language toggle instantly switches all content
- RTL-ready architecture supports future Arabic expansion
4. PWA Installability
- Android: Add to Home Screen via Chrome menu
- iOS: Add to Home Screen via Safari share button
- Launchable from home screen as native-like app
5. Scalable Architecture
- All types exported for backend integration
- API layer abstracted (lib/api/*)
- Ready for Supabase/Firebase backend migration
Lessons Learned
Key Takeaways
1. Offline-First Requires Different Thinking
- Can't assume API calls are instant or always available
- Need to queue operations and sync when online
- localStorage has size limits — need efficient storage strategy
2. Permissions Are Deeper Than UI Hiding
- True security requires backend enforcement
- Frontend hiding is convenience, not security
- API layer must validate permissions too
3. Localization Is More Than Translation
- Currency formats, date formats, number formats differ
- Must handle locale-specific display (৳ vs $)
- i18n requires upfront planning, not retrofit
4. PWA Installation Varies by Browser
- iOS requires specific Safari steps
- Android Chrome has install prompts, others don't
- Need clear in-app installation guides
5. State Management at Scale
- Redux Toolkit excellent for complex state
- Custom middleware handles cross-cutting concerns
- localStorage sync must handle race conditions
6. Multi-Tenant Requires Strict Data Isolation
- Every query must include tenantId
- No accidental data leakage between workspaces
- Super Admin impersonation needs clear session boundaries