>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
TypeScript

How to Stop Writing CRUD and Start Living with Hasura

Sound familiar? You start a new project, and the first two weeks are spent on monotonous routine. You need to describe schemas in the database, create models in code, write endpoints for creating, reading, updating, and deleting records. Then add pagination, filtering, sorting, and of course figure out access permissions somehow. By the time you get to the actual business logic, your enthusiasm has already faded a bit.

I often caught myself thinking that 80% of the backend in a typical web application is just proxying data from the database to JSON and back. That's exactly the problem Hasura solves.

What is it exactly

In short, Hasura is a ready-made engine that connects to your databases and instantly delivers a production-ready GraphQL API. You don't need to write server code in Node.js, Go, or Python. You simply describe tables in Postgres, MS SQL Server, or even MongoDB, and Hasura itself generates the schema with all relationships.

Hasura logo

The GitHub project has already collected over 32 thousand stars, and it's not just "another wrapper". It's a full-fledged compiler that transforms GraphQL queries into efficient SQL.

How Hasura actually helps in work

When I first tried Hasura, what won me over was that it doesn't try to lock the developer in a "golden cage". Here are a few things that make it useful.

Instant API with all the bells and whistles

Once you connect a database, you immediately get the ability to make complex queries. Want to pull a user, their last five orders, and only the items in those orders that cost more than 1,000 rubles? With regular REST, you'd either have to make three requests or write a custom endpoint with a bunch of joins. In Hasura, it's one GraphQL query that it will execute as a single efficient SQL query against the database.

Row-level security

This is probably the engine's strongest feature. Hasura has a built-in access control system (RBAC). You can say: "A user with the editor role can only see articles where they are listed as the author". This is configured right in the console or via YAML configs. You don't need to check if (user.id === article.author_id) in every controller method.

Built-in reactivity

If you need real-time updates (for example, for a chat or notification feed), Hasura supports GraphQL Subscriptions. It automatically monitors changes in the database and pushes data to the client via WebSockets. Setting this up manually from scratch is quite a task, especially if you need to account for access permissions.

Event-driven architecture

Hasura can trigger webhooks when the database changes. A new user added? Hasura will send a POST request to your microservice, which will send a welcome email. This allows you to offload heavy logic to external functions (Serverless or regular microservices), keeping the API clean.

What's new in version three

Hasura V3 is now actively developing. The team has rethought the architecture and focused on connectors. The engine is now written in Rust (previously Haskell), which should positively affect memory consumption and speed.

V3 introduced the "supergraph" concept — this is when you can combine data from different sources (Postgres, Mongo, ClickHouse) into a single logical API. At the same time, you can write custom logic in TypeScript, Python, or Go using their SDK.

Technical nuances and a fly in the ointment

Don't think of this as a "silver bullet". Hasura is an additional layer in your infrastructure.

  1. Difficulty of debugging: when something goes wrong in a generated SQL query, it can be hard to understand why Hasura decided to build it that way. Although the console has an Analyze tool that shows the query execution plan.
  2. Dependency on DB structure: Hasura is very tightly coupled to how your database is designed. If you have a mess of tables without foreign keys, there will be no magic. You'll need to first tidy up the data schema.
  3. Learning curve: despite the very quick start, deep configuration of access permissions and working with Remote Schemas takes time to learn from the documentation.

Who will benefit from this

Hasura is a perfect fit for projects where the frontend team wants to move fast and not wait for the backend to write another endpoint. It's great for MVPs, internal admin panels, and dashboards where there's a lot of data work and filtering.

If you're building a system with very specific business logic that's hard to fit into the CRUD paradigm, Hasura can still be useful as a "data layer" on top of which you build your services.

The easiest way to try it is through Docker — the repository has ready-made docker-compose files. Literally within five minutes, you'll have a working console with a GraphQL sandbox. If you're tired of writing repetitive controllers, this is definitely a tool worth trying out.

Related projects