<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Julliette Hind</title>
    <description>The latest articles on DEV Community by Julliette Hind (@zellq).</description>
    <link>https://dev.to/zellq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3864961%2F1261d47d-66da-4b28-8878-067760f6df5c.png</url>
      <title>DEV Community: Julliette Hind</title>
      <link>https://dev.to/zellq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zellq"/>
    <language>en</language>
    <item>
      <title>How I Built a Multi-Tenant B2B Wholesale Platform with Next.js 14 and Supabase</title>
      <dc:creator>Julliette Hind</dc:creator>
      <pubDate>Tue, 07 Apr 2026 05:31:49 +0000</pubDate>
      <link>https://dev.to/zellq/how-i-built-a-multi-tenant-b2b-wholesale-platform-with-nextjs-14-and-supabase-d90</link>
      <guid>https://dev.to/zellq/how-i-built-a-multi-tenant-b2b-wholesale-platform-with-nextjs-14-and-supabase-d90</guid>
      <description>&lt;p&gt;I spent the last few months building a complete B2B wholesale operating system from scratch. Here's a deep dive into the architecture and challenges I solved.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Most small wholesale suppliers still manage orders over WhatsApp, email, and spreadsheets. There's no affordable tool built specifically for them. I set out to build one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Next.js 14&lt;/strong&gt; (App Router)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supabase&lt;/strong&gt; (PostgreSQL + Row Level Security + Auth)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stripe Connect&lt;/strong&gt; (buyers pay merchants directly)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tailwind CSS&lt;/strong&gt; + Framer Motion&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resend&lt;/strong&gt; (transactional emails)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vercel&lt;/strong&gt; (deployment)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Architecture Decisions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Multi-Tenancy with Row Level Security
&lt;/h3&gt;

&lt;p&gt;Each merchant gets their own store. Instead of separate databases, I used Supabase RLS to isolate data at the row level. This means every query is automatically scoped to the user's store — no middleware needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Stripe Connect for Marketplace Payments
&lt;/h3&gt;

&lt;p&gt;Buyers pay merchants directly through Stripe Connect. The platform takes a 2% fee per transaction. Each merchant onboards through Stripe's hosted flow — no API keys needed from their side.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Pricing Engine
&lt;/h3&gt;

&lt;p&gt;B2B pricing is complex. I built a pricing engine that handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MOQ (Minimum Order Quantity)&lt;/strong&gt; — products can require a minimum purchase&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tier pricing&lt;/strong&gt; — buy 10+ for $8, buy 100+ for $6&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trade codes&lt;/strong&gt; — VIP customers get custom discounts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-customer price lists&lt;/strong&gt; — override pricing for specific buyers&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Webhook System
&lt;/h3&gt;

&lt;p&gt;For ERP/CRM integrations, I built a webhook system with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HMAC-SHA256 signed payloads&lt;/li&gt;
&lt;li&gt;Automatic retry (3 attempts with backoff)&lt;/li&gt;
&lt;li&gt;Delivery logs with status tracking&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Role-Based Team Access
&lt;/h3&gt;

&lt;p&gt;Not every team member needs full admin access:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Owner&lt;/strong&gt; — full control&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manager&lt;/strong&gt; — orders + products&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fulfillment&lt;/strong&gt; — shipping only&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read-only&lt;/strong&gt; — view dashboard&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Supabase RLS is powerful but tricky&lt;/strong&gt; — one wrong policy and you either leak data or block everything&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stripe Connect onboarding has edge cases&lt;/strong&gt; — handle account deauthorization gracefully&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;B2B UX is different from B2C&lt;/strong&gt; — buyers want efficiency (list view, CSV upload, quick reorder), not pretty product galleries&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;The platform includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Buyer-facing storefront with cart, search, categories&lt;/li&gt;
&lt;li&gt;Full admin dashboard (products, orders, quotes, buyers, team, billing)&lt;/li&gt;
&lt;li&gt;Stripe payments + bank wire option&lt;/li&gt;
&lt;li&gt;REST API + webhooks&lt;/li&gt;
&lt;li&gt;Custom domain support&lt;/li&gt;
&lt;li&gt;Email notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I packaged the entire codebase as a starter kit for developers who want to build similar B2B platforms: &lt;a href="https://zellq.gumroad.com/l/b2b-wholesale-os" rel="noopener noreferrer"&gt;B2B Wholesale OS on Gumroad&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy to answer any questions about the architecture!&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>supabase</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
