DEV Community

Alex Spinov
Alex Spinov

Posted on

Hasura Has a Free API — Instant GraphQL on Your Database

Hasura gives you an instant GraphQL API on top of PostgreSQL, MySQL, SQL Server, and more. No code, no resolvers — just connect your database.

What Is Hasura?

Hasura auto-generates a full GraphQL API from your database schema. It handles subscriptions, authentication, authorization, and remote schemas.

Free tier (Hasura Cloud):

  • 1GB data passthrough/month
  • 60 requests/minute
  • 1 project
  • Built-in caching

Quick Start

# Docker
docker run -d -p 8080:8080 \
  -e HASURA_GRAPHQL_DATABASE_URL=postgres://user:pass@host:5432/db \
  -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
  hasura/graphql-engine:latest
Enter fullscreen mode Exit fullscreen mode

Auto-Generated GraphQL

# Query (auto-generated from your users table)
query {
  users(where: { active: { _eq: true } }, order_by: { created_at: desc }, limit: 10) {
    id
    name
    email
    created_at
  }
}

# Mutation
mutation {
  insert_users_one(object: { name: "Alice", email: "alice@example.com" }) {
    id
  }
}

# Real-time subscription
subscription {
  users(order_by: { created_at: desc }, limit: 5) {
    name
    created_at
  }
}
Enter fullscreen mode Exit fullscreen mode

REST API (from GraphQL)

Hasura also lets you create REST endpoints from GraphQL queries:

curl https://your-hasura.hasura.app/api/rest/users \
  -H "x-hasura-admin-secret: YOUR_SECRET"
Enter fullscreen mode Exit fullscreen mode

Use Cases

  1. Instant API — connect DB, get GraphQL in seconds
  2. Real-time apps — subscriptions out of the box
  3. API gateway — stitch multiple data sources
  4. Authorization — row-level permissions
  5. Event triggers — webhook on data changes

Hasura vs Alternatives

Feature Hasura PostGraphile Prisma
Setup Instant Config Code-gen
Subscriptions Yes Yes No
Auth/permissions Built-in Plugin External
Multiple DBs Yes PostgreSQL Many
Event triggers Yes No No

Need web data at scale? Check out my scraping tools on Apify or email spinov001@gmail.com for custom solutions.

Top comments (0)