---
title: "Deploy Hasura"
description: "Instant GraphQL and REST API over your Railway Postgres (Hasura v2.51)"
category: "Other"
url: https://railway.com/deploy/hasura-2
---

# Deploy Hasura

Instant GraphQL and REST API over your Railway Postgres (Hasura v2.51)

**[Deploy Hasura on Railway](https://railway.com/template/hasura-2)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/hasura-2/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Other

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Hasura https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/hasura.png

- **Source:** https://github.com/aalfath/hasura-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host Hasura on Railway

Hasura GraphQL Engine is an open-source server that gives you an instant, realtime GraphQL and REST API over Postgres. It reads your schema, generates queries, mutations and subscriptions, enforces role-based row and column permissions, and calls webhooks on database events or schedules. This template runs Hasura v2.51.8.

## About Hosting Hasura

Hasura is a single stateless container. It keeps its metadata (tracked tables, relationships, permissions, event triggers) in a Postgres database, and it serves an API over one or more Postgres sources. This template builds Hasura from a GitHub repo that pins the official image, adds a Railway Postgres for metadata on a persistent volume, generates an admin secret and a public domain, and health-checks `/healthz`. The wrapper refuses to start without an admin secret, so the API is never open. To put Hasura on your own app's data, set `HASURA_GRAPHQL_DATABASE_URL` on the Hasura service to your database's `DATABASE_URL` reference over the private network.

## Common Use Cases

* Add a GraphQL and REST API to the Postgres an existing Railway app already uses
* Realtime subscriptions for dashboards and live front ends
* Run webhooks or serverless functions on inserts, updates and deletes (event triggers) and on schedules (cron triggers)

## Dependencies for Hasura Hosting

* Postgres for Hasura's metadata (included)
* A Postgres database to expose (the bundled one by default, or your app's own)

### Deployment Dependencies

* Hasura GraphQL Engine: https://github.com/hasura/graphql-engine
* Official image `hasura/graphql-engine:v2.51.8`: https://hub.docker.com/r/hasura/graphql-engine
* Server configuration reference: https://hasura.io/docs/2.0/deployment/graphql-engine-flags/reference/
* Template repo: https://github.com/aalfath/hasura-railway-template

### Implementation Details

Point Hasura at the database your app already runs on Railway. On the Hasura service, set:

```
HASURA_GRAPHQL_DATABASE_URL=${{YOUR-DB-SERVICE.DATABASE_URL}}
```

`YOUR-DB-SERVICE` is the name of your Postgres service. Railway's `DATABASE_URL` uses the private `*.railway.internal` host, so the traffic stays inside your project. Keep `HASURA_GRAPHQL_METADATA_DATABASE_URL` on the bundled Postgres, so Hasura's own tables never touch your app's schema.

Open `https://YOUR-DOMAIN/console`, enter the `HASURA_GRAPHQL_ADMIN_SECRET` value from the Hasura service's variables, and track the tables you want to expose. API clients send the secret as the `X-Hasura-Admin-Secret` header, or use JWT or webhook auth (`HASURA_GRAPHQL_JWT_SECRET`, `HASURA_GRAPHQL_UNAUTHORIZED_ROLE`) for end users; add those variables yourself when you need them. Updates arrive as commits to the template repo, with a changelog entry for each version.

## Why Deploy Hasura on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Hasura on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — Self-hosted virtual tabletop for role-playing games (license required)
- [Double Commander in your browser](https://railway.com/deploy/double-commander-in-your-browser) — The Double Commander file manager in the cloud, from any device

Open this page in a browser: https://railway.com/deploy/hasura-2
