NATS-compatible server with JetStream, written in MoonBit
Status: early development. The protocol core and a minimal native server are working: a client can connect, PING/PONG, SUB, PUB, and receive MSG frames, including wildcard and queue-group subscriptions. JetStream, KV, monitoring and the nats CLI acceptance script are the next milestones. The plan and scope are tracked in docs/acceptance.md.
| Area | v1 |
|---|---|
| Core NATS | INFO/CONNECT/PUB/HPUB/SUB/UNSUB/MSG/HMSG/PING/PONG/+OK/-ERR, headers, wildcards, queue groups, request/reply, no_responders, auth, limits, monitoring |
| JetStream | single-node streams, retention, dedupe, push/pull consumers, ACK/NAK/WPI/TERM, KV |
| Interfaces | moonnatsd CLI, embedded @natsd.start(...), JSON status, monitoring endpoints |
| Out of scope | clustering/Raft, leaf nodes, gateways, JWT/nkey, multi-tenancy, mirrors/sources, object store, encryption at rest |
moon check --deny-warn
moon test --target wasm-gc # pure core, no native toolchain required
moon test --target native # protocol + TCP integration tests
moon run cmd/moonnatsd # listens on 127.0.0.1:4222nats -s nats://127.0.0.1:4222 sub hello
nats -s nats://127.0.0.1:4222 pub hello worldsrc/core pure protocol model, parser, subject trie, delivery (no I/O)
src/server native listener/connection runtime (async)
src/store WAL/block storage and recovery (planned)
src/jetstream stream/consumer state machines (planned)
src/kv KV facade over JetStream (planned)
src/cli command line and embedded APIInstall
Download zipNATS-compatible server with JetStream, written in MoonBit