---
title: "Deploy Swagger UI"
description: "Interactive OpenAPI docs with your specs kept on a volume, pinned v5.35.1"
category: "Other"
url: https://railway.com/deploy/swagger-ui-1
---

# Deploy Swagger UI

Interactive OpenAPI docs with your specs kept on a volume, pinned v5.35.1

**[Deploy Swagger UI on Railway](https://railway.com/template/swagger-ui-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/swagger-ui-1/manifest.json

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

## Template content

### Swagger UI https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/swagger.png

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

## Documentation

# Deploy and Host Swagger UI on Railway

Swagger UI is SmartBear's open-source web page that turns an OpenAPI (Swagger) specification into interactive API documentation. Readers see every endpoint, its parameters and response schemas, and can send real requests from the browser with "Try it out". It supports OpenAPI 2.0, 3.0 and 3.1 in JSON or YAML.

## About Hosting Swagger UI

Swagger UI is a static web app served by nginx, so it needs no database. The hard part is giving it specs to show and keeping them. This template builds the official `swaggerapi/swagger-ui` v5.35.1 image, pinned by digest, from a public GitHub repo, with a small wrapper. Spec files live on a Railway volume at `/data/specs`, are served at `/specs/` and appear in the "Select a definition" menu. You upload or delete them with an HTTP request protected by a generated password. A `/healthz` endpoint backs Railway's health check, and the public domain points at port 8080. Nothing is prompted at deploy.

## Common Use Cases

* Publish interactive documentation for your own REST APIs, one spec per service, in one place
* Give partners or front-end developers a stable URL where they can read and try an API
* Review OpenAPI files from CI: upload each build's spec with one `curl` command

## Dependencies for Swagger UI Hosting

* The official Swagger UI image (`swaggerapi/swagger-ui:v5.35.1`, pinned by digest), built from the template's GitHub repo
* A Railway volume mounted at `/data` for your spec files

### Deployment Dependencies

* Swagger UI on GitHub: https://github.com/swagger-api/swagger-ui
* Release v5.35.1: https://github.com/swagger-api/swagger-ui/releases/tag/v5.35.1
* Docker usage and configuration: https://github.com/swagger-api/swagger-ui/blob/v5.35.1/docs/usage/installation.md
* Template repo (Dockerfile, wrapper, changelog): https://github.com/aalfath/swagger-ui-railway-template

### Implementation Details

What you get: one public service, "Swagger UI", with a Railway domain, a volume at `/data` and an example spec that documents the upload API.

After deploy, open the service's Variables tab and copy `SPECS_PASSWORD` (generated for you). Upload a spec as user `admin`:

```sh
curl -u admin:SPECS_PASSWORD -T openapi.yaml https://YOUR-DOMAIN/specs/openapi.yaml
curl -u admin:SPECS_PASSWORD -X DELETE https://YOUR-DOMAIN/specs/example-openapi.yaml
```

Reload the page and pick the spec from the menu at the top right. Reading `/specs/` is public; writing needs the password.

Variables in the template:

* `SPECS_PASSWORD`: generated upload password (empty disables uploads)
* `PORT`: `8080`, the port the domain points at

Optional variables you can add later:

* `DOCS_PASSWORD` (and `DOCS_USER`, default `viewer`): put the whole site behind a login; `/healthz` stays open
* `URL`, `URLS` or `SWAGGER_JSON_URL`: show specs hosted elsewhere instead of the `/specs/` list
* Any of upstream's configuration variables, such as `DOC_EXPANSION`, `DEEP_LINKING`, `PERSIST_AUTHORIZATION` or `OAUTH_CLIENT_ID`

"Try it out" sends requests from the visitor's browser, so the API you document must allow CORS from your Swagger UI domain.

Updates: when we bump the pinned version, Railway shows you an "update available" notice. Read `CHANGELOG.md` in the repo (breaking changes first) and apply it when you're ready. Your spec files stay on the volume.

## Why Deploy Swagger UI 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 Swagger UI 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/swagger-ui-1
