Case study 01 / 19
MeatLink B2B Meat Commerce Platform
Live B2B meat sourcing and commerce platform for Indonesian food businesses, with role-based data security, Midtrans payments, and an OAuth-protected MCP server that AI agents can use safely.
- Stack
- TypeScript · React 19 · TanStack Start · Cloudflare Workers · Supabase Postgres · Row-Level Security · Midtrans · MCP · OAuth 2.1 · Codex
The problem
Restaurants, hotels, caterers, and butcher shops in Indonesia often buy meat through scattered WhatsApp chats and supplier price lists, with little visibility into stock, grades, or fair per-kilogram prices. Suppliers lack a simple channel to reach business buyers, and beef-market intelligence is spread across FAOSTAT, USDA, and Indonesian government sources.
What I built
Built meatlink.id with a partner as a full B2B commerce platform: catalog and search with transparent per-kilogram pricing, multi-item RFQs with reference tracking, cart and checkout with Midtrans payments, orders and invoices, and admin and vendor consoles for inventory, AI-assisted spreadsheet import, payment reconciliation, and reporting. It runs TanStack Start on Cloudflare Workers with Supabase Postgres and exposes an OAuth 2.1-protected MCP server, so AI agents can check stock, place and look up orders, and draft market insights. A separate analytical engine runs a Codex research agent that turns public market data into bilingual EN/ID insight drafts without ever holding database credentials.
Architecture
One TanStack Start app on Cloudflare Workers serves buyers, vendors and operations. Supabase Row-Level Security guards every role, and AI agents reach the business only through the OAuth-protected MCP endpoint, where server-side gates and human review decide what gets published.
Open the image for full size
Proof
- 01 Row-Level Security policies per role (anonymous, buyer organization, vendor organization, platform admin), checked against a written RLS test matrix after every policy change.
- 02 Hardened payment lifecycle: Midtrans webhook handling, 24-hour payment expiry aligned with order cancellation, a scheduled sync every 30 minutes, and an admin-only daily reconciliation that flags mismatches instead of force-settling orders.
- 03 MCP endpoint at meatlink.id/mcp with tools for stock, orders, market data, and insight drafts; server-side gates enforce evidence freshness, block internal marketplace data, and require complete English and Indonesian text.
- 04 AI writes are draft-only: every agent-generated insight is reviewed, edited, and published by a human from the admin console.
- 05 Built with an AI-native workflow (Lovable, Codex) while owning the architecture, data model, security policies, integrations, Vitest test suites, k6 load-test scenarios, and operational runbook.
Result
MeatLink is live at meatlink.id with a self-serve catalog, RFQ, and checkout flow plus WhatsApp handoff for sales follow-up. It also demonstrates an agent-ready architecture: AI agents get authenticated, useful access to the business through MCP, while data privacy, evidence quality, and publishing stay under explicit server-side and human control.