---
title: "Deploy Gotify | (Just Updated) Push Notification Server with REST API, Admin Login Preset, Data Survives Redeploys"
description: "Gotify push notification server with REST API and WebSocket stream"
category: "Automation"
url: https://railway.com/deploy/gotify-or-just-updated-push-notification
---

# Deploy Gotify | (Just Updated) Push Notification Server with REST API, Admin Login Preset, Data Survives Redeploys

Gotify push notification server with REST API and WebSocket stream

**[Deploy Gotify | (Just Updated) Push Notification Server with REST API, Admin Login Preset, Data Survives Redeploys on Railway](https://railway.com/template/gotify-or-just-updated-push-notification)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/gotify-or-just-updated-push-notification/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Automation

## Template content

### gotify

- **Image:** gotify/server:3.1.1@sha256:44fc5bbd1c0618878e33073d38c2c13126b48f245c3fe12236b1da48eb203b86
- **Start command:** `/bin/sh -c 'export GOTIFY_SERVER_PORT="${PORT:-8080}" GOTIFY_DEFAULTUSER_NAME=admin GOTIFY_REGISTRATION=false; echo "[boot] data dir owner=$(stat -c %u:%g /app/data) listen=$GOTIFY_SERVER_PORT"; exec ./gotify-app'`
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Gotify on Railway

**Built for an LLM agent to deploy and use.** There is no setup page to open: the admin account is created from a generated password on first boot, and the contract below lists every address, variable name and one script that creates an application token and sends a message.

Gotify is an open source, self-hosted push notification server. Scripts, CI jobs and AI agents send messages to it over a REST API, and clients (the web UI, the Android app, or any WebSocket listener) receive them in real time. It is a simple HTTP server with a SQLite database, so it idles at a few megabytes of memory.

## About Hosting Gotify

This template runs one service: the official `gotify/server` 3.1.1 image, pinned by digest, with a volume on `/app/data`. The volume holds the SQLite database (users, applications, tokens, messages), uploaded application images and plugins, so they survive redeploys.

The start command sets the admin user to `admin` with the password in `GOTIFY_DEFAULTUSER_PASS`, turns public registration off, and moves Gotify's fixed port 80 to Railway's injected `PORT` so the healthcheck and the public domain reach it. Gotify applies the default user only while its database is empty, so changing the password variable later does not change the password; change it in the web UI instead. Registration is off, so nobody else can create an account on the public URL.

### Agent contract

- Public URL: `GOTIFY_PUBLIC_URL` (`https://` plus the service's `RAILWAY_PUBLIC_DOMAIN`). The web UI is at `/`, the REST API at the same origin.
- Private URL: `http://gotify.railway.internal:8080`, exposed as `GOTIFY_PRIVATE_URL`.
- Credentials: `GOTIFY_DEFAULTUSER_PASS` (password of the user `admin`).
- Auth: management calls use HTTP Basic auth as `admin`. Sending a message uses an application token, passed as the `X-Gotify-Key` header (or `?token=`), created by `POST /application`. Reading a live stream uses a client token created by `POST /client`, passed on `GET /stream` as `X-Gotify-Key`.
- Health: `GET /health` returns 200 `{"health":"green","database":"green"}` without credentials.
- API: `POST /application`, `GET /application`, `POST /message`, `GET /message`, `POST /client`, `GET /stream` (WebSocket), `GET /current/user`.

```bash
# run with GOTIFY_PUBLIC_URL and GOTIFY_DEFAULTUSER_PASS set
U="$GOTIFY_PUBLIC_URL"
curl -s "$U/health"; echo
curl -s -o /dev/null -w "no auth: %{http_code}\n" "$U/application"
TOKEN=$(curl -s -u "admin:$GOTIFY_DEFAULTUSER_PASS" -H "Content-Type: application/json" \
  -d '{"name":"agent","description":"created by an agent"}' "$U/application" | sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
curl -s -H "X-Gotify-Key: $TOKEN" -d "title=hello" -d "message=sent by an agent" -d "priority=5" "$U/message"; echo
curl -s -u "admin:$GOTIFY_DEFAULTUSER_PASS" "$U/message?limit=1"; echo
curl -s -o /dev/null -w "register closed: %{http_code}\n" -H "Content-Type: application/json" -d '{"name":"x","pass":"y"}' "$U/user"
```

A fresh deploy prints `{"health":"green","database":"green"}`, `no auth: 401`, the sent message as JSON, a message list containing it, and `register closed: 401`.

## Why Deploy Gotify 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 Gotify 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.

- **Agent-ready** - generated admin password, contract block and one working script; nothing to type into the deploy form.
- **No default login** - upstream starts with `admin` / `admin`; here the password is generated per deploy and registration is off.
- **State survives redeploys** - users, application tokens and message history live on one volume.
- **One light service** - SQLite on the volume, no Postgres to run alongside, about 5 MB of memory when idle.
- **A working port** - the image's fixed port 80 is moved to Railway's injected port, so the healthcheck passes.

## Common Use Cases

- **Alerts from scripts and cron jobs** - one `curl` to `/message` when a backup fails or a deploy finishes.
- **Agent notifications** - an AI agent reports progress or asks for attention through a token it created itself.
- **Phone push** - the Gotify Android app subscribes to your server over WebSocket, no third-party push service.

## Dependencies for Gotify Hosting

- One Railway volume on `/app/data`, created by the template.

### Deployment Dependencies

- [Gotify repository](https://github.com/gotify/server)
- [Official image](https://hub.docker.com/r/gotify/server)
- [Gotify documentation](https://gotify.net/docs/)

### Implementation Details

| Variable | Purpose |
| --- | --- |
| `GOTIFY_DEFAULTUSER_PASS` | Password of the `admin` user, read on the first boot only. Generated per deploy. |
| `GOTIFY_PUBLIC_URL` | HTTPS address for clients outside Railway. |
| `GOTIFY_PRIVATE_URL` | Address on the private network, for services in the same project. |

The start command exports `GOTIFY_SERVER_PORT` from `PORT`, `GOTIFY_DEFAULTUSER_NAME=admin` and `GOTIFY_REGISTRATION=false`, then runs the image's own `gotify-app`.


## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/gotify-or-just-updated-push-notification
