Appearance

Visual style

Mode
Theme
Accent
Advanced
Text sizeScales the whole site
16 px
Reduce motionReduce animations or match your system
Separate light and darkChoose a theme, accent and font for each
50

Technology · Data

Hasura and GraphQL development

Hasura is a GraphQL engine that generates a GraphQL API from a database schema such as PostgreSQL. Its documentation describes auto-generated queries, mutations and subscriptions, role-based row- and column-level permissions, and Actions and Event Triggers for connecting custom business logic.

In practice

How I use Hasura & GraphQL

Hasura is the data layer of the Ekonavi platform. Frontends (the marketplace, the seller dashboard and the admin dashboard) query it over GraphQL, using TanStack Query or Apollo Client. Business logic that doesn't belong in the database, such as payments and checkout, lives in Hono services on Cloudflare Workers.

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.

Trade-offs

Where Hasura & GraphQL shines, and where it doesn't

Strengths

  • CRUD APIs over a well-designed schema in hours instead of weeks.
  • Permission rules are declarative and enforced in one place for every client.
  • Frontends request exactly the fields a screen needs.

Limitations

  • Business workflows (payments, multi-step orders) still need custom services; they don't belong in Hasura.
  • Permissions and relationships become a critical part of the system that needs review and versioned metadata.
  • GraphQL caching and rate limiting take more thought than REST.

Sources

Official documentation

General descriptions on this page are based on the official documentation linked below. Experience notes are my own.

FAQ

Hasura & GraphQL questions

When does GraphQL make sense instead of REST?

When several clients (a storefront, a seller dashboard, an admin panel) need different shapes of the same data. GraphQL lets each request what it needs. For a single client with a few endpoints, or for webhook-style integrations, REST is simpler.

Is Hasura secure enough for a marketplace?

Security depends on how permissions are configured. Hasura evaluates role-based rules on every request using claims from the user's token (for example, 'a seller can read only their own orders'). Those rules need the same review and testing as application code.

Can Hasura run custom business logic?

Yes, through Actions (custom GraphQL mutations or queries backed by your own HTTP endpoint), Event Triggers (calling a webhook when rows change) and remote schemas. On Ekonavi, logic with side effects, such as payments, lives in separate Hono services instead.

Need a Hasura & GraphQL developer?

If your project needs Hasura & GraphQL, send a short description of what you're building and where it's stuck. I'll reply with how I'd approach it.