Skip to main content
This quickstart guide will help you get NATS Server up and running and send your first message in just a few minutes.

Prerequisites

No special prerequisites are required. NATS Server is a single binary with no external dependencies.

Get started

1

Install NATS Server

The fastest way to get started is using Docker:
Alternatively, download the binary for your platform from the GitHub releases page.For other installation methods, see the installation guide.
2

Start the server

Start NATS Server with default settings:
You should see output indicating the server is running:
The default client port is 4222. The monitoring port is 8222 when enabled with -m 8222.
3

Install the NATS CLI (optional)

For testing, install the NATS CLI tool:
The NATS CLI is also included in the Docker image at /bin/nats.
4

Subscribe to a subject

Open a new terminal and subscribe to a test subject:
You should see:
Leave this terminal open to receive messages.
5

Publish a message

In another terminal, publish a message:
In the subscriber terminal, you should see the message:
Try publishing multiple messages and watch them appear in real-time in the subscriber terminal!
6

Verify server status

Check the server monitoring endpoint:
This returns JSON with server statistics including connections, message counts, and memory usage.
The monitoring endpoint must be enabled with -m 8222 when starting the server, or configured in the configuration file with monitor_port: 8222.

Common server options

Here are some commonly used command-line options:
For a complete list of options, run nats-server --help or see the configuration reference.

Testing with client libraries

NATS has client libraries for over 40 programming languages. Here’s a quick example in a few popular languages:

Next steps

Now that you have NATS Server running, explore these topics:

Configuration

Learn how to configure NATS Server for production

JetStream

Enable persistence and streaming with JetStream

Clustering

Set up high availability with clustering

Security

Secure your NATS deployment

Troubleshooting

Ensure the server is running and listening on the correct port (default 4222). Check firewall settings if connecting from a different machine.
Check if another process is using port 4222. Use nats-server -p 4223 to use a different port. Enable debug logging with -D for more information.
Verify the subscriber is connected before publishing. Check that subject names match exactly (they are case-sensitive).

Get help

If you need assistance: