NATS Cluster
3-node cloud-native messaging - pub/sub, request/reply, and JetStream streams - at ~30 MB per node.
One-click deploy, from $7/mo on a Miget plan.
NATS is messaging stripped to its fast, essential core: subject-based pub/sub, request/reply, and - via JetStream - persistent streams, work queues, and key-value/object stores. It is astonishingly light (tens of megabytes per node) and astonishingly quick, which is why it underpins so much cloud-native infrastructure.
This template runs a 3-node cluster on the stock image, configured entirely with command flags (the same no-custom-build approach as the mongodb replica set). All three nodes share one all-peers routes list - NATS ignores its own self-route - so the mesh forms by gossip with no seed asymmetry, and JetStream replicates across all three.
Internal-only by design: it speaks raw TCP on 4222, and apps in the project connect there directly.
Upstream project: NATS
#what you get
- Pub/sub, request/reply, and queue groups
- JetStream: persistent streams, work queues, KV and object stores
- 3-node cluster via flags - stock image, no custom build
- Replication factor 3 across per-node volumes
- Monitoring endpoint + health checks on :8222
- Apache-2.0; ~30 MB per node
#topology
| Service | Role | Public |
|---|---|---|
| nats-0..2 | cluster nodes (client :4222, cluster :6222, monitor :8222) | no |
#miget sizing
// this stack needs
768 MiB RAM · 15 GB disk · 3 services
Nodes idle in tens of megabytes; 256 MiB each is generous. JetStream volume size is the dial - raise it as streams retain more.
Hobby - recommended fit
$7/mo
1 vCPU · 1 GiB · 25 GiB disk
Headroom for your own apps: 2 GiB at $13/mo
Professional - production
$43/mo
2 vCPU · 4 GiB · 25 GiB disk
Dedicated resources, production SLOs - plan details
One Miget plan is a fixed pool of compute - the whole stack (managed databases included) deploys inside it, and anything left over runs your other apps. No per-service or per-seat math.
#vs. other PaaS
Estimated monthly cost of running this exact stack (768 MiB RAM, 15 GB disk, 3 containers) elsewhere, from published June 2026 rates.
| Platform | Est. monthly | Notes |
|---|---|---|
| Miget ★ | $7 flat | compose stacks first-class: one deploy, dedicated vCPU, managed Postgres/Valkey, volumes and TLS all included in the plan |
| Heroku | ~$38 | no volumes; nothing between 1 GB ($50) and 2.5 GB ($250) dynos - 2 GB containers cost far more than shown |
| Render | ~$25 | per-service instances (0.5 GB $7, 2 GB $25) - every container is its own paid service |
| DO App Platform | ~$20 | no persistent volumes - stateful containers need managed DBs/Spaces (base $5 Spaces included here) |
| Railway | ~$10 | usage-based ($10/GB RAM-mo); vCPU billed separately at $20/vCPU-mo on top |
| Fly.io | ~$8 | cheapest sticker price - but burstable shared CPUs (1/16 core; dedicated vCPUs cost ~2-3×), no compose deploys (one app per container, manual wiring), managed DBs billed extra |
Estimates assume RAM fully allocated at published on-demand rates - and sticker price isn't the whole comparison: the cheaper rows buy burstable shared CPUs, per-service wiring instead of a compose deploy, and managed databases billed separately. Heroku and DO App Platform have no persistent volumes at all - stateful stacks like this one need workarounds there.
#deploy it
On Miget
- Create a Compose Stack in app.miget.com pointing at the templates repository
- Set the stack path to
nats - No required variables - deploy as-is
- Deploy. Miget layers
compose.miget.yaml(RAM, privacy, volumes, managed services) automatically
Locally first?
Every template is portable, vanilla Docker Compose - the Miget overrides are ignored locally:
git clone https://github.com/deployable-sh/stacks
cd miget-compose-templates/nats
docker compose up -d Same files, same behavior. The template README covers connection strings and scaling notes.
#faq
NATS, Kafka, or RabbitMQ?
NATS for low-latency cloud-native messaging and lightweight persistent streams with the smallest footprint; Kafka/Redpanda for high-throughput, long-retention event logs; RabbitMQ for classic AMQP work queues with mature routing. All are in this catalogue - NATS is the one you reach for when simplicity and latency matter most.
Is JetStream production-ready in this setup?
Yes - three nodes give JetStream a quorum for replication-factor-3 streams, surviving any single node loss. Each node persists to its own volume; declare streams with R3 and writes are durable across the cluster.
How do apps connect?
From the same project: nats://nats-0:4222 (any node accepts connections; list all three for failover). The client port is raw TCP and never exposed publicly. Add --user/--pass flags if you need auth.
Ship NATS Cluster today
One compose stack, 768 MiB of RAM, from $7/month flat, and it runs on your laptop with the same files.