Deploy Hasura

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

Deploy Hasura

/var/lib/postgresql/data

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

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.


Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
51
View Template
Foundry Virtual Tabletop
Self-hosted virtual tabletop for role-playing games (license required)

Lucas
71
View Template
NEW
Double Commander in your browser
The Double Commander file manager in the cloud, from any device

Nermin Sabanovic
0