← All templates · Developer tools
Deploy Hasura in one click
Instant GraphQL and REST APIs over a Postgres database, with permissions, events and a web console
A self-hosted alternative to Firebase and AWS AppSync.
What is Hasura?
Hasura is an open-source GraphQL engine that puts an instant API on a Postgres database, often run in place of Firebase. Track a table in its console and Hasura generates queries, mutations and realtime subscriptions for it. Permissions are set per role, table and operation, down to single rows and columns. Event triggers call a webhook when a row is inserted, updated or deleted.
People self-host it to keep their data in their own Postgres, as ordinary tables that any SQL client can still read. It suits frontend and mobile developers who want a backend API without writing one, and the core engine is under the Apache 2.0 license. The catch: it has no sign-up or login of its own, so users have to come from a separate auth service.
Hosting Hasura on Pethost
- You sign in to Pethost with a passkey, GitHub or Google. No machine yet? You pick a plan, and the link waits until it is ready.
- New project opens at Hasura. You fill in what it asks for and click Create project: Admin password.
- In a minute or two Hasura is live at its own address with HTTPS. Its secrets are made at random, and its data is in the nightly backup.
- It is a project like any other: you or your agent can change it, roll it back or restore it.
Questions about Hasura
Is Hasura free and open source?
Yes, the core engine is open source and free to run. Caching, read replicas, Prometheus metrics, API limits and connectors such as MySQL, Oracle and Snowflake are Enterprise Edition features, unlocked by a license key from Hasura.
How does authentication work with Hasura?
Through your own auth service: it issues a JWT that Hasura verifies, or Hasura calls its webhook on each request. The session variables it passes, such as X-Hasura-Role and X-Hasura-User-Id, decide what the request can reach.
Which databases does Hasura support?
The open-source engine connects to Postgres and compatible databases, MS SQL Server and BigQuery. MySQL, MariaDB, Oracle, MongoDB, Snowflake and Amazon Athena need the Enterprise Edition.
Can Hasura generate a REST API?
Yes. RESTified endpoints turn any GraphQL query or mutation into a REST endpoint with its permissions, default CRUD endpoints can be enabled on a data source in a few clicks, and Hasura exports OpenAPI documentation for them.
How do I export Hasura metadata?
In the console, click the settings icon at the top right, then Export Metadata, which downloads a JSON file; Import Metadata applies one. The CLI does the same with hasura metadata export and hasura metadata apply.
How much memory and disk does Hasura need?
Hasura is light: about 100 MB of memory with its Postgres, and the disk holds your database's rows. On Pethost the Starter plan is enough for it, with room for other apps beside it.
Hasura Docker Compose file
The template is this compose.yaml and the variables written into the project’s .env as it is created. Pethost runs the file as it is written.
Containers: graphql-engine (hasura/graphql-engine:v2.50.3), postgres (postgres:17-alpine).
Volumes, in the nightly backup: db.
services:
graphql-engine:
image: hasura/graphql-engine:v2.50.3
restart: unless-stopped
environment:
# Hasura keeps its metadata in this database and serves it as the data source "default".
HASURA_GRAPHQL_DATABASE_URL: postgres://hasura:${POSTGRES_PASSWORD}@postgres:5432/hasura
# The console and the API take the admin secret; without it they would be open to anyone.
HASURA_GRAPHQL_ADMIN_SECRET: ${ADMIN_SECRET}
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
HASURA_GRAPHQL_DEV_MODE: "false"
HASURA_GRAPHQL_ENABLE_TELEMETRY: "false"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_DB: hasura
POSTGRES_USER: hasura
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U hasura -d hasura"]
interval: 5s
timeout: 5s
retries: 10
start_period: 30s
volumes:
db:
More in Developer tools
- GiteaGit hosting with pull requests and issues
- code-serverVS Code in the browser
- KrokiDiagrams from text: PlantUML, Mermaid, Graphviz and more
- CoderRemote development environments from Terraform templates, opened in VS Code, JetBrains, a browser or over SSH
- InsForgeA backend for apps that coding agents build: Postgres, auth, storage and edge functions
- LibreDB StudioA SQL IDE in the browser for PostgreSQL, MySQL, SQLite, MongoDB, Redis and more