Marketplace · United States and Canada

Building the backend for a two-country B2B marketplace, from first seller to thousands of monthly orders

A Django marketplace where roasters buy in-stock green coffee from verified suppliers: multi-role accounts, a 7-state order workflow, warehouse-aware shipping and Stripe Connect payouts under separate US and Canadian configurations.

Client
B2B green coffee marketplace
Engagement
Ongoing partnership
Period
2022 to present
  • 100+verified sellers onboarded
  • 1,000sof orders handled monthly
  • 3+ yrsin production on the same core
The product

What it is

A spot marketplace for green coffee. Roasters, cafés and restaurants describe what they need, from origin and cup score to bag count and delivery state, and get matched with in-stock lots from verified importers and farmers across the US and Canada. No imports to arrange, no waiting; the coffee is already in a warehouse and ready to ship. Suppliers list lots, manage inventory and get paid through the platform.

Where we came in

The founders had a clear thesis and a market that still ran on emails and spreadsheets. They needed a backend that could take a first version to market quickly, but B2B coffee trade isn't a simple cart: the same company can buy and sell, one cart can draw from several warehouses, shipping rules differ by region and weight, and sellers in two countries have to be paid under different Stripe accounts and tax regimes. We led backend development from the MVP onward and have stayed on as the platform's engineering partner.

What we owned

  • Backend architecture and the Django REST API, from MVP to current production
  • Accounts, product lifecycle, cart, checkout, orders, shipping and earnings modules
  • Stripe Connect integration for both countries, including webhooks and payouts
  • Background jobs, scheduling, monitoring and crash alerting
  • Fixtures and reference data: countries, regions, certifications, coffee grades, shipping services
Architecture

How the system is layered, from the people using it down to the data and the services it depends on.

  1. 01Clients
    • Buyer web app
    • Seller dashboard
    • Admin
  2. 02API
    • Django REST Framework
    • Multi-role auth (buyer and seller under one profile)
    • Serializer-enforced state transitions
  3. 03Domain modules
    • Products and lots
    • Cart validation
    • Order workflow engine
    • Shipping engine
    • Earnings ledger
    • Refunds
  4. 04Async
    • Celery
    • DB-tracked task dispatcher with retries
    • Crash alerting
  5. 05Data and payments
    • PostgreSQL
    • Stripe Connect (US)
    • Stripe Connect (Canada)
    • Media storage
Engineering decisions

The choices that made the difference, and why we made them.

  1. 01

    A 7-state order workflow with transitions the API can't violate

    Orders move through seven states from placed to fulfilled, refunded or cancelled. Allowed transitions are enforced in the serializers, so a client can't skip a state or reverse one by sending the wrong payload. When a single cart spans several warehouses, the order is split atomically into per-warehouse orders and earnings so each seller sees exactly their part.

  2. 02

    One codebase, two countries of payouts

    US and Canadian sellers are paid through independent Stripe Connect configurations with their own webhook endpoints. An earnings ledger records every sale, clears the marketplace commission automatically and lets sellers trigger their own payouts, with the country-specific account resolved from the seller's profile rather than scattered through the code.

  3. 03

    Shipping and cart rules that match how coffee actually moves

    A dynamic shipping engine uses warehouse templates, weight tiers and region-based rules so grouped orders are priced correctly. Cart validation re-checks prices and stock at every step and adjusts inventory in real time, which stopped the oversold-lot problem before launch.

  4. 04

    Operations tooling instead of a monitoring subscription

    A DB-tracked scheduled task dispatcher sits over Celery, adding retries and status visibility that plain task scheduling lacks. A self-authored crash-alerting system emails admins full error reports on unhandled exceptions. For an early-stage marketplace it was the right trade: full visibility, no extra vendor.

Outcome
  • More than 100 verified sellers onboarded and thousands of orders processed each month.
  • Order splitting, payouts and shipping behave identically in both countries without duplicated code paths.
  • The platform has run in production for over three years on the same core architecture, with the AI-powered matching front end layered on top of it.

Technology

  • Python
  • Django
  • Django REST Framework
  • PostgreSQL
  • Celery
  • Stripe Connect
  • AWS

Building something similar?

Tell us what you're building. You'll get a straight answer on scope, timeline and cost, usually within one business day.