---
title: "Deploy NHOST"
description: "Backend for apps: database, GraphQL API, logins and file uploads"
category: "Starters"
url: https://railway.com/deploy/nhost
---

# Deploy NHOST

Backend for apps: database, GraphQL API, logins and file uploads

**[Deploy NHOST on Railway](https://railway.com/template/nhost)**

- **Creator:** A3A
- **Category:** Starters

## Template content

### storage https://cdn.simpleicons.org/nhost/white.svg

- **Source:** https://github.com/gridalpha/nhost-railway
- **Health check:** /healthz
- **Public domain:** Yes

### auth https://cdn.simpleicons.org/nhost/white.svg

- **Image:** nhost/auth:0.40.2
- **Health check:** /healthz
- **Public domain:** Yes

### dashboard https://cdn.simpleicons.org/nhost/white.svg

- **Source:** https://github.com/gridalpha/nhost-railway
- **Health check:** /healthz
- **Public domain:** Yes

### Postgres https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgresql.svg

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

### functions https://cdn.simpleicons.org/nhost/white.svg

- **Source:** https://github.com/gridalpha/nhost-railway
- **Health check:** /healthz
- **Public domain:** Yes

### graphql https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/hasura.svg

- **Source:** https://github.com/gridalpha/nhost-railway
- **Health check:** /healthz
- **Public domain:** Yes

### mailhog https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/mailpit.svg

- **Image:** axllent/mailpit:latest
- **Health check:** /livez
- **Public domain:** Yes

## Buckets

- **nhost-storage**

## Documentation

![Nhost logo](https://nhost.io/images/og-new.png)

# Deploy and Host Nhost on Railway

Nhost is an open-source backend-as-a-service: a Postgres database, an instant GraphQL API over it, email and social sign-in, S3-backed file storage and serverless functions — the Firebase feature set, built on tools you can read the source of. Teams reach for it when they want Firebase's speed without Firebase's data model: the database is ordinary Postgres, so foreign keys, joins and SQL migrations all still work, and access control is row-level permission rules. Self-host Nhost and every user record, uploaded file and row of data stays on infrastructure you control.

Deploy Nhost on Railway and the whole stack comes up wired together: a Hasura GraphQL engine over managed Postgres, Nhost Auth issuing JWTs that Hasura validates, Nhost Storage backed by an object storage bucket, a Node 22 runtime for your serverless functions, the Nhost dashboard behind HTTP basic authentication, and a Mailpit inbox catching verification and password-reset email. Each service gets its own public URL, matching what the Nhost JavaScript SDK expects, and every shared secret is generated once and referenced by the services that need it.

![Diagram of the Nhost services and Postgres on Railway](https://res.cloudinary.com/rroe4rtk/image/upload/v1788095686/nhost-architecture.png)

## Getting Started with Nhost on Railway

There is no installation wizard and no default account to change. Set the dashboard user and password at deploy time, then open the dashboard URL — your browser asks for that pair, because the dashboard holds your admin secret and has no login of its own. Inside, Database browses and edits tables, Auth lists application users, Storage lists uploaded files, and GraphQL opens a query editor already authenticated as admin. Create your first table in the Hasura console at `https:///console`, then use its Permissions tab to give the `user` role access filtered on `X-Hasura-User-Id`, so each account sees only its own rows. Register an account to confirm everything is connected:

```
curl -X POST https:///v1/signup/email-password \
  -H 'content-type: application/json' \
  -d '{"email":"you@example.com","password":"a-strong-password"}'
```

Send the returned access token as `Authorization: Bearer ` to `https:///v1/graphql`, and your permission rules decide what comes back. The account appears in the dashboard's Auth list within seconds, and any email auth sends lands in the Mailpit inbox.

![Nhost dashboard listing two registered application users](https://res.cloudinary.com/rroe4rtk/image/upload/v1788095688/nhost-users.png)

![Nhost database browser showing a notes table row](https://res.cloudinary.com/rroe4rtk/image/upload/v1788095689/nhost-database-notes.png)

![Nhost storage browser listing an uploaded text file](https://res.cloudinary.com/rroe4rtk/image/upload/v1788095690/nhost-storage.png)

## About Hosting Nhost

Nhost packages four open-source pieces into one backend so you do not have to integrate them yourself. Hasura turns your Postgres schema into a GraphQL API with subscriptions and role-based permissions, and no resolver code. Nhost Auth owns the `auth` schema, handles email/password, magic links, one-time codes, WebAuthn and OAuth, and signs the JWTs Hasura checks. Nhost Storage owns the `storage` schema, streams uploads to an S3-compatible bucket and applies the same permission rules to files that Hasura applies to rows. Functions serves your `.ts` and `.js` files as HTTP endpoints.

Key features:

- Instant GraphQL API — queries, mutations, subscriptions and aggregates from your schema
- Row-level permissions per role, with `X-Hasura-User-Id` in every rule
- Email/password, passwordless, one-time-code, WebAuthn and OAuth sign-in
- File uploads with per-file permissions, image transforms and presigned URLs
- TypeScript serverless functions, called directly or from Hasura triggers
- Official JavaScript, React and Vue SDKs, plus anything speaking GraphQL

Postgres holds all application data plus the `auth`, `storage` and Hasura catalogue schemas; the GraphQL service is the only one your client queries for data; auth and storage each expose a small REST API; and the dashboard is an operator tool, outside the runtime path.

## Why Deploy Nhost on Railway

Railway removes the setup work that makes this stack awkward to run:

- Postgres, object storage and every service provisioned and connected in one deploy
- Shared secrets generated once and referenced, never copied between services
- TLS, public domains and private networking handled for you
- Each service scales and redeploys independently
- Logs and metrics for all six services in one place

## Common Use Cases for Self-Hosted Nhost

- Shipping a React, Next.js, Vue or React Native app that needs auth, a database and uploads with no backend to write
- Replacing Firebase or Supabase where user data must stay on your own infrastructure
- Prototyping a product API quickly, then carrying the schema into production

## Dependencies for Nhost

- `nhost/graphql-engine:v2.46.0-ce` — Hasura CE, plus this stack's schema and metadata bootstrap
- `nhost/auth:0.40.2` — authentication service and JWT issuer
- `nhost/storage:0.7.2` — file storage API in front of the bucket
- `nhost/functions:22-1.4.0` — Node 22 serverless functions runtime
- `nhost/dashboard:2.34.0` — admin dashboard behind a basic-auth gateway
- `axllent/mailpit:latest` — capture-only SMTP inbox for verification and reset email
- Railway managed Postgres and an object storage bucket

The Nhost images are pinned together: auth and storage write schemas into the same database and register metadata in the same Hasura catalogue, so mixing releases is the upgrade mistake to avoid.

### Environment Variables Reference

| Variable | Service | Purpose |
|---|---|---|
| `HASURA_GRAPHQL_ADMIN_SECRET` | graphql | Master key for the GraphQL and metadata APIs |
| `HASURA_GRAPHQL_JWT_SECRET` | graphql | HS256 key auth signs with and Hasura verifies |
| `AUTH_SERVER_URL` | auth | Public base URL written into email links |
| `AUTH_DISABLE_SIGNUP` | auth | Set `true` to close registration |
| `S3_BUCKET`, `S3_ENDPOINT` | storage | Bucket uploaded files are written to |
| `DASHBOARD_USER`, `DASHBOARD_PASSWORD` | dashboard | Credentials the dashboard asks for |

### Deployment Dependencies

- Source: [github.com/nhost/nhost](https://github.com/nhost/nhost) — self-hosting reference under [examples/docker-compose](https://github.com/nhost/nhost/tree/main/examples/docker-compose)
- Documentation: [docs.nhost.io](https://docs.nhost.io)
- Runtimes: Haskell (Hasura), Go (auth, storage), Node 22 (functions, dashboard)

## Hardware Requirements for Self-Hosting Nhost

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU across the stack | 4 vCPU |
| RAM | 2 GB total | 4 GB, most of it for Hasura and Postgres |
| Storage | 1 GB for Postgres | 10 GB plus object storage for uploads |
| Runtime | Docker | Docker, with Postgres 14 or newer |

## Self-Hosting Nhost with Docker

Nhost publishes a reference compose stack — clone and start it:

```
git clone https://github.com/nhost/nhost
cd nhost/examples/docker-compose
cp .env.example .env
docker compose up -d
```

Before any service starts, it creates the schemas the migration runners expect and the extensions the auth tables need. This is the SQL its `initdb.d` script applies:

```
CREATE SCHEMA IF NOT EXISTS auth;
CREATE SCHEMA IF NOT EXISTS storage;
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public;
```

Auth and storage migrate their own tables on first boot. This template applies that SQL for you, so a fresh deploy needs nothing by hand.

## How Much Does Nhost Cost to Self-Host?

Nhost is MIT-licensed and free to self-host, with no seat limits, feature gates or license key. Nhost also sells a managed cloud, but nothing here calls back to it. On Railway you pay only for the compute, database and object storage the six services use. Official self-hosting support is a paid agreement; otherwise help comes from GitHub and Discord.

## FAQ

**What is Nhost?**

Nhost is an open-source backend-as-a-service: Postgres, a GraphQL API generated by Hasura, authentication, file storage and serverless functions, packaged so a frontend app can use them without a custom backend.

**What does this Railway template deploy?**

Six services plus a database and a bucket: the Hasura GraphQL engine, Nhost Auth, Nhost Storage, the Functions runtime, the dashboard behind basic auth, a Mailpit inbox, managed Postgres and object storage.

**Why does the template include an object storage bucket and a mail service?**

Storage writes uploads to an S3-compatible bucket rather than a disk, which keeps the service stateless and the files durable. The mail service catches the verification and reset messages auth sends, so those flows work immediately; point `AUTH_SMTP_*` at a real relay to deliver to real inboxes.

**How do I stop strangers signing up to my Nhost instance?**

Set `AUTH_DISABLE_SIGNUP=true` on the auth service to close registration, or `AUTH_ACCESS_CONTROL_ALLOWED_EMAIL_DOMAINS` to restrict it to your own domain. Both take effect on the next deploy.

**Where do I create tables and permissions in self-hosted Nhost?**

Use the Hasura console at `/console` on the GraphQL service, linked from the dashboard. It handles schema changes, tracking, relationships and role permissions; the dashboard is best for browsing data, users and files. In your app, install `@nhost/nhost-js` and pass the four deployed URLs explicitly, since each service has its own domain.


## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway
- [Appsmith](https://railway.com/deploy/appsmith-1) — Low-code platform for internal tools, dashboards, and admin panels.

Open this page in a browser: https://railway.com/deploy/nhost
