Commerce · Transactional systems

AndhraFresh

A farmer-first produce platform built around a simple rule: the storefront should only promise what a real farm can actually supply, at a price and fulfillment state the system can explain end to end.

TypeScriptPostgreSQLDomain modellingTransactionsAPIsAdminCI/CD

Why it exists

The transaction should stay connected to the farmer who grew the food.

AndhraFresh comes from my own farming background in Andhra Pradesh. The product started from a repeated mismatch I had seen for years: farmers carry the land, weather, crop and selling risk while price, demand and final-value visibility often sit elsewhere in the chain.

The first goal is deliberately local—not “build the next grocery marketplace.” It is to prove that real nearby farms can expose real supply, buyers can understand source and freshness, and an accepted order can still be traced back to what the farmer supplied and what is owed.

Domain model

One traceable path from farmer to settlement.

01Farmerapproved producer identity
02Farmsource + operating context
03Cropproduct + growing cycle
04Harvestmeasured physical quantity
05Supply lotonline allocation + freshness
06Ordercommitted quantity
07Settlementfarmer economics

Catalogue knowledge and sellable supply are intentionally different. A product can exist in the catalogue while no farm has eligible supply today.

Implemented / accepted evidence

The difficult part is keeping business truth consistent under change.

Supply authority

One physical truth

Catalogue entries do not imply stock. Sellability is derived from real farmer, farm, crop, harvest, supply, allocation and freshness facts.

Concurrency

Transactional

Harvest capacity and lot commitment are rechecked under ordered locks so competing buyers or operators cannot oversell the same physical produce.

Business rules

Deterministic core

PostgreSQL stores persistent facts while shared core policy owns sellability, pricing, transition and settlement decisions.

Application boundary

API authority

Storefront and admin submit intent; the API resolves authoritative facts, invokes policy, locks mutable rows and persists accepted transitions.

Farmer economics

Beyond checkout

Existing foundations continue the transaction through fulfillment, settlement batches and payout planning rather than ending at customer order creation.

Safety

Fail-closed

Public order acceptance remains unavailable until customer identity, ownership and replay/idempotency boundaries are independently accepted.

Concurrency

Two screens should never be able to sell the same mango twice.

HARVESTusable quantity
≥
ALL LOTSΣ online allocation
≥
ACCEPTED ORDERSΣ committed quantity

The accepted commerce path serializes aggregate harvest-capacity writers before stable lot locks, re-reads mutable facts inside the transaction and invokes deterministic core policy before persisting commitment.

Status labels do not magically release physical capacity. Partial order commitment preserves the remaining sellable quantity; exhaustion derives sold-out state from the underlying numbers.

competing sibling-lot allocation increasesallocation reduction racing accepted commitmenttwo buyers competing for final quantitysame quote accepted twicemulti-harvest lock orderingrollback under contention

Authority model

Database facts, business policy and application orchestration have different jobs.

POSTGRESQLPersistent business factsfarm · harvest · supply · price · order · settlement · audit
PACKAGES / COREDeterministic business policysellability · pricing · transitions · allocation · settlement
APITrust + orchestration + transactionsauth · validation · fact loading · locks · persistence
STOREFRONT / ADMINPresentation + user intentno competing inventory or pricing truth in the browser

Current product lane

Turn a real farm into sellable supply without developer intervention.

The next operator slice is intentionally practical: atomically onboard a farmer and initial farm, create a crop cycle from an existing active product, record a real harvest, create a zero-allocation draft supply lot, then use the already accepted allocation controls to open it for sale.

That work is still draft and must be revalidated against current main before integration. It is shown here as current direction—not as completed capability.

What I owned

Turning a real-world business problem into explicit system truth.

  • Farmer-first product direction
  • Business/domain authority boundaries
  • Supply, allocation and order invariants
  • Operator/customer journey prioritization
  • Acceptance and failure-state decisions
  • Architecture/recovery decisions across historical rewrites

Why this matters professionally

AndhraFresh is where the work maps most directly to conventional business software engineering: transactional state, concurrency, source-of-truth boundaries, operator workflows, pricing, audit and recovery. AI tools help implement and review the system, but the hard decisions are domain decisions.

Honest boundary

Deep foundations do not mean the marketplace is production-ready.

The repository already contains substantial farmer, supply, pricing, order, payment-state, notification, fulfillment, settlement and payout foundations. AF-COM-01 has accepted the core sellable-supply and commitment model.

Public order creation still deliberately returns an unavailable response until customer identity, ownership and idempotency/replay trust are accepted. Real payment providers, public rollout and the first live farm-to-buyer pilot remain later gates.

Selected work

Four systems, four different kinds of engineering proof.

Back to all work