---
title: "Deploy NATS Server"
description: "High-performance messaging system with JetStream"
category: "Other"
url: https://railway.com/deploy/nats-server
---

# Deploy NATS Server

High-performance messaging system with JetStream

**[Deploy NATS Server on Railway](https://railway.com/template/nats-server)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/nats-server/manifest.json

- **Creator:** zer0person's Projects
- **Category:** Other
- **Total deploys:** 1

## Template content

### NATS Server

- **Image:** nats:alpine
- **Start command:** `sh -c 'exec nats-server -js -sd /data -m 8222 --auth "$NATS_TOKEN"'`
- **Public domain:** Yes

## Documentation

# Deploy and Host NATS Server on Railway

[NATS Server](https://github.com/nats-io/nats-server) is a lightweight, high-performance messaging system for microservices, IoT and edge, with persistence through JetStream.

## About Hosting NATS Server

This template runs the official `nats:alpine` image with JetStream enabled and a persistent volume at `/data`. Client connections use the Railway private network on port 4222 and require the generated `NATS_TOKEN`. The public URL serves the monitoring endpoint (port 8222, `/healthz`, `/varz`).

## Common Use Cases

- Messaging between services in the same Railway project
- Streams and durable consumers with JetStream
- Key-value and object storage on top of NATS

## Dependencies for NATS Server Hosting

- One service with a volume; nothing else

### Deployment Dependencies

- [NATS Server on GitHub](https://github.com/nats-io/nats-server)
- [Docker image](https://hub.docker.com/_/nats)

## Why Deploy NATS Server on Railway?

Railway gives you a public HTTPS URL, a persistent volume and automatic restarts with no server to maintain. Other services connect to `nats://${{NATS_TOKEN}}@nats-server.railway.internal:4222` using a reference to this service's token variable.


## 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/nats-server
