cheshmhayash

command module
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: GPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cheshmhayash 👀

cheshmhayash

ci Go React TypeScript NATS

Introduction

cheshmhayash is a NATS administration dashboard and HTTP gateway. It talks to your clusters over the NATS protocol itself — the same system-account channels ($SYS.REQ.*) and JetStream API ($JS.API.*) that natscli uses — and exposes them as plain HTTP + JSON for browsers, scripts, and internal tooling.

Because every endpoint is served through a single authenticated NATS connection, you do not need the server's HTTP monitoring port (:8222) open; only the client port (:4222, or wherever) is required.

Features

Read endpoints

Responses are forwarded verbatim from the NATS server — the JSON payload is the same one you would get from the HTTP monitoring interface.

  • Cluster-wide server discovery ($SYS.REQ.SERVER.PING)
  • Targeted per-server endpoints: VARZ, CONNZ, ROUTEZ, GATEWAYZ, LEAFZ, SUBSZ, JSZ, ACCOUNTZ, HEALTHZ, STATSZ
  • Account-scoped endpoints: CONNZ, LEAFZ, SUBSZ, JSZ, INFO
  • Cluster-wide JetStream overview built from $SYS.REQ.SERVER.PING.JSZ — every account, every stream, every consumer, in a single round-trip
  • JetStream: list streams, stream info, list consumers, consumer info
Actions
  • Server: config reload, lame-duck mode, kick a connection by CID
  • JetStream: edit stream config (CodeMirror JSON editor with syntax highlighting), purge, delete, delete consumer

Destructive JetStream actions require ?confirm=true; without it the server responds with 428 Precondition Required.

HTTP API

Method Path Notes
GET /api/admin/clusters configured cluster names
GET /api/admin/clusters/{c}/servers PING discovery
GET /api/admin/clusters/{c}/servers/{endpoint} PING + endpoint (e.g. VARZ)
GET /api/admin/clusters/{c}/servers/{id}/{endpoint} targeted server query
GET /api/admin/clusters/{c}/accounts/{account}/{endpoint} account-scoped
POST /api/admin/clusters/{c}/servers/{id}/actions/reload reload config
POST /api/admin/clusters/{c}/servers/{id}/actions/lame-duck graceful drain
POST /api/admin/clusters/{c}/servers/{id}/actions/kick body: {"cid": N}
GET /api/jsm/clusters/{c}/overview cluster-wide JetStream (sys-account)
GET /api/jsm/clusters/{c}/streams?offset=N paginated
GET /api/jsm/clusters/{c}/streams/{s} stream info
PUT /api/jsm/clusters/{c}/streams/{s} full StreamConfig update
POST /api/jsm/clusters/{c}/streams/{s}/purge?confirm=true purge all messages
DELETE /api/jsm/clusters/{c}/streams/{s}?confirm=true delete stream
GET /api/jsm/clusters/{c}/streams/{s}/consumers?offset=N list consumers
GET /api/jsm/clusters/{c}/streams/{s}/consumers/{con} consumer info
DELETE /api/jsm/clusters/{c}/streams/{s}/consumers/{con}?confirm=true delete consumer
GET /healthz liveness / readiness probe

Configuration

Settings are loaded from config/default.toml, overlaid with an optional settings.toml, and finally with environment variables prefixed CHESHMHAYASH__ (double-underscore separates nested keys; list elements are indexed, e.g. CHESHMHAYASH__NATS__0__USER).

[server]
host = "0.0.0.0"
port = 1378

# Each [[nats]] block describes a cluster to administer. The `url` points
# at the client port. Administrative endpoints ($SYS.REQ.*) require the
# connection to be authenticated against the system account.
[[nats]]
name = "local"
url = "nats://127.0.0.1:4222"
# creds_file = "./sys.creds"
# user = "admin"
# password = "changeme"
# request_timeout_ms = 2000     # single-reply request timeout
# discovery_timeout_ms = 500    # window for multi-reply collection
System-account requirement

$SYS.REQ.* subjects are only routed when the connecting client is bound to the server's system account. Without system-account credentials, admin endpoints time out and the cluster-wide JetStream overview comes back empty. The per-account $JS.API.* endpoints (list streams, stream info, update/purge/delete, consumers) run against whichever account the credentials grant; they will return JetStream not enabled (err_code 10039) on a connection bound to $SYS.

Tech stack

  • Backend — Go 1.26, stdlib net/http (1.22+ pattern syntax), log/slog, nats.go v1.52, BurntSushi/toml for config.
  • Frontend — React 19 + TypeScript 6 on Vite 8. JSON editor uses CodeMirror 6 (@uiw/react-codemirror, @codemirror/lang-json, @codemirror/theme-one-dark).
  • Runtime image — gcr.io/distroless/static-debian12:nonroot (~10 MB).

Running

Local
# Backend
go run .                              # serves API + built SPA on :1378

# Frontend (dev — separate terminal)
cd frontend && npm install
npm run dev                           # HMR on :5173, /api proxied to :1378

For a single-binary production build:

cd frontend && npm install && npm run build
go build -o ./bin/cheshmhayash .
./bin/cheshmhayash                    # http://127.0.0.1:1378
Docker
docker build -t cheshmhayash .
docker run --rm -p 1378:1378 \
    -v "$PWD/settings.toml:/app/settings.toml:ro" \
    cheshmhayash
Kubernetes (Helm)

The chart lives in chart/cheshmhayash-chart/ and is published as an OCI artifact to GHCR on every tagged release.

# install from GHCR
helm install panel \
  oci://ghcr.io/1995parham/cheshmhayash-chart \
  --version 1.0.0 \
  -f my-values.yaml

# or from a local checkout
helm install panel chart/cheshmhayash-chart -f my-values.yaml

Clusters and authentication mode are declared in values.yaml. Each entry becomes a [[nats]] block. auth accepts exactly one of three modes — userPassword (chart-managed Secret), existingSecret (env vars from an external Secret), or credsFileSecret (a .creds file mounted read-only):

clusters:
  - name: prod
    url: nats://nats.nats.svc.cluster.local:4222
    auth:
      existingSecret:
        name: nats-prod-creds
        userKey: user
        passwordKey: password

Development

# backend
go fmt ./...
go vet ./...
go test -race ./...
golangci-lint run

# frontend
cd frontend
npm run typecheck
npm run lint
npm run build

A docker-compose.yml is included for spinning up a local NATS server with monitoring enabled, so the dashboard has something to talk to.

License

Free and open source forever, just like NATS. Released under the MIT License — see the file for details.


Built with ❤️ by @1995parham · 1995parham/cheshmhayash

Documentation

Overview

cheshmhayash is a NATS administration dashboard exposed over HTTP. It reuses one long-lived NATS connection per configured cluster and proxies requests through `$SYS.REQ.*` and `$JS.API.*` so the same auth model natscli uses also applies here.

Directories

Path Synopsis
internal
config
Package config loads runtime settings via koanf in the layered pattern: struct defaults → settings.toml → CHESHMHAYASH__* environment variables.
Package config loads runtime settings via koanf in the layered pattern: struct defaults → settings.toml → CHESHMHAYASH__* environment variables.
handler
Package handler exposes cheshmhayash's HTTP API.
Package handler exposes cheshmhayash's HTTP API.
natsx
Package natsx wraps the NATS client with cheshmhayash's request patterns: a single-reply request_json for targeted endpoints and a multi-reply discover for PING-style fan-out.
Package natsx wraps the NATS client with cheshmhayash's request patterns: a single-reply request_json for targeted endpoints and a multi-reply discover for PING-style fan-out.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL