Generated from full codebase review of
/srcandschema.prisma
Platform: Multi-Tenant SaaS E-Commerce | Stack: Next.js 16, React 19, TypeScript, Prisma, PostgreSQL
- Platform Overview
- Architecture Diagram
- Database Entity Map
- Feature Catalog
- F-01 Authentication & Authorization
- F-02 Multi-Tenant Architecture
- F-03 User Account Management
- F-04 Store Management
- F-05 Product Management
- F-06 Category Management
- F-07 Brand Management
- F-08 Product Attributes
- F-09 Inventory Management
- F-10 Order Management
- F-11 Customer Management
- F-12 Payment Processing
- F-13 Discount & Coupon System
- F-14 Subscription & Billing
- F-15 Storefront Builder
- F-16 Public Storefront
- F-17 Checkout Flow
- F-18 Order Tracking (Public)
- F-19 Analytics & Reporting
- F-20 Staff Management
- F-21 RBAC & Permissions
- F-22 Facebook/Meta Integration
- F-23 Pathao Courier Integration
- F-24 Webhook System
- F-25 Notification System
- F-26 Review System
- F-27 Audit Logging & Security
- F-28 Super Admin Panel
- F-29 Onboarding Flow
- F-30 Email Communication
- User Story Matrix
- Data Flow Diagrams
- Role Hierarchy
- Subscription Plan Comparison
- API Surface Summary
StormCom is a multi-tenant SaaS e-commerce platform built for businesses in Bangladesh and beyond. It provides:
- A merchant dashboard to manage stores, products, orders, and customers
- A public storefront with a visual theme builder
- Seamless Bangladesh payment gateway integrations (SSLCommerz, bKash, Nagad)
- Deep Facebook/Meta integration (Shop, Conversions API, Messenger)
- Pathao courier integration for last-mile delivery
- A subscription/billing engine with plan enforcement
| Attribute | Value |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack) |
| Frontend | React 19, TypeScript 5, Tailwind CSS v4 |
| ORM | Prisma 6.19 + PostgreSQL |
| Auth | NextAuth.js 4.24 |
| UI Components | shadcn/ui (New York style) |
| Primary Region | Bangladesh (BDT, Asia/Dhaka, Bengali locale) |
| Authentication | Email magic link + password |
| Deployment | Vercel (multi-zone) |
graph TB
subgraph Browser["Browser / Client"]
SPA["React 19 SPA<br/>(Client Components)"]
end
subgraph NextJS["Next.js 16 App (Port 3000)"]
Middleware["proxy.ts<br/>Subdomain Router + Auth Guard"]
AppRouter["App Router<br/>Server Components"]
API["API Routes<br/>/api/**"]
RSC["React Server<br/>Components"]
end
subgraph Storefront["Storefront Zone (Port 3001)"]
SF_Pages["Public Store Pages<br/>/store/[slug]/**"]
SF_API["Storefront API"]
end
subgraph DB["Data Layer"]
Prisma["Prisma ORM"]
Postgres["PostgreSQL"]
NextAuth["NextAuth.js<br/>JWT Sessions"]
end
subgraph Integrations["External Integrations"]
Resend["Resend<br/>(Email)"]
Facebook["Meta / Facebook<br/>Shop + Conversions API"]
Pathao["Pathao<br/>Courier Service"]
SSLCommerz["SSLCommerz<br/>Payment Gateway"]
bKash["bKash<br/>Mobile Banking"]
Nagad["Nagad<br/>Mobile Banking"]
Stripe["Stripe<br/>Card Payments"]
end
Browser -->|HTTPS| Middleware
Middleware -->|Subdomain → Store| Storefront
Middleware -->|Dashboard routes| AppRouter
AppRouter --> RSC
RSC --> Prisma
API --> Prisma
API --> Integrations
Prisma --> Postgres
SPA <-->|JWT| NextAuth
NextAuth --> Prisma
erDiagram
User ||--o{ Membership : has
User ||--o{ Account : has
User ||--o{ Session : has
User ||--o{ StoreStaff : works_at
User ||--o{ AuditLog : logs
User ||--o{ Notification : receives
Organization ||--o{ Membership : has
Organization ||--|| Store : owns
Store ||--o{ Product : has
Store ||--o{ Category : has
Store ||--o{ Brand : has
Store ||--o{ Order : receives
Store ||--o{ Customer : has
Store ||--o{ DiscountCode : has
Store ||--o{ Webhook : has
Store ||--o{ Subscription : has
Store ||--|| FacebookIntegration : has
Store ||--o{ PaymentConfiguration : has
Store ||--o{ StoreStaff : employs
Store ||--o{ CustomRole : defines
Product ||--o{ ProductVariant : has
Product ||--o{ ProductAttribute : has
Product ||--o{ Review : receives
Product |o--|| Category : belongs_to
Product |o--|| Brand : belongs_to
Product ||--o{ OrderItem : included_in
Product ||--o{ FacebookProduct : synced_to
Order ||--o{ OrderItem : contains
Order ||--o{ PaymentAttempt : has
Order |o--|| Customer : placed_by
Order |o--|| DiscountCode : uses
Order ||--o{ Fulfillment : fulfilled_by
Customer ||--o{ Order : places
Customer ||--o{ Review : writes
Subscription ||--|| SubscriptionPlanModel : based_on
Subscription ||--o{ Invoice : generates
Subscription ||--o{ SubPayment : paid_via
Subscription ||--o{ SubscriptionLog : logs
FacebookIntegration ||--o{ FacebookProduct : manages
FacebookIntegration ||--o{ FacebookOrder : imports
FacebookIntegration ||--o{ FacebookConversation : handles
FacebookIntegration ||--o{ ConversionEvent : tracks
Webhook ||--o{ WebhookDelivery : sends
AuditLog }o--|| Store : belongs_to
Description:
StormCom uses a multi-method authentication system powered by NextAuth.js. Users authenticate via email magic links or password. All sessions are JWT-based with user ID propagated into session callbacks.
Functionalities:
- Email magic link via Resend (production) / console-logged (dev)
- Password-based login (passwordHash field on User model)
- OAuth provider support via Account model
- Account status lifecycle:
PENDING → APPROVED → SUSPENDED/DELETED - Session stores:
session.user.id,session.user.email,session.user.name - CSRF protection built into NextAuth
- Middleware enforces auth on protected paths:
/dashboard,/settings,/team,/projects,/products - Signup requires business info fields
- Admin manual approval flow before dashboard access
Key Files:
src/lib/auth.ts— NextAuth configuration + lazy Resend initmiddleware.ts(nowproxy.ts) — subdomain routing + auth guardsrc/app/(auth)/login/page.tsx— login pagesrc/app/(auth)/signup/page.tsx— signup with business fieldssrc/app/(auth)/verify-email/page.tsx— email verificationsrc/app/(auth)/pending-approval/page.tsx— awaiting admin review
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-001 | New User | As a new user, I want to sign up with my email and business information so that I can create a merchant account |
| US-002 | New User | As a new user, I want to receive a magic link in my email so that I can log in securely without a password |
| US-003 | New User | As a new user, I want to see a "pending approval" screen after sign-up so that I know my account is being reviewed |
| US-004 | Returning User | As a returning user, I want to log in with my email magic link so that I can access my dashboard securely |
| US-005 | Admin | As a super admin, I want to approve or reject pending user accounts so that only verified businesses can use the platform |
| US-006 | Admin | As a super admin, I want to suspend a user account so that I can remove platform access without deleting their data |
Description:
StormCom is built as a multi-tenant platform where each merchant organization gets an isolated environment. Stores are routed by subdomain or custom domain.
Functionalities:
Organization→Store1:1 relationship (one store per org)- Subdomains:
{slug}.stormcom.com - Custom domain support via
customDomainfield on Store - Middleware reads
x-store-idheader set by subdomain router - All data queries filter by
storeIdto prevent cross-tenant leakage tenantWhere()scoped query builder in DAL- Multi-zone architecture (dashboard zone + storefront zone)
/apiroutes access store context from session + JWT
Key Files:
proxy.ts— subdomain → store ID mappingsrc/lib/prisma.ts— singleton Prisma clientapps/storefront/src/lib/tenant-context.ts— tenant resolutionapps/storefront/src/lib/dal.ts— data access layer
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-010 | Merchant | As a merchant, I want my store to be accessible at mystore.stormcom.com so that customers can find me |
| US-011 | Merchant | As a merchant, I want to use my own domain like shop.mybrand.com so that my brand identity is preserved |
| US-012 | Developer | As a developer building the platform, I want tenant data to be automatically scoped by storeId so that no merchant can see another's data |
Description:
Super admins manage the lifecycle of user accounts on the platform. Users register with business information and wait for approval.
Functionalities:
- User registration:
name,email,businessName,businessDescription,businessCategory,phoneNumber - Account status:
PENDING,APPROVED,REJECTED,SUSPENDED,DELETED - Admin listing: filter by status, search by name/email
- Admin approve/reject/suspend actions
- Super admin flag (
isSuperAdmin) for platform-level access - User details page for review
- Recent registrations count (last 7 days)
Key Files:
src/app/admin/users/page.tsx— admin users listsrc/app/admin/users/pending/page.tsx— pending approvalssrc/app/admin/users/[id]/page.tsx— user detail / review
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-020 | Super Admin | As a super admin, I want to see a list of all pending user registrations so that I can review and approve them |
| US-021 | Super Admin | As a super admin, I want to approve a user account so that the merchant can access their dashboard |
| US-022 | Super Admin | As a super admin, I want to reject a user account with a reason so that the applicant knows why they were denied |
| US-023 | Super Admin | As a super admin, I want to suspend an active user so that I can temporarily block platform access |
| US-024 | Super Admin | As a super admin, I want to filter users by their account status so that I can manage the approval queue efficiently |
| US-025 | Merchant | As a merchant, I want to complete my business profile at signup so that my application is properly reviewed |
Description:
Stores are the core tenant unit. Each approved organization gets one store. Store settings control currency, locale, timezone, and feature flags.
Functionalities:
- Store creation request workflow (
StoreRequestmodel) - Store fields:
name,slug,description,currency,locale,timezone - Subdomain routing:
{slug}.stormcom.com - Custom domain:
customDomain,customDomainVerified - Storefront configuration (JSON) — visual builder state
- Store soft delete (
deletedAt) - Store listing with pagination and search (admin)
- Store subscription association
- Store staff members
Key Files:
src/app/dashboard/stores/page.tsx— store management pagesrc/app/admin/stores/page.tsx— admin store listsrc/components/stores/stores-list.tsx— store list component
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-030 | Merchant | As a merchant, I want to request a store so that I can start selling products |
| US-031 | Super Admin | As a super admin, I want to approve store requests so that I can control onboarding |
| US-032 | Merchant | As a merchant, I want to configure my store's currency and timezone so that my store reflects my target market |
| US-033 | Merchant | As a merchant, I want to set a custom domain for my store so that customers see my brand URL |
| US-034 | Merchant | As a merchant, I want to view all my stores in one place so that I can manage multiple storefronts |
Description:
Full-featured product management with variant support, SEO, discounts, and inventory tracking at product and variant level.
Functionalities:
- Product CRUD:
name,slug,description,price,compareAtPrice,sku - Product status:
DRAFT,ACTIVE,ARCHIVED - Product variants:
variantName,variantValue,price,sku,stockQuantity - Product images (JSON array), thumbnail URL
- SEO fields:
metaTitle,metaDescription,metaKeywords - Featured products flag
- Product-level discounts:
discountType(PERCENTAGE,FIXED) - Discount date ranges:
discountStartDate,discountEndDate - Product barcode, weight, dimensions (W×H×D)
- Courier pricing overrides:
dhakaCourierCost,outsideDhakaCourierCost - Category and brand association
- Low stock threshold
- Full-text search via product listing
- Bulk operations
Key Files:
src/app/dashboard/products/page.tsx— product listsrc/app/dashboard/products/[id]/page.tsx— product detail/editsrc/lib/services/product.service.ts— product service
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-040 | Merchant | As a merchant, I want to create a product with name, price, description, and images so that customers can browse my catalog |
| US-041 | Merchant | As a merchant, I want to add product variants (size, color) so that customers can select the exact version they want |
| US-042 | Merchant | As a merchant, I want to set SEO fields on my products so that they rank better in search engines |
| US-043 | Merchant | As a merchant, I want to mark a product as featured so that it shows prominently on my store homepage |
| US-044 | Merchant | As a merchant, I want to set a sale price with date range so that discounts apply automatically during promotions |
| US-045 | Merchant | As a merchant, I want to set product weight and dimensions so that shipping costs can be calculated accurately |
| US-046 | Staff | As a content manager, I want to create products as drafts so that they are not visible until I'm ready to publish |
Description:
Hierarchical product categories with SEO support and sort ordering. Category images are shown on the storefront.
Functionalities:
- Category CRUD with parent/child hierarchy
- Category image upload
- SEO fields:
metaTitle,metaDescription isPublishedflagsortOrderfor display ordering- Top-level categories shown on storefront
- Product count by category
- Soft delete
Key Files:
src/app/dashboard/categories/page.tsx— category managersrc/lib/services/category.service.ts— category CRUD
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-050 | Merchant | As a merchant, I want to create product categories and nest subcategories so customers can browse by type |
| US-051 | Merchant | As a merchant, I want to upload a category image so the storefront shows visual category cards |
| US-052 | Merchant | As a merchant, I want to reorder categories so the most important ones appear first |
| US-053 | Merchant | As a merchant, I want to publish/unpublish categories so I can hide ones still being set up |
Description:
Brands can be created and associated with products. Brands have logos and website links.
Functionalities:
- Brand CRUD:
name,slug,description,logo,website - SEO fields:
metaTitle,metaDescription isPublishedflag- Products linked to brands
Key Files:
src/app/dashboard/brands/page.tsx— brands managersrc/lib/services/brand.service.ts— brand CRUD
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-060 | Merchant | As a merchant, I want to create brands so I can organize products by manufacturer |
| US-061 | Merchant | As a merchant, I want to upload a brand logo so the brand is visually identifiable |
| US-062 | Customer | As a customer, I want to filter products by brand so I can find my preferred brands quickly |
Description:
Custom product attributes allow merchants to define dynamic specifications per product.
Functionalities:
- Attribute definition:
ProductAttributewithname,type,unit,isRequired - Attribute types:
TEXT,NUMBER,BOOLEAN,SELECT,MULTISELECT - Attribute values:
ProductAttributeValuelinked to products - Attribute ordering via
sortOrder
Key Files:
src/app/dashboard/attributes/page.tsx— attribute manager
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-070 | Merchant | As a merchant, I want to define custom attributes (e.g., "Material", "Warranty") for my products so specifications are displayed to customers |
| US-071 | Merchant | As a merchant, I want to mark attributes as required so staff always enters key product specs |
Description:
Real-time inventory tracking with reservation system to prevent over-selling during order processing.
Functionalities:
- Stock quantity tracked per product and variant
- Inventory status enum:
IN_STOCK,LOW_STOCK,OUT_OF_STOCK,DISCONTINUED - Low stock threshold (
lowStockThreshold) per product InventoryReservation— holds stock during pending/in-cart ordersInventoryLog— historical record of all stock changes- Bulk inventory update
- Low stock alerts
- Inventory report export
Key Files:
src/app/dashboard/inventory/page.tsx— inventory managersrc/lib/services/inventory.service.ts— inventory operations
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-080 | Merchant | As a merchant, I want to see real-time stock levels so I know what's available to sell |
| US-081 | Merchant | As a merchant, I want to set a low stock threshold so I get alerted before running out |
| US-082 | Operations | As an inventory manager, I want to log inventory adjustments with reasons so the history is auditable |
| US-083 | System | As the platform, when an order is placed, inventory should be reserved so it cannot be sold to another customer simultaneously |
| US-084 | Merchant | As a merchant, I want to see the full inventory history for a product so I can track when stock was added or removed |
Description:
Complete order lifecycle management from placement through delivery, with multi-payment method support, fulfillment tracking, and Pathao courier integration.
Functionalities:
- Order creation (storefront checkout)
- Order statuses:
PENDING,CONFIRMED,PROCESSING,SHIPPED,DELIVERED,CANCELLED,REFUNDED - Payment statuses:
PENDING,PAID,FAILED,REFUNDED,PARTIALLY_REFUNDED - Order items: product name/price snapshot at time of order
- Shipping address stored on order
- Discount code application
- Customer notes and admin notes
- Order number prefixed:
ORD-YYYYMMDD-XXXX - Fulfillment tracking per order
- Pathao consignment creation from order
- Bulk order management (filter by status, payment, date)
- Order export
- Admin override of order status
Key Files:
src/app/dashboard/orders/page.tsx— order listsrc/lib/services/order.service.ts— order CRUDsrc/lib/services/order-processing.service.ts— order state machine
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-090 | Customer | As a customer, I want to place an order and receive a confirmation with an order number so I can track my purchase |
| US-091 | Merchant | As a merchant, I want to see all new orders in my dashboard so I can process them promptly |
| US-092 | Merchant | As a merchant, I want to update order status (e.g., from Processing to Shipped) so customers are informed |
| US-093 | Merchant | As a merchant, I want to cancel an order and trigger a refund so I can handle out-of-stock situations |
| US-094 | Operations | As a delivery manager, I want to create a Pathao consignment from an order so the parcel is dispatched automatically |
| US-095 | Merchant | As a merchant, I want to add admin notes to an order so my team has context for special handling |
| US-096 | Merchant | As a merchant, I want to export orders as CSV so I can do offline analysis |
| US-097 | Customer Service | As a customer service rep, I want to search orders by customer phone so I can quickly find order details |
Description:
Customer profiles aggregate purchasing behavior and enable targeted marketing.
Functionalities:
- Customer model:
name,email,phone,address - Auto-created from checkout or linked to User
totalOrders,totalSpent,averageOrderValue(computed)marketingOptInflaglastOrderAtdate- Customer listing with search and filter
- Customer order history
- Lifetime value calculation
- Notes on customer
Key Files:
src/app/dashboard/customers/page.tsx— customer listsrc/lib/services/customer.service.ts— customer CRUD
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-100 | Merchant | As a merchant, I want to view all my customers with their total spend so I can identify my VIPs |
| US-101 | Marketing | As a marketing manager, I want to see which customers opted into marketing so I can build email campaigns |
| US-102 | Merchant | As a merchant, I want to view a customer's full order history so I can provide great customer service |
| US-103 | Customer Service | As a customer service rep, I want to search customers by phone number so I can resolve complaints faster |
Description:
StormCom supports multiple payment gateways, each configurable per store. Credentials are AES-256-CBC encrypted. Payment attempts are tracked with full lifecycle.
Gateways Supported:
| Gateway | Type | Region |
|---|---|---|
| SSLCommerz | Cards, Mobile Banking, Internet Baking | Bangladesh |
| bKash | Mobile Banking | Bangladesh |
| Nagad | Mobile Banking | Bangladesh |
| Stripe | International Credit/Debit Cards | Global |
| Manual | Cash on Delivery | Any |
Functionalities:
- Per-store payment configuration
- Enable/disable gateway toggle
- Test mode flag per gateway
- AES-256-CBC encrypted credentials storage
PaymentAttemptmodel tracks each payment try- Idempotency keys (
IdempotencyKey) prevent duplicate charges - Webhook callbacks from gateways (SSLCommerz IPN, bKash callback)
- Transaction history view
- Platform fee configuration
- Payment configuration via admin panel
Key Files:
src/app/dashboard/settings/payments/page.tsx— payment gateway settingssrc/lib/payments/— gateway-specific implementationssrc/lib/encryption.ts— AES-256-CBC credential encryptionsrc/app/api/payments/— payment API routes
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-110 | Merchant | As a merchant, I want to configure bKash as a payment method so my Bangladesh customers can pay via mobile banking |
| US-111 | Merchant | As a merchant, I want to test payment gateways in sandbox mode before going live |
| US-112 | Customer | As a customer, I want to choose from multiple payment methods at checkout so I can pay how I prefer |
| US-113 | Merchant | As a merchant, I want to see all transactions with their statuses so I can reconcile payments |
| US-114 | SuperAdmin | As a super admin, I want to set platform fees per gateway so that the platform earns from transactions |
Description:
Flexible promotional tooling with coupon codes, product-level discounts, and advanced targeting rules.
Functionalities:
- Coupon codes:
DiscountCodemodel - Discount types:
PERCENTAGE,FIXED_AMOUNT,FREE_SHIPPING - Minimum order amount
- Maximum uses (total and per customer)
- Date range validity (
startDate,endDate) - Active/inactive toggle
- Product-level discounts (on
Productmodel):discountType,discountValuediscountStartDate,discountEndDate- Automatic expiry
- Coupon creation form with all fields
- Coupon listing with usage stats
Key Files:
src/app/dashboard/coupons/page.tsx— coupon managersrc/components/coupons/coupons-list.tsx— coupon listsrc/lib/services/discount.service.ts— discount logic
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-120 | Merchant | As a merchant, I want to create a percentage discount coupon so customers can get 20% off their purchase |
| US-121 | Merchant | As a merchant, I want to set a minimum order amount on coupons so discounts only apply to qualifying orders |
| US-122 | Merchant | As a merchant, I want to limit coupon usage per customer so the same customer can't redeem it multiple times |
| US-123 | Merchant | As a merchant, I want to schedule coupon validity dates so the code activates automatically during a sale event |
| US-124 | Customer | As a customer, I want to apply a coupon code at checkout so I receive my discount |
| US-125 | Merchant | As a merchant, I want to mark specific products on sale with a price reduction that expires automatically |
Description:
Multi-tier subscription system with trial periods, grace periods, feature enforcement, invoicing, and payment retry. Supports per-store subscription management.
Plan Tiers:
| Tier | Products | Staff | Storage | Custom Domain | API Access |
|---|---|---|---|---|---|
| FREE | 10 | 1 | 100 MB | ✗ | ✗ |
| BASIC | Configurable | Configurable | Configurable | ✗ | ✗ |
| PRO | Configurable | Configurable | Configurable | ✓ | ✓ |
| ENTERPRISE | Configurable | Configurable | Configurable | ✓ | ✓ |
| CUSTOM | Admin-overridable | Admin-overridable | Admin-overridable | ✓ | ✓ |
Functionalities:
- Trial period (configurable days)
- Grace period after expiry
- Auto-renewal
- Cancel at period end (no immediate termination)
- Scheduled downgrades
- Feature flags:
posEnabled,accountingEnabled,customDomainEnabled,apiAccessEnabled SubscriptionLogfor state transitions- Invoice generation with line items
SubPaymentmodel for payment tracking- Admin feature overrides (
featureOverridesJSON) FeatureCheckResultwith usage/limit data returned to UI- Enforcement:
canCreateProduct(),canAddStaff()before operations - Subscription analytics: MRR, ARR, churn rate
Key Files:
src/lib/subscription/types.ts— all type definitionssrc/lib/subscription/feature-enforcer.ts— limit checkssrc/lib/subscription/state-machine.ts— lifecycle transitionssrc/app/dashboard/subscriptions/page.tsx— subscription dashboardsrc/app/admin/subscriptions/page.tsx— admin subscription management
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-130 | New Merchant | As a new merchant, I want a free trial so I can evaluate the platform before committing |
| US-131 | Merchant | As a merchant on the free plan, I want to see my usage vs limits so I know when to upgrade |
| US-132 | Merchant | As a merchant, I want to upgrade my plan so I can add more products and staff |
| US-133 | Merchant | As a merchant, I want to cancel my subscription without losing access immediately so I can use the remaining period |
| US-134 | Merchant | As a merchant, I want to receive an invoice for each billing cycle so I have records for accounting |
| US-135 | Super Admin | As a super admin, I want to override feature limits for specific stores so I can give enterprise clients custom packages |
| US-136 | System | As the platform, I want to block product creation when the product limit is reached so the plan is enforced |
Description:
A visual no-code storefront builder with theme templates, section management, custom CSS, and live preview. Merchants can customize their entire store appearance without writing code.
Functionalities:
- Theme templates:
modern,classic,bold,elegant,minimal,boutique - Color scheme editor (primary, secondary, accent, background, foreground)
- Typography: font family, base size, heading scale
- Layout modes:
full-width,boxed,centered - Border radius global setting
- Custom CSS editor (sandboxed)
- Section management (add, remove, reorder)
- Section types: hero, categories, featured products, new arrivals, testimonials, newsletter, trust badges, brands carousel, discount banners
- Hero variants: gradient, image, minimal, split, video
- Typing effect animation for hero
- Parallax scrolling option
- Discount banners (top/bottom, configurable text + colors)
- Trust badges with icon selection
- Newsletter section
- Testimonials section
- Brands carousel
- Draft/publish workflow with version history
- Live preview in iframe (preview bridge via
postMessage) - Section settings panel per section
Key Files:
src/components/dashboard/storefront/editor/— 25+ editor componentssrc/lib/storefront/types.ts— all configuration typessrc/lib/storefront/defaults.ts— default configurationssrc/lib/storefront/section-registry.ts— section definitionssrc/components/storefront/— storefront UI components
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-140 | Merchant | As a merchant, I want to choose a theme template for my store so I have a professional starting point |
| US-141 | Merchant | As a merchant, I want to change my brand colors so the store reflects my brand identity |
| US-142 | Merchant | As a merchant, I want to customize the hero section with my own image and headline |
| US-143 | Merchant | As a merchant, I want to reorder sections on my homepage so the most important content appears first |
| US-144 | Merchant | As a merchant, I want to add a discount banner announcing a sale so customers are immediately aware |
| US-145 | Merchant | As a merchant, I want to preview changes before publishing so I don't accidentally break my live store |
| US-146 | Merchant | As a merchant, I want to add custom CSS for advanced styling without needing to deploy code |
Description:
The consumer-facing storefront with all e-commerce functionality. Routed by subdomain or custom domain.
Functionalities:
- Homepage: hero + category grid + featured products + new arrivals + best sellers + testimonials + brands + newsletter
- Category browse: filter, sort, infinite scroll/pagination
- Product detail page: images, variants, add to cart, reviews
- Product search
- Shopping cart (localStorage or session)
- Top/bottom discount banners
- Trust badges
- Branded header with navigation
- Responsive mobile layout
- Theme/customization from storefront config
- Custom CSS injected via
<style>tags (XSS-safe) - SEO metadata from products/categories
Key Files:
src/app/store/[slug]/page.tsx— store homepagesrc/app/store/[slug]/products/— product listingsrc/app/store/[slug]/categories/— category pagessrc/app/store/[slug]/cart/— shopping cartsrc/app/store/[slug]/checkout/— storefront checkout
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-150 | Customer | As a customer, I want to browse a store's homepage with featured products so I can discover what's available |
| US-151 | Customer | As a customer, I want to browse products by category so I can find what I'm looking for quickly |
| US-152 | Customer | As a customer, I want to see product images, price, and description on the product detail page |
| US-153 | Customer | As a customer, I want to add products to my cart so I can purchase multiple items together |
| US-154 | Customer | As a customer visiting from a Facebook ad, I want the discount banner to show so I know about promotions |
| US-155 | Customer | As a customer on mobile, I want the store to be fully responsive so I can shop from my phone |
Description:
A 3-step checkout flow (cart review → shipping → payment) with multiple payment options and order confirmation.
Functionalities:
- Step 1: Cart review with item list, quantities, subtotals
- Step 2: Shipping address form (first/last name, email, phone, address, city, state, zip, country)
- Step 3: Payment method selection + payment initiation
- Order summary sidebar (sticky, shows during all steps)
- Promo code input
- Secure checkout badge
- Order creation with idempotency key
- Redirect to confirmation page on success
- SSLCommerz redirect to bank page
- bKash in-page payment widget
- Nagad payment flow
Key Files:
src/app/checkout/page.tsx— checkout wizardsrc/components/checkout/cart-review-step.tsx— cart stepsrc/components/checkout/shipping-details-step.tsx— shipping stepsrc/components/checkout/payment-method-step.tsx— payment stepsrc/app/checkout/confirmation/page.tsx— order confirmation
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-160 | Customer | As a customer, I want a clear step-by-step checkout so I know exactly where I am in the process |
| US-161 | Customer | As a customer, I want to review my cart before paying so I can make final adjustments |
| US-162 | Customer | As a customer, I want to enter my delivery address during checkout |
| US-163 | Customer | As a customer, I want to pay via bKash so I can use my mobile banking app |
| US-164 | Customer | As a customer, I want to see an order confirmation with my order number after paying |
| US-165 | Customer | As a customer, I want to apply a promo code in checkout to receive my discount |
Description:
A public-facing order tracking feature that lets customers check delivery status without logging in.
Functionalities:
- Search by order number (
ORD-YYYYMMDD-XXXXformat) or phone number - Lookup via
/api/orders/trackendpoint - Display order status, items, shipping address
- Pathao consignment tracking status
- Delivery timeline visualization
Key Files:
src/app/track/page.tsx— order tracking searchsrc/app/track/order/[id]/page.tsx— order status detailsrc/app/api/orders/track/route.ts— search API
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-170 | Customer | As a customer, I want to track my order using my order number so I know when my package will arrive |
| US-171 | Customer | As a customer, I want to track my order using my phone number in case I lost my order confirmation email |
| US-172 | Customer | As a customer, I want to see the delivery timeline so I know what stage my package is at |
Description:
Comprehensive business analytics for merchants and the platform admin, with period-over-period comparisons and cached queries.
Functionalities:
- Dashboard stats (7-query batched $transaction):
- Total revenue + period comparison
- Order count + period comparison
- New customers + period comparison
- Active products count
- Sales report: daily aggregated sales data with charts
- Revenue report: daily revenue aggregation
- Top products by revenue (using Prisma
groupBy) - Customer metrics:
- Total customers, new customers, returning customers
- Customer retention rate
- Churn rate
- Average customer lifetime value
- Subscription analytics (MRR, ARR, churn, trial conversion)
- Facebook integration analytics
- Analytics cached with
unstable_cache(5-minute TTL) - Cache tag invalidation via
revalidateTag() - Skeleton loading states with Suspense
Key Files:
src/lib/services/analytics.service.ts— core analyticssrc/app/dashboard/analytics/page.tsx— analytics pagesrc/components/analytics/analytics-dashboard.tsx
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-180 | Merchant | As a merchant, I want to see today's revenue vs yesterday on my dashboard so I can monitor trends at a glance |
| US-181 | Merchant | As a merchant, I want a daily revenue chart so I can see sales patterns over time |
| US-182 | Merchant | As a merchant, I want to see my top-selling products so I can invest in what's working |
| US-183 | Merchant | As a merchant, I want to see customer retention metrics so I understand loyalty |
| US-184 | Super Admin | As a super admin, I want to see platform-wide MRR and ARR metrics so I can report on business health |
Description:
Store owners can invite staff members with specific roles. Custom roles can be requested and approved. Staff access is enforced by RBAC.
Functionalities:
- Invite staff by email
- Assign store-level roles
- Custom role request: define name, description, permissions
- Custom role approval workflow (admin review)
- Staff listing with role filter
- Staff deactivation
- Staff activity tracked in audit log
- Role levels:
StoreAdmin,SalesManager,InventoryManager,CustomerService,ContentManager,MarketingManager,DeliveryBoy
Key Files:
src/components/staff/staff-management.tsx— staff management componentsrc/app/api/store/staff/— staff API routessrc/app/dashboard/settings/team/page.tsx— team settings
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-190 | Store Owner | As a store owner, I want to invite staff by email so they can help manage the store |
| US-191 | Store Owner | As a store owner, I want to assign roles to staff so they only have access to relevant features |
| US-192 | Store Owner | As a store owner, I want to deactivate a staff member who left the company |
| US-193 | Staff | As a staff member, I want to see only the dashboard sections I have permission for |
| US-194 | Store Owner | As a store owner, I want to create a custom role with specific permissions so I can precisely control access |
| US-195 | Super Admin | As a super admin, I want to review and approve custom role requests so non-standard permissions are vetted |
Description:
A comprehensive role-based access control system with 13 roles across 4 organizational levels, granular permissions, and wildcard support.
Role Levels:
| Level | Roles |
|---|---|
| Platform (4) | SUPER_ADMIN, PLATFORM_SUPPORT |
| Organization (3) | OWNER, ADMIN, MEMBER, VIEWER |
| Store (2) | STORE_ADMIN, SALES_MANAGER, INVENTORY_MANAGER, CUSTOMER_SERVICE, CONTENT_MANAGER, MARKETING_MANAGER, DELIVERY_BOY |
| Customer (1) | CUSTOMER |
Permission Format: resource:action:scope
Examples: products:create:own_store, orders:read:all, analytics:view:*
Functionalities:
hasPermission(role, permission)— exact matchhasAnyPermission(role, permissions[])— OR checkhasAllPermissions(role, permissions[])— AND checkcanAccessResource(role, resource)— resource-level check- Wildcard support:
*for full access (SUPER_ADMIN) - Resource wildcards:
products:* getRoleLevel(role)— numeric hierarchy comparisonhasRoleLevelOrHigher(role, minLevel)— hierarchy check
Key Files:
src/lib/permissions.ts— full RBAC implementation
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-200 | Super Admin | As a super admin, I want to have access to all platform features via wildcard permissions |
| US-201 | Store Owner | As a store owner, I want my staff's permissions to be checked before every action so unauthorized operations are blocked |
| US-202 | System | As the system, I want to check resource permissions at API level so even direct API calls are protected |
Description:
Deep integration with the Facebook ecosystem: product catalog sync, order import, Messenger, and server-side conversion tracking via Meta Conversions API.
Functionalities:
- Facebook OAuth 2.0 login flow
FacebookIntegrationmodel: page ID, catalog ID, pixel ID, access token- Product catalog sync to Facebook Catalog
- Inventory sync snapshots (
FacebookInventorySnapshot) - Facebook Shop order import (
FacebookOrder) - Order status sync back to Facebook
- Facebook Messenger integration:
FacebookConversation,FacebookMessage - Meta Pixel script injection on storefront
- Server-side Conversions API events:
ViewContent,AddToCart,Purchase,Lead, etc. ConversionEventmodel with retry logic (PENDING → SENT → FAILED)FacebookBatchJobfor bulk operationsFacebookWebhookLogfor incoming webhooksFacebookOAuthStatefor OAuth CSRF protectionFacebookCheckoutSessionfor attribution- Regional availability check (limited to supported countries)
Key Files:
src/lib/integrations/facebook/— 15+ integration filessrc/app/dashboard/integrations/facebook/page.tsx— Facebook dashboardsrc/components/facebook/— Facebook UI components
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-210 | Merchant | As a merchant, I want to connect my Facebook Business account so I can sell on Facebook Shop |
| US-211 | Merchant | As a merchant, I want to sync my product catalog to Facebook so my inventory matches |
| US-212 | Merchant | As a merchant, I want to import orders from Facebook so I manage everything in one place |
| US-213 | Marketing | As a marketing manager, I want Meta Pixel to fire on my store so I can track ad performance |
| US-214 | Marketing | As a marketing manager, I want server-side conversion events so my tracking is more accurate and ad-blocker resistant |
| US-215 | Customer Service | As a customer service rep, I want to see Facebook Messenger conversations so I can respond without leaving the dashboard |
Description:
Integration with Pathao, Bangladesh's leading courier network, for automated parcel creation and tracking.
Functionalities:
- OAuth2 password-grant authentication
- Token refresh with callback for persistent storage
- Pathao store configuration
- City/Zone/Area lookup endpoints
- Order creation: recipient details, delivery type (Normal 48hr / On-Demand 12hr), item type, COD amount
- Consignment ID tracking
- Order status polling
- Delivery fee calculation
- Sandbox and production environment support
Environments:
- Sandbox:
https://courier-api-sandbox.pathao.com - Production:
https://api-hermes.pathao.com
Key Files:
src/lib/services/pathao.service.ts— Pathao API integrationsrc/app/dashboard/settings/shipping/page.tsx— shipping settings
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-220 | Merchant | As a merchant, I want to connect my Pathao account so I can dispatch orders directly from the dashboard |
| US-221 | Operations | As a delivery manager, I want to create Pathao consignments in one click from the order detail page |
| US-222 | Operations | As a delivery manager, I want to select city, zone, and area for delivery so Pathao routes correctly |
| US-223 | Merchant | As a merchant in Bangladesh, I want different courier prices for inside/outside Dhaka so pricing is accurate |
Description:
Merchants can configure webhooks to receive real-time events from their store via HTTP POST to external endpoints.
Functionalities:
- Create webhooks with URL, event subscriptions, custom headers
Webhookmodel:url,events(array),secret,isActiveWebhookDeliverymodel: request/response log, status, retry count- Event types: order.created, order.updated, product.created, inventory.updated, etc.
- Automatic retry on failure
- Delivery history view
- Manual retry trigger
- Webhook signing (HMAC-SHA256 secret)
Key Files:
src/app/dashboard/webhooks/page.tsx— webhook managersrc/components/webhooks/webhooks-list.tsxsrc/lib/services/webhook.service.ts
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-230 | Developer | As a developer integrating with a store, I want to receive webhook events when orders are created so my external system stays in sync |
| US-231 | Merchant | As a merchant, I want to view webhook delivery logs so I can debug integration issues |
| US-232 | Developer | As a developer, I want webhooks to be signed so I can verify they're genuinely from StormCom |
| US-233 | Developer | As a developer, I want failed webhooks to retry automatically so transient errors don't cause missed events |
Description:
In-app notification system for merchant alerts about account status, orders, staff changes, and platform events.
Notification Types (26 defined): Account, store, role, staff events, subscription alerts, order alerts, platform broadcasts.
Functionalities:
Notificationmodel:title,message,type,actionUrl- Read/unread status with
readAttimestamp - Notification bell icon in header with unread count
- Notification list with mark-all-read
- Action URL for deep-linking to related content
- Created by system via
userId→ receiver lookup - Email notifications for critical events
Key Files:
src/app/dashboard/notifications/page.tsx— notifications listsrc/components/notifications/notifications-list.tsx
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-240 | Merchant | As a merchant, I want to see a notification when my account is approved so I can start setting up my store |
| US-241 | Merchant | As a merchant, I want to see a notification bell badge so I know there are unread notifications |
| US-242 | Merchant | As a merchant, I want to mark all notifications as read so my notification center stays clean |
| US-243 | Merchant | As a merchant, I want clicking a notification to take me to the relevant page (e.g., the order) |
Description:
Product review and rating system with admin moderation and verified purchase badges.
Functionalities:
Reviewmodel:rating(1-5),title,comment,images- Verified purchase flag (
isVerified) - Approval workflow:
isApproved,approvedAt - Reviews per product aggregation
- Admin review moderation queue
- Review display on product pages
Key Files:
src/app/dashboard/reviews/page.tsx— review moderationsrc/lib/services/review.service.ts
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-250 | Customer | As a customer, I want to leave a product review with a star rating so other shoppers benefit from my experience |
| US-251 | Customer | As a customer, I want to see a "Verified Purchase" badge so I know which reviews come from real buyers |
| US-252 | Merchant | As a merchant, I want to approve reviews before they're published so I can moderate inappropriate content |
| US-253 | Merchant | As a merchant, I want to see all product reviews in one place so I can respond and improve my products |
Description:
Comprehensive audit trail tracking all CRUD operations, permission checks, login events, and API calls with IP and user agent capture.
Functionalities:
AuditLogmodel:action,entityType,entityId,userId,storeId,changes,ipAddress,userAgent- Log actions:
CREATE,READ,UPDATE,DELETE,PERMISSION_CHECK,PERMISSION_DENIED,LOGIN,LOGOUT,RATE_LIMIT_HIT - Entity types:
Permission,User,Organization,Store,Product,Order,Customer,Category,Brand,Inventory,RateLimit - IP address from
x-forwarded-forheader - Changes diffing (old/new values)
- Rate limiting (in-memory): configurable per endpoint
- Platform activity log (
PlatformActivity): actor, target, store, description RateLimitmodel: database-backed rate limiting
Key Files:
src/lib/audit-logger.ts— audit logging utilitiessrc/lib/rate-limit.ts— rate limitingsrc/lib/encryption.ts— AES-256-CBC credentials
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-260 | Super Admin | As a super admin, I want to see a complete audit trail of all system actions so I can investigate incidents |
| US-261 | System | As the platform, I want to log every permission denial so I can detect unauthorized access attempts |
| US-262 | System | As the platform, I want to rate limit sensitive endpoints so brute force attacks are prevented |
| US-263 | Security | As a security reviewer, I want all payment credentials to be encrypted at rest |
Description:
A dedicated administration panel for the platform operator to manage all users, stores, organizations, subscriptions, and platform settings.
Sections:
| Admin Page | Functionality |
|---|---|
| Dashboard | Platform stats, pending approvals, recent activity |
| Users | Approve/reject/suspend users, view all registrations |
| Stores | View all stores, manage store subscriptions |
| Organizations | View and manage all organizations |
| Store Requests | Review and approve store creation requests |
| Subscriptions | Manage plans, override features, view MRR |
| Analytics | Platform-wide usage analytics |
| Activity Feed | Platform activity log |
| Settings | Platform configuration |
| Notifications | Send platform-wide broadcasts |
| Roles | Manage and approve custom role requests |
| Setup Payment | Configure platform payment for subscription fees |
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-270 | Super Admin | As a super admin, I want a dashboard showing pending approvals and recent activity at a glance |
| US-271 | Super Admin | As a super admin, I want to view all organizations and drill into any store |
| US-272 | Super Admin | As a super admin, I want to manage subscription plans so I can define pricing tiers |
| US-273 | Super Admin | As a super admin, I want to send platform notifications to all merchants |
Description:
A guided onboarding experience for newly approved merchants, walking them through organization and store setup.
Functionalities:
- Welcome screen after first login
- Organization creation step
- Store setup wizard
- Team invitation
- (Currently placeholder — implementation planned)
Key Files:
src/app/onboarding/page.tsx— onboarding entry
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-280 | New Merchant | As a newly approved merchant, I want a guided onboarding so I can set up my store without confusion |
| US-281 | New Merchant | As a new merchant, I want to create my organization and store during onboarding so I'm ready to sell |
Description:
Email sending infrastructure using Resend for transactional emails: magic links, account notifications, and custom store communications.
Functionalities:
- Magic link emails for authentication
- Account approval/rejection emails
- Store status change notifications
- Subscription expiry warnings
- Order confirmation emails
- Custom email templates
- Email service with Resend (lazy-initialized, logs to console in dev)
resend = process.env.RESEND_API_KEY ? new Resend(...) : nullguard
Key Files:
src/lib/email-service.ts— email sending utilitiessrc/lib/auth.ts— magic link email trigger
User Stories:
| ID | Role | User Story |
|---|---|---|
| US-290 | New User | As a new user, I want to receive a magic link email so I can log in securely |
| US-291 | Merchant | As a merchant, I want to receive an email when my account is approved so I know I can start selling |
| US-292 | Customer | As a customer, I want to receive an order confirmation email so I have a record of my purchase |
| Domain | # Stories | Priority |
|---|---|---|
| Authentication | 6 | P0 (Critical) |
| Multi-Tenancy | 3 | P0 (Critical) |
| User Management | 6 | P0 (Critical) |
| Store Management | 5 | P0 (Critical) |
| Product Management | 7 | P0 (Critical) |
| Category Management | 4 | P1 (High) |
| Brand Management | 3 | P2 (Medium) |
| Product Attributes | 2 | P2 (Medium) |
| Inventory Management | 5 | P1 (High) |
| Order Management | 8 | P0 (Critical) |
| Customer Management | 4 | P1 (High) |
| Payment Processing | 5 | P0 (Critical) |
| Discount & Coupons | 6 | P1 (High) |
| Subscription & Billing | 7 | P0 (Critical) |
| Storefront Builder | 7 | P1 (High) |
| Public Storefront | 6 | P0 (Critical) |
| Checkout Flow | 6 | P0 (Critical) |
| Order Tracking | 3 | P1 (High) |
| Analytics | 5 | P1 (High) |
| Staff Management | 6 | P1 (High) |
| RBAC Permissions | 3 | P0 (Critical) |
| Facebook Integration | 6 | P1 (High) |
| Pathao Courier | 4 | P1 (High) |
| Webhook System | 4 | P2 (Medium) |
| Notifications | 4 | P1 (High) |
| Reviews | 4 | P2 (Medium) |
| Audit & Security | 4 | P0 (Critical) |
| Super Admin | 4 | P0 (Critical) |
| Onboarding | 2 | P2 (Medium) |
| 3 | P1 (High) |
sequenceDiagram
participant C as Customer
participant SF as Storefront
participant API as /api/orders
participant Pay as Payment Gateway
participant DB as PostgreSQL
participant WH as Webhooks
C->>SF: Add items to cart
SF->>SF: Store cart in localStorage
C->>SF: Proceed to checkout
C->>SF: Enter shipping address
C->>SF: Select payment method
SF->>API: POST /api/orders/create (idempotency key)
API->>DB: Check inventory reservation
API->>DB: Create Order (PENDING)
API->>DB: Reserve inventory
API->>Pay: Initiate payment (bKash/SSLCommerz/Nagad)
Pay-->>C: Redirect to payment page
C->>Pay: Complete payment
Pay->>API: Webhook callback (IPN)
API->>DB: Update Order → PAID
API->>DB: Release inventory reservation
API->>DB: Create PaymentAttempt (COMPLETED)
API->>WH: Fire order.created webhook
API-->>C: Redirect to confirmation page
sequenceDiagram
participant U as User
participant App as Next.js App
participant Auth as NextAuth
participant DB as PostgreSQL
participant Email as Resend
U->>App: POST /api/auth/signin (email)
App->>Auth: signIn("email")
Auth->>DB: Create VerificationToken
Auth->>Email: Send magic link email
Email-->>U: Email with clickable link
U->>App: GET /api/auth/callback?token=...
App->>Auth: Verify token
Auth->>DB: User lookup or create
Auth->>DB: Create Session
Auth-->>U: JWT cookie set
U->>App: Access /dashboard
App->>Auth: getServerSession()
Auth-->>App: { user: { id, email, name } }
App-->>U: Dashboard rendered
stateDiagram-v2
[*] --> TRIAL: New store created
TRIAL --> ACTIVE: Payment received
TRIAL --> EXPIRED: Trial period ends (no payment)
ACTIVE --> GRACE_PERIOD: Payment fails at renewal
ACTIVE --> CANCELLED: User cancels
GRACE_PERIOD --> ACTIVE: Payment resolved
GRACE_PERIOD --> EXPIRED: Grace period ends
CANCELLED --> ACTIVE: User resubscribes
EXPIRED --> ACTIVE: User subscribes
EXPIRED --> [*]: Account deleted
flowchart LR
subgraph Dashboard
FB_UI["Facebook Dashboard\n(6 tabs)"]
OAuth["OAuth Flow"]
end
subgraph Facebook
FB_API["Facebook Graph API"]
FB_Catalog["Product Catalog"]
FB_Shop["Facebook Shop"]
Messenger["Messenger API"]
Pixel["Meta Pixel"]
ConvAPI["Conversions API"]
end
subgraph StormCom_DB
FbInteg["FacebookIntegration"]
FbProducts["FacebookProduct"]
FbOrders["FacebookOrder"]
FbConversations["FacebookConversation"]
ConvEvents["ConversionEvent"]
end
OAuth -->|access_token| FbInteg
FB_UI -->|Sync| FB_Catalog
FB_Catalog -->|Products| FbProducts
FB_Shop -->|Orders| FbOrders
Messenger -->|Messages| FbConversations
Pixel -->|Browser events| ConvAPI
ConvAPI -->|Server events| ConvEvents
graph TD
SA["🔱 SUPER_ADMIN\nAll permissions (wildcard *)"]
PS["🛠 PLATFORM_SUPPORT\nRead all, limited writes"]
OW["👑 OWNER\nFull org control"]
AD["⚙️ ADMIN\nManage org resources"]
ME["👤 MEMBER\nLimited write access"]
VI["👁 VIEWER\nRead only"]
STAD["🏪 STORE_ADMIN\nFull store control"]
SM["💼 SALES_MANAGER\nOrders & customers"]
IM["📦 INVENTORY_MANAGER\nProducts & inventory"]
CS["📞 CUSTOMER_SERVICE\nOrders & reviews"]
CM["✏️ CONTENT_MANAGER\nProducts & categories"]
MM["📢 MARKETING_MANAGER\nCoupons & analytics"]
DB["🚴 DELIVERY_BOY\nOrder status updates"]
CUS["🛍 CUSTOMER\nShop & review"]
SA --> PS
SA --> OW
OW --> AD
AD --> ME
ME --> VI
OW --> STAD
STAD --> SM
STAD --> IM
STAD --> CS
STAD --> CM
STAD --> MM
STAD --> DB
CUS
quadrantChart
title Subscription Plan Features vs. Cost
x-axis Low Cost --> High Cost
y-axis Limited Features --> Full Features
quadrant-1 Enterprise/Custom
quadrant-2 Pro
quadrant-3 Free
quadrant-4 Basic
FREE: [0.1, 0.15]
BASIC: [0.35, 0.4]
PRO: [0.65, 0.7]
ENTERPRISE: [0.85, 0.9]
CUSTOM: [0.95, 0.95]
| Feature | FREE | BASIC | PRO | ENTERPRISE |
|---|---|---|---|---|
| Max Products | 10 | 100+ | Unlimited | Unlimited |
| Max Staff | 1 | 5+ | 20+ | Unlimited |
| Storage | 100 MB | 1 GB | 10 GB | Unlimited |
| Max Orders/month | 50 | 500+ | Unlimited | Unlimited |
| Custom Domain | ✗ | ✗ | ✓ | ✓ |
| API Access | ✗ | ✗ | ✓ | ✓ |
| POS Support | ✗ | ✗ | ✓ | ✓ |
| Accounting | ✗ | ✗ | ✓ | ✓ |
| Group | Routes | Examples |
|---|---|---|
| Auth | /api/auth/** |
NextAuth handler |
| Products | /api/products/** |
CRUD, variants, bulk |
| Orders | /api/orders/** |
Create, update, track |
| Customers | /api/customers/** |
List, detail, analytics |
| Categories | /api/categories/** |
CRUD, hierarchy |
| Brands | /api/brands/** |
CRUD |
| Inventory | /api/inventory/** |
Update, logs, alerts |
| Payments | /api/payments/** |
Config, attempt, webhook |
| Discounts | /api/discounts/** |
Coupons CRUD, validate |
| Subscriptions | /api/subscriptions/** |
Plan, checkout, cancel |
/api/integrations/facebook/** |
OAuth, sync, events | |
| Pathao | /api/integrations/pathao/** |
Auth, create order |
| Webhooks | /api/webhooks/** |
CRUD, retry |
| Analytics | /api/analytics/** |
Dashboard, reports |
| Staff | /api/store/staff/** |
Invite, manage, roles |
| Admin | /api/admin/** |
User approval, stats |
| Storefront | /api/storefront/** |
Config, preview |
| Notifications | /api/notifications/** |
Mark read, list |
| Metric | Count |
|---|---|
| Total Features Documented | 30 |
| Total User Stories | ~150 |
| Database Models | 45+ |
| Database Enums | 20+ |
| API Route Groups | 18 |
| Payment Gateways | 5 |
| External Integrations | 3 (Facebook, Pathao, Resend) |
| RBAC Roles | 13 |
| Storefront Themes | 6 |
| Subscription Plan Tiers | 5 |
| Notification Types | 26 |
Documentation generated from comprehensive review of src/ and prisma/schema.prisma
StormCom — Multi-Tenant SaaS E-Commerce Platform