Overview
Hasura is a GraphQL engine designed to simplify and accelerate API development by providing instant, real-time GraphQL APIs over various data sources. Founded in 2017, Hasura's core offering, the Hasura GraphQL Engine, connects to databases like PostgreSQL, SQL Server, and BigQuery, converting database schemas into a GraphQL schema. This process automatically generates resolvers for queries, mutations, and subscriptions, allowing developers to interact with their data using GraphQL without writing extensive backend code for API endpoints. The engine supports a wide range of database operations, including data fetching, insertion, updates, and deletions, and provides real-time capabilities via GraphQL subscriptions, which are useful for applications requiring live data updates, such as chat applications, dashboards, or collaborative tools.
Hasura is particularly well-suited for organizations focused on rapid application development and those adopting microservices architectures. It enables developers to quickly expose data from existing databases as GraphQL APIs, facilitating integration between different services and frontends. For new projects, it eliminates much of the boilerplate associated with API development, allowing teams to focus on business logic rather than CRUD API implementation. The platform's ability to connect to multiple data sources, including REST APIs and other GraphQL services, and unify them under a single GraphQL endpoint, makes it a valuable tool for data federation. This capability is crucial for complex applications that aggregate data from disparate systems.
The Hasura Cloud offering provides a managed service for the GraphQL Engine, handling deployment, scaling, and maintenance. This reduces the operational burden on development teams, allowing them to provision a GraphQL API endpoint quickly and manage it through a web console. The console offers a visual interface for schema management, relationship definition, and permission configuration. Hasura's permission system is granular, allowing row-level and column-level access control based on user roles, which is essential for securing data in multi-tenant applications. Developers can integrate Hasura with various authentication providers, including Auth0, Firebase, and custom JWTs, to manage user access effectively. The platform's extensibility is further enhanced through event triggers, which allow developers to execute custom business logic in response to database events, and remote schemas, which enable the merging of other GraphQL services into a single Hasura API.
Key features
- Instant GraphQL APIs: Automatically generates GraphQL APIs from database schemas for queries, mutations, and subscriptions, reducing manual API development effort.
- Real-time Subscriptions: Provides live data updates over WebSocket connections, enabling the creation of real-time applications and dashboards.
- Data Federation: Unifies multiple data sources, including databases, REST APIs, and other GraphQL services, into a single GraphQL API endpoint via remote schemas.
- Granular Authorization: Offers row-level and column-level permission systems based on user roles, ensuring secure data access.
- Event Triggers: Allows custom business logic to be invoked in response to database events (insert, update, delete), supporting asynchronous workflows and microservices communication.
- Database Migrations: Manages database schema changes through a version-controlled migration system, facilitating collaborative development and deployment.
- Caching: Supports various caching strategies to improve API performance and reduce database load.
- Monitoring and Observability: Provides tools and integrations for tracking API performance, errors, and usage patterns.
Pricing
Hasura offers a tiered pricing model, including a free tier for hobby projects and paid plans for production deployments.
| Plan | Key Features | Pricing (as of May 2026) |
|---|---|---|
| Hasura Cloud Free | For hobby projects, up to 3 projects, 1GB data transfer, 100K API requests/month. | Free |
| Hasura Cloud Standard | For production applications, starts at 3 projects, 10GB data transfer, 1M API requests/month, 24/7 support. | Starts at $99 per month |
| Hasura Cloud Enterprise | For large-scale deployments, custom limits, dedicated support, advanced security, private deployments. | Custom pricing |
Detailed pricing information and feature breakdowns are available on the Hasura pricing page.
Common integrations
- Databases: PostgreSQL, SQL Server, Google BigQuery, Amazon Aurora, CockroachDB. Hasura's data connectors documentation details supported databases.
- Authentication Providers: Auth0, Firebase Auth, Clerk, Supabase Auth, and custom JWT-based authentication systems.
- Frontend Frameworks: React, Vue, Angular, Svelte, and other JavaScript frameworks via GraphQL client libraries like Apollo Client or Relay.
- Serverless Functions: AWS Lambda, Google Cloud Functions, Azure Functions for executing custom business logic via event triggers or remote schemas.
- Monitoring & Logging: Prometheus, Grafana, Datadog, and other observability tools.
- Cloud Platforms: AWS, Google Cloud Platform, Microsoft Azure, Heroku for deployment and infrastructure management.
Alternatives
- Apollo GraphQL: A comprehensive suite of tools for building, managing, and consuming GraphQL APIs, including client, server, and graph management solutions.
- PostGraphile: An open-source tool that creates an instant GraphQL API from a PostgreSQL database, focusing on performance and extensibility.
- Prisma: A next-generation ORM that provides type-safe database access and a GraphQL-like API for various databases. Prisma also offers tools for database migrations and schema management.
- Remix API Routes: While not a direct GraphQL engine, Remix allows developers to build robust web applications with server-side rendering and API routes, providing an alternative for full-stack development without an explicit GraphQL layer.
- REST APIs with Node.js: Traditional RESTful API development using frameworks like Express.js or Fastify, offering full control over API design but requiring more manual implementation for CRUD operations and real-time features compared to Hasura.
Getting started
To get started with Hasura locally using Docker, you can set up the Hasura GraphQL Engine and a PostgreSQL database. This example demonstrates how to run Hasura and connect to a database, then interact with it using a simple GraphQL query.
# 1. Create a docker-compose.yaml file
cat <<EOF > docker-compose.yaml
version: '3.6'
services:
postgres:
image: postgres:14
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: hasura_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgrespassword
hasura:
image: hasura/graphql-engine:v2.36.0
ports:
- "8080:8080"
depends_on:
- postgres
restart: always
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/hasura_db
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_ADMIN_SECRET: "myadminsecretkey"
volumes:
db_data:
EOF
# 2. Start the services using Docker Compose
docker-compose up -d
# 3. Access the Hasura Console
# Open your browser and navigate to http://localhost:8080
# You will be prompted for the admin secret: myadminsecretkey
# 4. Add a table and data via the console or a migration
# For example, create a 'users' table with 'id' and 'name' columns.
# Alternatively, you can run a SQL command using a client like psql:
# docker exec -it hasura-postgres-1 psql -U postgres -d hasura_db
# CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT NOT NULL);
# INSERT INTO users (name) VALUES ('Alice'), ('Bob');
# 5. Example GraphQL Query using JavaScript (e.g., with fetch API)
async function fetchUsers() {
const graphqlEndpoint = 'http://localhost:8080/v1/graphql';
const adminSecret = 'myadminsecretkey';
const query = `
query {
users {
id
name
}
}
`;
try {
const response = await fetch(graphqlEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-hasura-admin-secret': adminSecret
},
body: JSON.stringify({ query })
});
const data = await response.json();
console.log('Fetched users:', data.data.users);
} catch (error) {
console.error('Error fetching users:', error);
}
}
fetchUsers();
This setup allows you to experiment with Hasura's instant GraphQL capabilities. You can create tables, define relationships, and set up permissions directly from the Hasura Console, and then query your data using any GraphQL client or the console's built-in API explorer. For production deployments, Hasura Cloud offers a managed service that simplifies infrastructure and scaling concerns, as detailed on the Hasura Cloud overview page.