Meshly Docs
Getting Started

Quick Start

Write a client.toml, start meshly-core-server, and tunnel a local service between two machines in a few minutes.

You need three processes: one server (the control plane + relay) and two clients — one that exposes a service, one that consumes it. On a single machine, give each process its own [common].identity_path, otherwise they share the default key file and end up with identical NodeIDs.

1. Print the server's NodeID

On the host that will run the server:

meshly id
# meshly-core node id: <64 hex chars>

2. Start the server

# server.toml
[common]
identity_path = "./keys/server.key"

[common.logging]
level = "info"

[[group]]
name        = "homelab"
group_token = "long-random-string-shared-with-clients"

[heartbeat]
interval_secs = 60
timeout_secs  = 600
meshly-core-server -c ./server.toml

Top-level keys must come before any [common.*] subtable — TOML binds later keys to the subtable that precedes them.

3. Expose a local service (provider)

# client-A.toml
server_node_id = "<server NodeID from step 1>"
group_token    = "long-random-string-shared-with-clients"

[common]
identity_path = "./keys/provider.key"

[common.logging]
level = "info"

[[expose]]
name          = "web"
local_addr    = "127.0.0.1:18081"
shared_secret = "web-secret"
meshly run -c client-A.toml

4. Consume it (consumer)

# client-B.toml
server_node_id = "<same server NodeID>"
group_token    = "long-random-string-shared-with-clients"

[common]
identity_path = "./keys/consumer.key"

[common.logging]
level = "info"

[[consume]]
name          = "web"
local_bind    = "127.0.0.1:19090"
shared_secret = "web-secret"

[reconnect]
initial_backoff_ms = 50
max_backoff_ms     = 5000
prefer_direct      = true
meshly run -c client-B.toml

5. Verify

curl http://127.0.0.1:19090/    # hits host-A's local 18081

Inspect the live state as JSON — handy for scripts and CI:

meshly run -c client-B.toml --status --status-timeout-secs 10

--status exits 0 when the control plane reached Registered, 1 otherwise. Resolved consumer addresses (including ephemeral ports) appear under runtime.consumers.<name>.local_addr.

Rules worth remembering

  • Service names must match [a-z0-9-]{1,32} and share one namespace across every client-side table — two entries with the same name in different tables is a config error, because both would register the same ALPN.
  • Shared secrets are per service and must match on both sides. They are bearer credentials: anyone holding one can reach the service.
  • Identity files must be distinct per process on the same machine.
  • The client sends a control-plane heartbeat every 60s; keep the server's heartbeat.timeout_secs comfortably above that (≥ 600s is a good default).

Next: Services for static hosting and SSH, and Pairing to move a service to another device with a QR code instead of hand-editing TOML.

On this page