
Bringing a Fabric Wholesaler Online, End to End
Mithila Enterprises supplies heavyweight winter wools and breathable summer linens to domestic designers, and sells trade yardage to registered businesses (per mithilaenterprises.co.in).
It needed one owned system for retail orders, wholesale applications and stock: meter-level inventory that cannot oversell when two buyers check out the same variant, minimum order quantities enforced by the database itself, verified online payments, and GST tax invoices, all run by staff from an admin panel.
Panarch Digital built a server-rendered Next.js 16 platform on Supabase (Postgres 17 with row-level security), deployed on Vercel, with 38 versioned SQL migrations defining the schema, policies and transactional RPCs.
Inventory integrity lives in the database: create_order_atomic is a SECURITY DEFINER function that takes FOR UPDATE locks on each variant row when the order is created and raises an exception below a variant's minimum order quantity, and a cancel_expired_pending_orders function cancels unpaid pending orders older than 1 hour.
Razorpay payment signatures and webhooks are verified with HMAC-SHA256, with idempotent payment handling. Tax-invoice PDFs render on request with @react-pdf/renderer from a per-product GST rate. The wholesale page publishes the trade terms and captures applications (business name, GST or tax ID, volume) for review.
Staff run the store from 9 admin modules: Dashboard, Orders (with item-level partial cancellation and optional restock), Products, Categories, Live Inventory, Promotions, Customers, Content and Settings, plus Collections.
Around them: Gemini 2.5 Flash cataloguing from fabric photos, Shiprocket courier rates, WhatsApp Cloud API notifications, Resend email through a database-backed queue drained by a Vercel cron, Upstash rate limiting and Sentry.
- Next.js 16 (App Router)
- Supabase Postgres 17 + RLS
- SECURITY DEFINER RPCs
- Razorpay (HMAC-Verified)
- Gemini AI Cataloguing
- Playwright + Vitest Test Suites
- Vercel
Wholesale Modernisation & Atomic Stock Locks
A winter-wool and summer-linen wholesale house moved onto a server-rendered D2C and B2B platform: stock is locked inside Postgres when an order is created, and the owner team runs catalogue, orders and content from its own admin.
FOR UPDATE
create_order_atomic is a SECURITY DEFINER RPC that row-locks each variant at order creation; a companion function cancels and restocks unpaid orders older than 1 hour.
DB-enforced MOQ
Wholesale applications with GST / tax ID capture, minimum order quantities enforced inside the order RPC, and custom dye-run enquiries.
9 modules
Dashboard, Orders (partial cancellation with optional restock), Products, Categories, Live Inventory, Promotions, Customers, Content and Settings, plus a Collections editor.
HMAC-SHA256
Razorpay signatures and webhooks verified server-side, idempotent payment handling, and tax-invoice PDFs rendered on request with @react-pdf/renderer.
Editorial Storefront, Fabric Catalogue & Wholesale Channel
Real screens from the live production system: the editorial storefront, the fabric catalogue, the wholesale application channel and seasonal merchandising. The owner admin (orders, inventory, promotions, customers, content) sits behind staff login.
Mithila Enterprises runs retail and trade orders on a codebase it owns outright. Overselling is prevented in the database rather than in application code: FOR UPDATE row locks plus a stock constraint. Integration tests cover the order RPC and the RLS policies, and Playwright specs cover the checkout journeys.
- Versioned Postgres Migrations
- 38
- Owner Admin Modules
- 9
- HMAC-Verified Razorpay Webhooks
- SHA-256
See where your storefront loses its first second.
A 30-minute consult with Arpan Tyagi, founder and principal engineer, on where your current stack spends its load time and what we would change first.
Client platforms shipped for Fabriclicious, Mithila Enterprises and Kiran Singh Foundation.