Soup to
NATS.

A message-processing sidecar for NATS.

Round readings, suppress repeats, match patterns and publish alerts before messages reach your subscribers. Combine built-in operators into rules with the agent-friendly Patchbay DSL for sensor feeds, market data and other potentially unwieldy message streams.

Runs on macOS, Linux, Raspberry Pi and ESP32.

Raw readings
→ (round 1) → (squelch) →
Useful output Full example

Process streams with patchbay

Use Patchbay to combine built-in forms into a processor tailored to your streams, with a few lines of configuration. Stateful forms keep values between messages for moving averages, deduplication and threshold alerts. Browse all available forms.

Not sure where to start? Patchbays can be written by AI: the patchbay-authoring skill turns Codex and Claude into qualified Patchbay experts. 🤖

patchbay.edn
(on "sensors.*"
  (-> payload-float
      (round 1)
      (squelch)
      (publish! (subject-append "stable"))))
Patchbay reference

Round readings and suppress repeats

Round to one decimal place, then publish only when that rounded value changes.

sensors.temp
21.0121.0221.0421.12
sensors.temp.stable
21.021.1

Example values · See real messages

Chain operators with ->, add conditions with when and send results with publish!. Browse the examples · Watch a coding assistant build a patchbay

Things to build
with monoblok

What you do with monoblok is up to you. Patchbay is a small language, not a fixed feature list, so these are three places to start.

All examples

A NATS firewall

Protect your real NATS environment. Scan payloads and hold back outliers before messages reach it.

Three ways to
run monoblok

Project README
Publishers send readings through monoblok to NATS, which delivers them to subscribers NATS monoblok PublishersSubscribers

Front door

Publish raw messages to an isolated monoblok instance. Its rules produce clean messages, and export relays only those output subjects to NATS for subscribers.

Publishers send messages to NATS for subscribers; monoblok subscribes to its subjects and publishes processed results back Publishers NATS Subscribers ImportExport monoblok

Sidecar

Use import to read existing NATS subjects into monoblok, then export to send processed results back on separate subjects. Publishers and subscribers stay connected to your cluster.

NATS publishers and subscribers connect directly to monoblok monoblok PublishersSubscribers

On its own

monoblok is a lightweight broker with processing built in. Connect your NATS clients directly to monoblok.

Fast

Written in C with libuv, with rules and cached values held in memory.

  • Core processing runs on one thread, so behaviour stays predictable under load.
  • Saved benchmark runs peak at 2–18 million messages a second for simple publish and fan-out workloads, from a 2-core ARM VPS to an Apple Silicon M4 Mac mini.
  • One small binary for Linux (x64 and ARM64) or macOS on Apple Silicon, plus Docker images.

Throughput alone cannot capture NATS’ decade-plus of production maturity. Test your own workload to confirm capacity and latency.

Flexible

Write rules in EDN, YAML or JSON using a rich library of built-in forms.

NATS native

monoblok complements NATS rather than replacing it.

Install

Download a release binary, use the script below or run the Docker image.

macOS or Linux (including Raspberry Pi)
curl -fsSL https://raw.githubusercontent.com/lexvicacom/monoblok/main/scripts/start.sh | bash

Or run with Docker

docker run --rm -p 14222:14222 ghcr.io/lexvicacom/monoblok:latest --port 14222
tinyblok terminal showing a TLS connection to NGS above the Synadia Cloud dashboard showing its active connection and sent messages
tinyblok connected to NGS / Synadia Cloud.