🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/
🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/🎉 Mega B2B Monsoon Sale! Flat 12% OFF on Bulk orders above ₹20,000. Use Code: MEGAMONSOON/⚡ Express Freight Dispatch: All Surat Warehouse orders dispatched within 24 Hours!/
Flexsell Logo
All Categories
Wholesale Bulk Catalog Dropshipping Hub
Industry Technical Guide & System Blueprint

FlexSell Wholesale Application Documentation

Complete technical documentation covering full-stack architecture, 17 Mongoose schemas, GST tax engine, Razorpay HMAC verification, and B2B document lifecycles.

01. Product Overview & Personas
Navigation Directory
System Blueprint

01. Product Overview & Persona Segments

FlexSell Wholesale is an enterprise-grade B2B, B2C, and Dropshipping e-commerce platform engineered specifically for manufacturers, importers, wholesale distributors, and resellers. It features multi-tier pricing, GST tax compliance, automated Shiprocket dispatch, Razorpay payment verification, and B2B document generation.

B2B WholesaleQuote Page

Bulk Sourcing & Quotes

Tiered bulk prices, per-variant MOQs, formal quotation conversion, and GST-compliant tax invoices containing business GSTINs.

B2C CommerceCatalog

Direct Consumer Retail

Single-unit retail purchases, instant UPI/Razorpay payments, automated shipping calculation, and live tracking.

DropshippingResellers

Reseller Fulfillment

Resellers place direct-to-customer orders with customized packing slips omitting wholesale cost information.

Layered Design

02. Layered Application Architecture

High-Level Flow Diagram

Storefront UI (React 19)
Zustand Stores / Services
Next.js API (/api/*)
MongoDB Atlas

Key Architecture Principles

  • Unified Client Services: All UI components invoke services in src/services/ that support an offline localStorage sandbox when isMockMode = true and Next.js REST API routing when live.
  • Atomic Inventory Deductions: Product sub-variant stock is atomically decremented during order creation using MongoDB $inc and array filters.
  • Stateless JWT & CSRF: Sessions are maintained via httpOnly cookies validated through authGuard.ts alongside double-submit CSRF token headers.
Frameworks & Libraries

03. Technology Stack Inventory

CategoryTechnologyVersionPurpose
FrameworkNext.js (App Router)16.2.10Full-stack React framework with server components & route handlers
UI EngineReact / React DOM19.2.4Component rendering & concurrent mode hooks
DatabaseMongoDB / Mongoose9.7.4Document storage, schema validation & indexing
State ManagementZustand5.0.14Scoped client stores with localStorage persistence
PaymentsRazorpay SDK2.9.8Online order creation & HMAC signature verification
Route Directory

04. Application Routes Specification

/

Storefront homepage featuring CMS banners, categories, trending products & new arrivals.

/products

Catalog listing with category filters, price sorting, tag search & pagination.

/quote

B2B bulk quotation request form for negotiated wholesale orders.

/checkout

Multi-step checkout with coupon validation, GST calculation & Razorpay payment.

Data Models

05. Database Schema & Mongoose Models (17 Models)

Customer Model (customers)

Stores B2C, B2B, and Dropshipping buyer accounts, bcrypt hashed passwords, address book, GSTINs, and failedLoginAttempts for account lockout.

Product Model (products)

Maintains catalog products, color variants, subvariant matrices (Size × Weight × Price Tiers), HSN codes, and barcode scanner numbers.

Order Model (orders)

Stores purchase orders, line item snapshots, shipping addresses, payment status (Pending, Paid), and order status transitions.

Invoice Model (invoices)

Manages B2B documents: Quotes (QUO-xxxx), Receipts (RCP-xxxx), and Tax Invoices (INV-xxxx) with GST breakdowns.

Security & Access

06. Authentication, Lockout & CSRF Rules

Account Lockout Protocol

10 Failed Password Attempts
Account Locked for 15 Minutes
Catalog Engine

07. Product Catalog & Multi-Tier Pricing Architecture

Supports multi-dimensional variant configurations (Color × Size × Weight) paired with a 3-tier price resolution matrix designed for Indian wholesale, retail, and dropshipping commerce.

Variant Matrix Architecture

Product (Root)

Title, slug, categoryId, hsnCode, gstRate, priceIncludesGst

Color Variant

Color name, images array, subVariants list

SubVariant Matrix

Size, Weight, MRP, B2C Price, B2B Price, Dropship Price, Stock, SKU, Barcode

B2C Retail Price

Standard single-unit retail price applied to guest visitors and standard consumer accounts.

B2B Wholesale Price

Discounted bulk rate unlocked when minimum order quantity (MOQ) is met by B2B buyers.

Dropshipping Price

Wholesale reseller rate applied when dropshipping items directly to end customers.

Stock Control

08. Atomic Inventory Management & Audit Ledger

Atomic Stock Decrement Query

Product.updateOne(
  { _id: productId, "colorVariants.subVariants": { $elemMatch: { sku, stock: { $gte: qty } } } },
  { $inc: { "colorVariants.$[cv].subVariants.$[sv].stock": -qty, totalStock: -qty } },
  { arrayFilters: [{ "cv.color": color }, { "sv.sku": sku }] }
)
Compliance Engine

09. Indian GST Tax Engine Specifications

Intrastate (Same State)

Buyer State == Seller State (e.g. MP == MP)

CGST = Total GST / 2
SGST = Total GST / 2
Interstate (Different State)

Buyer State != Seller State (e.g. MH != MP)

IGST = Total GST
CGST = 0, SGST = 0
State Transitions

10. Order Fulfillment State Machine

PlacedPendingConfirmedShippedDelivered
B2B Financial Workflow

11. Quote âž” Receipt âž” Invoice Lifecycle

1. Quote (QUO-xxxx)

Draft negotiable quotation for bulk wholesale orders. Fully editable before acceptance.

2. Receipt (RCP-xxxx)

Payment pending receipt voucher issued upon order submission before online payment verification.

3. Invoice (INV-xxxx)

Immutable legal tax invoice generated automatically once payment verification succeeds.

Payment Security

12. Razorpay HMAC Signature Verification

Online Razorpay payments must pass server-side HMAC-SHA256 signature verification in /api/razorpay/verify before an order status is set to Paid:

expectedSignature = crypto.createHmac("sha256", RAZORPAY_KEY_SECRET)
  .update("order_id|payment_id")
  .digest("hex")
Logistics Integration

13. Shiprocket Fulfillment & Webhooks

Integrated directly with Shiprocket REST APIs for live courier serviceability, automated order fulfillment, shipping label generation, and real-time AWB tracking webhooks.

API Directory

14. Admin Modules & REST API Directory

/api/health (System Health Check)
/api/auth (Register, Login, Refresh)
/api/products (Catalog & Import)
/api/orders (Submission & Status)
Defense in Depth

15. Security Control Matrix & Cryptography

Content Security Policy (CSP)

HTTP headers restricting script execution to self, Razorpay, and Google.

CSRF Protection

Double-submit cookie pattern with X-CSRF-Token validation.

Sliding Window Rate Limiting

Upstash Redis sliding window limiter preventing brute-force API attacks.

AES-256-GCM Encryption

Encrypted storage for sensitive API credentials in database settings.

Flexsell Logo

FlexSell Wholesale is India's leading B2B sourcing and white-label dropshipping platform. We import directly from manufacturers to deliver factory prices to retailers, shop owners, and e-commerce sellers.

Verified Factory Importer Nationwide Cargo Freight Dispatch Direct Transit Damage Replacement

Wholesale Sourcing

  • Wholesale Bulk Catalog
  • Factory Direct Categories
  • Get Bulk Sourcing Quote
  • App Documentation
  • About FlexSell B2B
  • Warehouse Sourcing Contact
  • System Diagnostics

Dropshipping Hub

  • Dropshipping Program
  • Apply as Partner
  • Create Dropshipper Account
  • Dropshipping FAQ
  • Partner Help Desk

Contact & Newsletter

  • Plot No.3, 2nd Floor, BDA Colony, Kohefiza Main Road Bhopal - 462001
  • Email: info@flexsellwholesale.com
  • Phone: +91 9203675004
  • Timing: 9:30 AM to 6:30 PM (Sunday Closed)

© 2026 FlexSell Wholesale B2B Market. All rights reserved.

UPIRazorpayGST InvoiceCargo Transport