What goes in Hasura and what goes in Workers
On Ekonavi the split is:
- Hasura serves reads and straightforward writes: products, orders, reviews, users, projects, each governed by role-based permissions.
- Hono Workers handle anything with side effects or external systems: checkout, MercadoPago payments, webhooks, shipping, file uploads.
The frontends talk to both. That keeps the database permission model simple and keeps payment logic in code that can be tested and reviewed like any other.
Illustrative example: a seller-scoped query
# Permission (seller role): orders where store.owner_id = X-Hasura-User-Id
query OpenOrders($limit: Int = 20) {
orders(where: { status: { _eq: "open" } }, order_by: { created_at: desc }, limit: $limit) {
id
total
created_at
customer { name }
items { quantity product { name } }
}
}
The query doesn’t filter by seller. The permission rule does, which means a frontend bug can’t accidentally show one seller another seller’s orders.
Typed queries on the client
GraphQL responses are consumed through typed hooks. In the marketplace admin dashboard, TanStack Query handles caching and background refetching; the pattern is to invalidate the affected queries after a mutation (a review reply, a stock change) rather than reloading the page or hand-editing cached data.