# Building a Farmers-Market Marketplace That Handles Real-World Inventory

Local food marketplaces look simple from the outside: list tomatoes, accept payment, schedule pickup. In practice, farmers-market inventory is highly perishable, seasonal, and often updated from a phone in a field or behind a stall. A realistic platform needs to treat inventory as a fast-moving operational signal, not just a catalog table.

## Domain Model

The core model should separate products from harvest lots. A farm may sell `heirloom_tomatoes` every summer, but each harvest lot has its own quantity, pickup window, price, and quality notes. This makes it possible to show shoppers what is actually available this weekend while preserving historical sales data for planning and reporting.

```yaml
inventory_policy:
  reserve_timeout_minutes: 12
  allow_partial_fulfillment: true
  pickup_windows:
    - saturday_market
    - sunday_farmstand
```

## Ordering Flow

The checkout flow should reserve inventory before payment authorization, then confirm the reservation only after payment succeeds. If payment fails or the shopper abandons checkout, the reservation expires automatically. This avoids overselling popular items like eggs, berries, and fresh bread during peak market hours.

## Fulfillment

Fulfillment should be organized around pickup windows rather than shipping labels. Vendors need printable pack lists, stall-level order summaries, and simple controls for substitutions when harvest conditions change. Customers need clear pickup instructions, cutoff times, and notifications if an item is replaced or refunded.

## Operational Concerns

The hardest technical problems are usually around consistency and trust. Vendors need offline-tolerant tools because market connectivity is unreliable, while customers need accurate availability and transparent pricing. Event logs, idempotent order updates, and clear inventory audit trails help resolve disputes without relying on guesswork.

## Takeaway

A farmers-market marketplace is less like a generic ecommerce storefront and more like a coordination system for fresh, local supply. The best architecture starts with the constraints of growers, market managers, and shoppers, then builds inventory, payments, and fulfillment around the rhythm of the market day.