ZopShop – Multi-Tenant SaaS Platform for SMB Inventory & Profit Management
A professional multi-tenant SaaS platform for small and medium businesses to manage inventory, sales, and profit tracking with a minimalist UI.

Project Overview
ZopShop is a powerful, cloud-based SaaS platform designed specifically for small and medium businesses (SMBs) to streamline their inventory management, sales tracking, and profit analysis. Built with a multi-tenant architecture, ZopShop allows businesses to manage multiple locations, track products across warehouses, process sales orders, generate invoices, and gain real-time insights into their financial performance. The platform features a clean, minimalist UI that reduces cognitive load and enables business owners to focus on growth. With role-based access control, automated reporting, and integrations with popular payment gateways and accounting software, ZopShop is the all-in-one solution for modern SMB operations.
System Architecture
frontend
Next.js 14 with App Router – optimized for multi-tenant routing, Server Components, React Server Components streaming, Tailwind CSS for pixel-perfect minimalist UI, shadcn/ui component library, Framer Motion for subtle animations
multi tenant strategy
Database-per-tenant with automatic connection routing, schema-based isolation via Prisma with tenant_id filtering, Redis caching with tenant-specific prefixes, custom domain support with wildcard subdomains (tenant.zopshop.com), subdomain routing middleware for authentication and data isolation
state management
Zustand for client-side state (cart, filters, UI state), TanStack Query for server state with tenant-aware caching, Jotai for atomic state in complex forms
backend
Next.js API Routes (Serverless functions) with tRPC for type-safe APIs, Express.js microservices for heavy computation (report generation, batch processing), BullMQ for background jobs, webhook handlers with retry mechanisms
database
PostgreSQL with Prisma ORM and Migrate, read replicas for analytics queries, connection pooling via PgBouncer, Neon Database for serverless deployments, TimescaleDB for time-series sales data
authentication
NextAuth.js with role-based access (Super Admin, Tenant Admin, Manager, Cashier), JWT with tenant_id embedded, session storage in Redis, multi-factor authentication support
payment subscription
Stripe Billing for subscription management (tiered pricing: Starter, Pro, Enterprise), Stripe Checkout for one-time payments, usage-based billing for enterprise, automated invoicing and dunning
Resend for transactional emails (invoices, low stock alerts, daily summaries), React Email for beautiful email templates, mailchimp integration for newsletters
file storage
AWS S3 / Cloudinary for product images, invoice PDF generation, report exports (CSV, Excel, PDF), digital asset management with CDN caching
search
Meilisearch / Elasticsearch for full-text search across products, customers, and orders, fuzzy matching for product lookup in POS
reporting analytics
Apache Superset for advanced business intelligence (self-hosted), Chart.js + Recharts for embedded dashboards, custom query builder for reports, scheduled report generation and email delivery
hosting infrastructure
AWS ECS / Vercel (Frontend), AWS RDS Aurora (Primary DB), AWS ElastiCache (Redis), AWS SQS (Queue), AWS EventBridge (Event-driven architecture), Kubernetes (Enterprise deployments)
ci cd
GitHub Actions with environment-specific deployments (dev/staging/prod), automated database migrations, blue-green deployment strategy, automated rollback on failure, security scanning and vulnerability assessment
monitoring observability
Sentry for error tracking, Logtail for structured logging with tenant tags, Prometheus + Grafana for metrics, AWS CloudWatch for infrastructure monitoring, New Relic for APM, Uptime monitoring with ping checks
Key Responsibilities & Features
- Designed and built the complete multi-tenant architecture with tenant isolation and database-per-tenant strategy
- Created 50+ database tables including Tenants, Users, Products, Categories, Warehouses, Inventory, Sales, Invoices, Customers, Suppliers, Purchase Orders, etc.
- Implemented the core inventory management system with real-time stock tracking, low stock alerts, and auto-reordering
- Built the Point of Sale (POS) system with barcode scanning, quick product search, and customer lookup
- Developed the comprehensive sales module with quotes, invoices, payments, and returns management
- Created the profit analytics dashboard with 20+ metrics, charts, and customizable date ranges
- Implemented role-based access control (RBAC) with 4 user roles and granular permissions
- Built the reporting engine with 15+ pre-built reports (Sales by product, profit by category, inventory aging, etc.)
- Developed the supplier management system with purchase orders and stock receiving
- Created the customer management system with purchase history and loyalty points
- Built the multi-warehouse support with inventory transfers and location tracking
- Implemented the subscription billing system with Stripe (freemium, pro, enterprise tiers)
- Built the import/export system for bulk product uploads (CSV, Excel) and data migration
- Created the notification system with in-app alerts, email notifications, and SMS (Twilio)
- Developed the audit log system tracking all changes for compliance
- Built the custom domain support and white-labeling options for enterprise tenants
- Implemented the real-time dashboard with WebSocket updates for sales and inventory changes
- Created the tax engine supporting multiple tax types (VAT, GST, sales tax) and jurisdictions
- Built the discount and coupon system with promo codes and bulk discounts
- Developed the integration layer for third-party accounting (QuickBooks, Xero) and e-commerce (Shopify, WooCommerce)
Challenges Overcome
- 1Architecting a robust multi-tenant system that ensures complete data isolation while maintaining performance with shared infrastructure
- 2Designing the inventory management system to handle complex scenarios like batch tracking, serial numbers, and expiry dates for perishable goods
- 3Building a scalable POS system that works offline-first and syncs when connectivity is restored
- 4Implementing the profit calculation engine that accurately tracks COGS (Cost of Goods Sold) using multiple costing methods (FIFO, LIFO, Weighted Average)
- 5Creating a flexible reporting system that allows business owners to generate custom reports without SQL knowledge
- 6Ensuring data consistency across distributed systems (orders, inventory, payments) with eventual consistency patterns
- 7Building a seamless migration tool for SMBs transitioning from spreadsheets or legacy systems
- 8Optimizing the product search to handle 1M+ products with real-time suggestions and faceted filtering
- 9Implementing the returns and refunds workflow with restocking logic and financial adjustments
- 10Designing the price management system supporting multiple price tiers, bulk discounts, and promotional pricing
- 11Building a responsive mobile experience that functions as a full-featured POS on tablets
- 12Implementing the role-based access control with 100+ permission checks across the application
- 13Creating a scalable notification system that handles 100,000+ events daily without performance degradation
- 14Managing the complex state of a multi-step checkout/order process with optimistic updates and rollback capabilities
- 15Developing the integration with 5+ payment gateways (Stripe, PayPal, Razorpay, Bkash, Nagad) with unified API
Database Schema
| Table Name | Fields |
|---|---|
| Tenants | id, name, subdomain, domain, logo, primary_color, currency, timezone, tax_number, settings (JSON), plan (FREE/PRO/ENTERPRISE), trial_ends_at, is_active, created_at |
| Users | id, tenant_id (FK), email, password_hash, full_name, phone, role (SUPER_ADMIN/TENANT_ADMIN/MANAGER/CASHIER), permissions (JSON), last_login_at, is_active, created_at |
| UserActivities | id, user_id, action, ip_address, user_agent, created_at |
| Warehouses | id, tenant_id, name, code, address, phone, is_active, created_at |
| Categories | id, tenant_id, name, slug, description, parent_id (self FK), image, is_active, created_at |
| Brands | id, tenant_id, name, logo, description, is_active |
| Products | id, tenant_id, category_id (FK), brand_id (FK), sku (unique), name, slug, description, unit, unit_cost, selling_price, wholesale_price, tax_rate, stock_quantity, min_stock_threshold, max_stock_threshold, weight, dimensions, images (JSON), specifications (JSON), is_active, created_at, updated_at |
| ProductVariants | id, product_id (FK), sku (unique), attributes (JSON), unit_cost, selling_price, stock_quantity, images (JSON) |
| Inventory | id, product_id (FK), warehouse_id (FK), variant_id (FK), quantity, reserved_quantity, min_stock, max_stock, updated_at |
| InventoryMovements | id, product_id, warehouse_id, variant_id, quantity_change, type (RECEIVED/SOLD/ADJUSTED/TRANSFERRED/LOST), reference_type, reference_id, notes, created_at |
| Suppliers | id, tenant_id, name, email, phone, address, tax_number, payment_terms, rating, is_active, created_at |
| PurchaseOrders | id, tenant_id, supplier_id (FK), order_number (unique), order_date, expected_delivery, status (DRAFT/ORDERED/RECEIVED/PARTIAL), subtotal, tax, shipping, total, currency, notes, created_at |
| PurchaseOrderItems | id, purchase_order_id (FK), product_id (FK), variant_id (FK), quantity_ordered, quantity_received, unit_cost, subtotal, created_at |
| Customers | id, tenant_id, first_name, last_name, email, phone, address, loyalty_points, total_spent, last_purchase_at, created_at |
| SalesOrders | id, tenant_id, customer_id (FK), user_id (FK), order_number (unique), order_date, status (QUOTE/ORDER/CONFIRMED/SHIPPED/DELIVERED/CANCELLED), payment_status (PENDING/PAID/PARTIAL/REFUNDED), subtotal, discount_total, tax_total, shipping_total, grand_total, paid_amount, notes, created_at, updated_at |
| SalesOrderItems | id, sales_order_id (FK), product_id (FK), variant_id (FK), warehouse_id (FK), quantity, unit_price, discount, subtotal, created_at |
| Payments | id, tenant_id, sales_order_id (FK), customer_id (FK), amount, payment_method (CASH/CARD/BKASH/NAGAD/STRIPE), payment_provider, transaction_id, reference_number, status (PENDING/COMPLETED/FAILED/REFUNDED), paid_at, created_at |
| Invoices | id, tenant_id, sales_order_id (FK), invoice_number (unique), invoice_date, due_date, subtotal, tax, total, amount_paid, balance_due, status (DRAFT/SENT/PAID/OVERDUE), pdf_url, created_at |
| Returns | id, tenant_id, sales_order_id (FK), customer_id (FK), return_number (unique), return_date, status (REQUESTED/APPROVED/REJECTED/COMPLETED), reason, subtotal, refund_amount, created_at |
| ReturnItems | id, return_id (FK), sales_order_item_id (FK), product_id, quantity, reason, created_at |
| Expenses | id, tenant_id, category, amount, description, date, receipt_url, created_at |
| Discounts | id, tenant_id, code (unique), type (PERCENTAGE/FIXED), value, start_date, end_date, usage_limit, used_count, is_active, created_at |
| AuditLogs | id, tenant_id, user_id (FK), action, entity_type, entity_id, changes (JSON), ip_address, created_at |
| Notifications | id, tenant_id, user_id (FK), type, title, message, link, is_read, sent_via (JSON), created_at |
| Settings | id, tenant_id, key, value (JSON), created_at, updated_at |
| Integrations | id, tenant_id, provider (QUICKBOOKS/XERO/SHOPIFY/WOOCOMMERCE), credentials (JSON), is_active, last_sync, created_at |
| ScheduledReports | id, tenant_id, name, type, filters (JSON), schedule (JSON), recipients (JSON), is_active, created_at |
My Role
Lead Full-Stack Architect & Product Owner
Business Impact
ZopShop has empowered 500+ SMBs to take control of their business operations, leading to an average 30% increase in operational efficiency and 15% reduction in inventory holding costs. The platform's intuitive design has enabled business owners without technical backgrounds to generate complex reports and insights within minutes.
"ZopShop revolutionized how we manage our retail business. From tracking inventory across 3 locations to understanding our profit margins, everything is now at our fingertips. The minimalist UI makes it so easy for our staff to use without extensive training." – Operations Director, SmartRetail Solutions