The project
Mercado is the marketplace inside Ekonavi, a G20 TechSprint 2024-winning Brazilian network that verifies and funds ecological regeneration. It is one part of a wider ecosystem; the introduction explains the rest. I worked on two of its parts: the commerce API that runs cart, checkout and payments, and the seller dashboard that vendors use to run their stores.

The challenge
A marketplace needs three things to work at once: buyers must be able to pay with the methods they use (in Brazil, PIX above all), payment state must be reliable even though PIX is asynchronous, and sellers must be able to manage orders, stock and customers without asking the platform for help.
The commerce API
The commerce API is a Hono microservice on Cloudflare Workers, separate from the frontends. It owns:
- Cart and checkout, with prices computed server-side.
- Payments via Mercado Pago, including PIX and crypto, with webhook handling for asynchronous confirmation.
- The order lifecycle, from pending through paid to fulfilment.
- Shipping.
Endpoints are documented with OpenAPI and inputs validated with Zod. Keeping commerce in its own service meant payment logic could be tested, reviewed and deployed independently of the storefront and dashboards, and gave every client one source of truth for order state.
The seller dashboard
The seller dashboard is a Next.js application backed by Hasura GraphQL, using Redux Toolkit for client state and TanStack Query for server state. Sellers can:
- manage orders, products and inventory;
- control the display order of products on their storefront;
- respond to customer reviews;
- handle support tickets;
- see live store statistics for orders, customers and revenue.
Data access is scoped per seller by Hasura’s role-based permissions, so isolation between stores is enforced in the data layer rather than only in the UI.
Engineering decisions
- Async payments are server-confirmed. A PIX payment completes in the buyer’s banking app, not in the browser. The order changes state only after the API processes the payment notification.
- Separate service for commerce. The commerce API doesn’t share a deployment with any frontend, which limits the blast radius of changes on either side.
- Server state vs client state. TanStack Query owns everything that lives in the database; Redux Toolkit is kept for UI and session state.
Related
The general pattern behind the payment handling is written up in Verifying payment webhooks on Cloudflare Workers. The wider platform is covered in Ekonavi: Regeneration Ecosystem & Platform.