# Building a Farmers-Market Marketplace That Handles Real Inventory

## The Problem

A farmers-market marketplace looks simple from the outside: list vendors, show products, accept orders, and route pickup details. In practice, the hardest part is freshness. Inventory changes during harvest, weather affects supply, and vendors often sell across multiple channels before they update a dashboard.

## Inventory Design

The marketplace should treat inventory as per-market and per-pickup-window, not as a single global product count. A vendor may have 40 bunches of kale for Saturday morning, 12 reserved for CSA boxes, and another 20 available for walk-up sales. Modeling those separately prevents overselling and makes substitutions easier to reason about.

```yaml
inventory_policy:
  reserve_on_checkout: true
  reservation_ttl_minutes: 10
  allow_vendor_substitutions: true
  pickup_windows:
    - market_id: downtown-saturday
      cutoff_hours_before_open: 18
```

## Checkout Flow

Checkout should reserve inventory before payment authorization, then release it automatically if the buyer abandons the session. This is especially important during peak ordering windows, when a small farm might have only a few units of a seasonal item. The system also needs clear failure states: if strawberries sell out mid-checkout, the buyer should see that immediately rather than receiving a cancellation email later.

## Vendor Operations

For vendors, speed matters more than dense feature sets. A mobile-first dashboard with bulk quantity edits, low-stock alerts, and printable pickup sheets will usually outperform a complex catalog manager. The best workflows mirror how vendors already work at the stall: quick counts, simple labels, and fast reconciliation after pickup.

## Lessons Learned

The technical challenge is less about building another e-commerce app and more about respecting perishable, local supply. A good farmers-market marketplace needs strong inventory reservations, vendor-friendly tools, and market-aware fulfillment rules. When those pieces are designed carefully, the platform can support online convenience without breaking the trust that makes local markets work.