State machines
Every lifecycle in the marketplace, and the rules that move it
Each entity owns a machine that decides which transitions are legal. The diagrams on these pages are generated from that code, so they cannot drift from it.
Two shapes exist. Orders, payments, fulfillment and disputes are one XState machine with concurrent regions that advance together. Everything else — listings, offers, payouts, messages, wallet — is a lighter rule table. The interactive simulator at /statecharts/<machine> runs both.
Inventory
Listings — draft → available → reserved → sold, and who may move it. Offers — a buyer's negotiation, and how it expires.
Transactions
Orders — the parallel machine at the centre of everything. Checkout sessions — the steps before an order exists. Fulfillment — labels, handoff and delivery. Disputes — a region of the order machine, not a machine of its own. Payouts — how a seller's money reaches their bank. Wallet — the two balance buckets, and why they are not a lifecycle.
Communication
Messages — delivery states in chat.
Users
Onboarding — the setup-progress label. Seller eligibility — what actually gates buying, listing and withdrawing.
Automations
WhatsApp bot — listing from a chat thread.