← All case studies
Food & Beverage WholesaleFull-Stack SaaS + Integrations
143+ SKUs · Zero manual invoices

B2B Wholesale E-commerce Platform with Automated Accounting

Problem

A food and beverage distributor processed wholesale orders manually through phone and email. Tiered pricing (retail, wholesale, distributor), minimum order quantities, case-pack logic, and net payment terms were managed in spreadsheets. Every order required manual invoice creation in QuickBooks, and inventory overselling happened during concurrent checkouts.

Approach

Built a full-stack B2B wholesale platform on Next.js 15 with Supabase. Implemented a tiered pricing engine with volume discounts and case-pack enforcement, an atomic checkout system using PostgreSQL advisory locks to prevent overselling, and a bulk order grid supporting 500+ SKUs with CSV import. Integrated QuickBooks Online via OAuth 2.0 for automatic invoice sync, Stripe for card/ACH/net-term payments, and Algolia for product search. Deployed Trigger.dev background jobs for invoice sync with exponential backoff, nightly inventory reconciliation, payment reminders at 14/7/0/+7 day intervals, and weekly churn risk prediction.

Result

The platform eliminated manual invoice creation entirely, every order auto-syncs to QuickBooks. Atomic checkout with inventory reservations prevents overselling during concurrent orders. Background jobs handle payment reminders and churn prediction without manual intervention. The admin dashboard provides real-time visibility into orders, inventory, and customer health.

  • Zero manual invoices, every order auto-syncs to QuickBooks Online with retry logic
  • Atomic checkout via PostgreSQL advisory locks eliminates overselling during concurrent orders
  • Background jobs run nightly inventory reconciliation, payment reminders, and churn prediction
  • Bulk order grid supports 500+ SKUs with CSV import and tier-aware pack pricing
143+
Products
55
DB migrations
382
Tests passing
5 types
Background jobs
Next.jsSupabaseStripeQuickBooksB2B E-commerceTrigger.dev