---
title: "Deploy Unleash | (Just Updated) Feature Flag Server, REST API, Admin and SDK Tokens Ready"
description: "Unleash feature flags server with Postgres, REST API and ready SDK tokens"
category: "Other"
url: https://railway.com/deploy/unleash-or-just-updated-feature-flag-ser
---

# Deploy Unleash | (Just Updated) Feature Flag Server, REST API, Admin and SDK Tokens Ready

Unleash feature flags server with Postgres, REST API and ready SDK tokens

**[Deploy Unleash | (Just Updated) Feature Flag Server, REST API, Admin and SDK Tokens Ready on Railway](https://railway.com/template/unleash-or-just-updated-feature-flag-ser)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/unleash-or-just-updated-feature-flag-ser/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Other

## Template content

### unleash

- **Image:** unleashorg/unleash-server:8.3.1@sha256:025cd8b003a70cceb88427ca393c377ca6503a210d95fdee54d21610d51f7ed0
- **Start command:** `/bin/sh -c 'export DATABASE_USERNAME=postgres DATABASE_NAME=postgres DATABASE_SSL=false UNLEASH_DEFAULT_ADMIN_USERNAME=admin UNLEASH_URL="https://$RAILWAY_PUBLIC_DOMAIN" INIT_ADMIN_API_TOKENS="*:*.$UNLEASH_ADMIN_API_TOKEN" INIT_BACKEND_API_TOKENS="default:development.$UNLEASH_BACKEND_API_TOKEN" INIT_FRONTEND_API_TOKENS="default:development.$UNLEASH_FRONTEND_API_TOKEN"; until nc -z "$DATABASE_HOST" 5432; do sleep 2; done; exec docker-entrypoint.sh node dist/server.js'`
- **Health check:** /health
- **Public domain:** Yes

### postgres

- **Image:** postgres:17@sha256:31ba9c94a03ada9988f2bb493a22a75eef3a185884533e5cdbcd498ea835b08f

## Documentation

# Deploy and Host Unleash on Railway

**Built for an LLM agent to deploy and use.** There is no setup wizard and nothing to fill in: the admin password and three API tokens (admin, backend SDK, frontend SDK) are generated at deploy time and are valid from the first boot. The contract below lists every URL, variable name and the one script that proves it works.

Unleash is an open-source feature flag and feature toggle server: gradual rollouts, A/B tests, kill switches, targeting strategies and environments, with SDKs for most languages that poll its API. This template runs Unleash together with a PostgreSQL database.

## About Hosting Unleash

This template runs two services. `unleash` is the official **Unleash Server 8.3.1** image (`unleashorg/unleash-server`, pinned by digest). It is stateless: flags, projects, users and tokens all live in PostgreSQL. `postgres` is the official **postgres:17** image (pinned by digest) with a volume at `/var/lib/postgresql`, reachable only on the private network. The `unleash` start command waits for the database, then starts the stock server with the admin user, the public URL and the three API tokens taken from the service variables, so the same values apply after every redeploy. Allow about a minute for the first deploy to turn healthy.

### Agent contract

- Public URL: `https://` plus the `RAILWAY_PUBLIC_DOMAIN` of the `unleash` service, used as `UNLEASH_URL`. It serves the admin UI at `/`, the admin API under `/api/admin`, the SDK API under `/api/client` and `/api/frontend`.
- Private URL: `http://unleash.railway.internal:8080`
- Credentials: admin UI login `admin` with the password in `UNLEASH_DEFAULT_ADMIN_PASSWORD`; API tokens in `UNLEASH_ADMIN_API_TOKEN` (full admin API access), `UNLEASH_BACKEND_API_TOKEN` (server-side SDKs, project `default`, environment `development`) and `UNLEASH_FRONTEND_API_TOKEN` (client-side SDKs, same scope).
- Auth: send the raw token in the `Authorization` header with the prefix shown below, no `Bearer`. Admin: `Authorization: *:*.UNLEASH_ADMIN_API_TOKEN`. Backend SDK: `Authorization: default:development.UNLEASH_BACKEND_API_TOKEN`. Frontend SDK: the same form with `UNLEASH_FRONTEND_API_TOKEN`.
- Health: `GET /health` returns 200 with `{"health":"GOOD"}` and no credentials

```bash
# run with UNLEASH_URL, UNLEASH_ADMIN_API_TOKEN, UNLEASH_BACKEND_API_TOKEN and UNLEASH_DEFAULT_ADMIN_PASSWORD set; needs curl
A="Authorization: *:*.$UNLEASH_ADMIN_API_TOKEN"
B="Authorization: default:development.$UNLEASH_BACKEND_API_TOKEN"
F="agent-check-$(date +%s)"
curl -s -o /dev/null -w 'health %{http_code}\n' "$UNLEASH_URL/health"
curl -s -o /dev/null -w 'anonymous %{http_code}\n' "$UNLEASH_URL/api/admin/projects"
curl -fsS -H "$A" "$UNLEASH_URL/api/admin/projects" | grep -o '"id":"default"'
curl -fsS -H "$A" -H 'Content-Type: application/json' -d "{\"name\":\"$F\",\"type\":\"release\"}" "$UNLEASH_URL/api/admin/projects/default/features" -o /dev/null -w 'create flag %{http_code}\n'
curl -fsS -H "$A" -X POST "$UNLEASH_URL/api/admin/projects/default/features/$F/environments/development/on" -o /dev/null -w 'enable flag %{http_code}\n'
curl -fsS -H "$B" "$UNLEASH_URL/api/client/features/$F" | grep -o '"enabled":true'
curl -fsS -H 'Content-Type: application/json' -d "{\"username\":\"admin\",\"password\":\"$UNLEASH_DEFAULT_ADMIN_PASSWORD\"}" "$UNLEASH_URL/auth/simple/login" -o /dev/null -w 'admin login %{http_code}\n'
```

A fresh deploy prints `health 200`, `anonymous 401`, `"id":"default"`, `create flag 201`, `enable flag 200`, `"enabled":true` and `admin login 200`. Point any Unleash SDK at `UNLEASH_URL/api` with the backend token, or open `UNLEASH_URL` and sign in as `admin`.

## Why Deploy Unleash 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 Unleash 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 and API tokens that work on first boot, a contract block and one working script; no default `unleash4all` login and no setup step.
- **Stable credentials** - the password and tokens are the same after every redeploy.
- **State survives redeploys** - flags, projects and users live in PostgreSQL on a volume.
- **Private database** - PostgreSQL has no public domain and is reached over the private network.
- **Pinned images** - both images are pinned by digest, so a redeploy never changes the server version underneath you.

## Common Use Cases

- **Gradual rollouts and kill switches** - ship code dark, enable it for a percentage of users and turn it off without a deploy.
- **Self-hosted LaunchDarkly alternative** - feature flags, environments and targeting on infrastructure you control.
- **Agent-driven release control** - let an AI agent create, enable and audit flags through the admin REST API.

## Dependencies for Unleash Hosting

- A PostgreSQL database (included in this template, volume at `/var/lib/postgresql`).

### Deployment Dependencies

- [Unleash/unleash](https://github.com/Unleash/unleash) - upstream project
- [Unleash documentation](https://docs.getunleash.io) - SDKs, API reference and configuration


## 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) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/unleash-or-just-updated-feature-flag-ser
