English
Get started
← All templates

Deploy Hasura on Pethost in one click

Instant GraphQL and REST APIs over a Postgres database, with permissions, events and a web console

What happens

  1. You sign in to Pethost or make an account, with a passkey, GitHub or Google.
  2. No machine yet? You pick a plan, and we prepare one for you. The link waits in your browser until it is ready.
  3. New project opens at the app. You fill in what it asks for and click Create project: Admin password.
  4. In a minute or two the app is live at its own address with HTTPS. Its secrets are made for it at random, and its data is in the nightly backup.
  5. It is a project like any other: its compose.yaml, its .env, its logs and a terminal are in the panel, and your agent can change it, roll it back or restore it.

First steps

Open https://hasura.sam.pethost.app/console and enter the admin password you gave as the admin secret; API calls send it in the x-hasura-admin-secret header. The project’s own Postgres is connected as the data source default: create tables in the console’s Data tab.

What it runs

The template is this compose.yaml and the variables it writes into the project’s .env. Pethost runs the file as it is written.

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: