{"id":49228474,"url":"https://github.com/lexvicacom/monoblok","last_synced_at":"2026-05-24T18:01:12.602Z","repository":{"id":352727263,"uuid":"1216109645","full_name":"lexvicacom/monoblok","owner":"lexvicacom","description":"monoblok is a NATS core-style messaging broker with a built-in stream processing DSL","archived":false,"fork":false,"pushed_at":"2026-05-15T20:35:16.000Z","size":11344,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-05-15T23:29:59.150Z","etag":null,"topics":["data-streaming","dsl","edge","edge-computing","edn","financial-data","industrial-iot","iot","market-data","monoblok","nats","pubsub","stream-processing","telemetry","ticker-data","trading-servers"],"latest_commit_sha":null,"homepage":"https://alexjreid.dev/tags/monoblok/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lexvicacom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-20T15:19:54.000Z","updated_at":"2026-05-15T20:34:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lexvicacom/monoblok","commit_stats":null,"previous_names":["lexvicacom/monoblok"],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/lexvicacom/monoblok","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexvicacom%2Fmonoblok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexvicacom%2Fmonoblok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexvicacom%2Fmonoblok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexvicacom%2Fmonoblok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lexvicacom","download_url":"https://codeload.github.com/lexvicacom/monoblok/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexvicacom%2Fmonoblok/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33444704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-24T13:13:05.286Z","status":"ssl_error","status_checked_at":"2026-05-24T13:13:03.728Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-streaming","dsl","edge","edge-computing","edn","financial-data","industrial-iot","iot","market-data","monoblok","nats","pubsub","stream-processing","telemetry","ticker-data","trading-servers"],"created_at":"2026-04-24T10:05:46.252Z","updated_at":"2026-05-24T18:01:12.596Z","avatar_url":"https://github.com/lexvicacom.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# monoblok\n\nSignal conditioning, transformation, and routing in a NATS-native message processor.\n\n\u003e**monoblok speaks NATS.**\n\u003e\n\u003ePoint existing publishers at it or have it subscribe to existing subjects. Declare the processing rules you need, and monoblok republishes clean, actionable subjects for subscribers.\n\u003e\n\u003e _Rounding. Deadbands. Squelch. Aggregation. Moving averages. OHLC. Derived alerts._\n\u003e\n\u003e Fix noisy raw streams once, not in every subscriber.\n\n## Rationale\n\nIt is not uncommon for systems to contain some _caretaker_ services that subscribe to ingress NATS subjects to clean up and republish a raw stream before the real business starts. This might include rounding, dedup, deadband, JSON demux, OHLC bars, threshold alerts and so on. High velocity or miniscule changes don't always have value downstream. monoblok lets you declare that tidying work once, leveraging efficient implementations of common tasks as rules at the broker, instead of writing _rounding logic_ N times in N services.\n\n**Declare it once, as rules, at the edge.**\n\n![monoblok round and squelch demo](./docs/monoblok-round-squelch-fixed.gif)\n\n\nRules live in [patchbay](./docs/patchbay.md), a small DSL which can be expressed as YAML, EDN or JSON. A walked example lives in [patchbay.edn](./patchbay.edn). You can also [write patchbay files as YAML](https://github.com/lexvicacom/monoblok/blob/main/examples/demo.yml). \n\n\u003ca href=\"https://lexvicacom.github.io/monoblok/show-n-tell/moonwell_linkedin_demo.html\" target=\"_blank\" rel=\"noopener noreferrer\"\u003epatchbay also lends itself well to help from coding assistants\u003c/a\u003e when fed [AGENTS_PATCHBAY.md](https://github.com/lexvicacom/monoblok/blob/main/docs/AGENTS_PATCHBAY.md) (to be honest the agent instructions are human-parseable if you prefer a succinct primer. There is a fuller [patchbay guide](https://github.com/lexvicacom/monoblok/blob/main/docs/patchbay.md) and  [cheatsheet](https://github.com/lexvicacom/monoblok/blob/main/docs/patchbay-cheatsheet.md).\n\n\n#### Common ways of running monoblok:\n- **Tap into existing NATS:** monoblok subscribes to selected subjects on your NATS environment, treats them as private patchbay input, then emits back only the cleaned or derived subjects your rules choose.\n- **Signal conditioning front door:** publishers send raw events to monoblok, monoblok cleans them, then forwards selected subjects to a  NATS cluster.\n- **Standalone broker:** NATS clients connect directly to monoblok for lightweight NATS-core pub/sub with signal conditioning built in.\n\n### Tiny and fast\nmonoblok is written in C with libuv and builds on Linux and macOS. It aims to be simple, lightweight and **fast**, even on entry level/shared hardware. Smoke tests and load checks are part of the build; dedicated benchmark helpers live in [scripts/](./scripts). The [saved benchmark runs](./bench-results) span up to **2-18 million msgs/sec** across a 2-core ARM VPS, an 8-core x86_64 VPS, and an Apple Silicon M4 Mac mini for simple publish and fan-out workloads. Treat those numbers as directional samples/trends and not capacity promises in the real world. See [running tests](#running-tests) for tests that exercise the router and parser without network.\n\n### Read more\n[tinyblok](https://github.com/lexvicacom/tinyblok) is an implementation for microcontrollers relaying cleaned sensor data into NATS.\n\nSee [Overview](./docs/overview.md), [Patchbay](./docs/patchbay.md), and the runnable files in [examples/](./examples/) to better get a feel. There's a [demo server](https://github.com/lexvicacom/monoblok/blob/main/docs/demo.md). Also, there's [the introductory blog post](https://alexjreid.dev/posts/monoblok/) [and friends](https://alexjreid.dev/tags/monoblok/).\n\n![monoblok deployment modes](./docs/infographic.png)\n\n## Run it\n\n### Binary\n\n```sh\ncurl -fsSL https://raw.githubusercontent.com/lexvicacom/monoblok/main/scripts/start.sh | bash\n```\nThe [release helper](./scripts/start.sh) downloads the latest monoblok (macOS/Linux) and extracts it into the current directory. To run the unpacked binary:\n\n```sh\n./monoblok-*/monoblok --port 14222 --patchbay ./monoblok-*/patchbay.edn\n```\n\nThe directory contains runnable examples. Run the `.sh` files.\n\nTo add as a service on systemd Linux, run `scripts/install-systemd.sh`.\n\n### Container\n\nMulti-arch image:\n\n```sh\ndocker run --rm -p 14222:14222 ghcr.io/lexvicacom/monoblok:latest --port 14222\n```\n\n### Build\n\n```sh\ncmake -S . -B build -DCMAKE_BUILD_TYPE=Release\ncmake --build build\n./build/monoblok --port 14222 --patchbay patchbay.edn\n```\n\nCompiles cleanly on macOS and Linux. Dependencies are vendored. System `openssl` required.\n\n## Running tests\n\n```sh\ncmake -S . -B build\ncmake --build build\nctest --test-dir build --output-on-failure\n```\n\nFast integration smoke:\n\n```sh\ncmake --build build --target smoke\n```\n\n`smoke` runs the TCP server smoke, patchbay `soundcheck`, `load-smoke`, and\nthe larger `load-soak` profile.\nThe subchecks can also be run directly:\n\n```sh\ncmake --build build --target soundcheck\ncmake --build build --target load-smoke\ncmake --build build --target load-soak\n```\n\n`load-smoke` starts a temporary daemon and verifies exact TCP fan-out plus\nderived `moving-avg`, `moving-sum`, and `count!` streams. `load-soak` runs the\nsame check with a heavier subscriber/message profile.\n\nBenchmark helpers are separate from the test targets because they depend on the\nNATS CLI, and the comparison script uses `nats-server` when available:\n\n```sh\nscripts/bench.sh\nscripts/bench-with-nats-server.sh\n```\n\nSaved sample output lives in [bench-results/](./bench-results). On Linux these\nscripts default to monoblok's opt-in libuv io_uring path to match the saved\nruns; pass `--epoll` to benchmark the production-default epoll path.\n\n## Feedback\n\nI'd **love** to hear from anyone who tries monoblok out and finds it useful.\n\nIt's open source, without restrictions (per MIT license re attribution) or paid commercial features. However, [my company](https://lexvica.com) provides services around monoblok. I'd be happy to learn about your environment, requirements and work with you to deliver a proof of concept, case study or complete solution.\n\n[Drop me a line](mailto:alex@lexvica.com).\n\n## License\n\nMIT. See `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexvicacom%2Fmonoblok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flexvicacom%2Fmonoblok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexvicacom%2Fmonoblok/lists"}