mirror of
https://github.com/ajvpot/meshexplorer.git
synced 2026-08-07 09:02:44 +02:00
637ee470c721eddc7a8a8ace25c9b3ba95940b4a
Tighten request validation so invalid input is rejected at the edge with a clear invalid_argument instead of silently producing empty results or opaque ClickHouse 500s. Grounded against live data (pubkeys are exactly 64 hex, channel_hash is one byte, before/after are DateTime64 cursors, etc.). - Add reusable predefined string rules in rules.proto (proto2, required to extend protovalidate's rule messages): hex64, datetime64, region. The validator registers these via a registry in createValidator(). - public_key / origin_pubkey: exact 64-hex (hex64) instead of min_len 10. - chat before/after: DateTime64 format (datetime64); channel_id: hex, max_len 2. - private_keys: bounded list + base64/hex charset per element. - node_types: bounded list + per-item length; SearchNodes requires >=1 query. - region: length+charset bound (hex64/datetime64/region rules), now also on the four StatsService requests which had no validation. - map/neighbors: message-level CEL enforcing bbox ordering (min_lat<=max_lat, min_lng<=max_lng). Verified end-to-end against the Docker stack: all unary + server-streaming validation rules reject bad input and accept valid input.
MeshExplorer
A real-time map, chat client, and packet-analysis tool for MeshCore mesh
networks. This repository ships the whole stack so it can be brought up with a
single docker compose up:
| Component | Path | Description |
|---|---|---|
| Web app | meshexplorer/ |
Next.js UI + API (map, chat, stats, packet analysis) |
| Ingest + DB | ingest/ |
Go MeshCore MQTT→ClickHouse ingest, ClickHouse image, and SQL migrations |
| Discord relay | meshexplorer/ (Dockerfile.bot) |
Optional bot that relays MeshCore channel messages to Discord |
| Grafana | grafana/ |
Dashboards with a pre-provisioned ClickHouse datasource (read-only user), on 127.0.0.1:3000 |
Architecture
MQTT brokers (you configure)
│
▼
┌──────────────┐ ┌──────────────┐
│ meshcoreingest│──▶│ ClickHouse │◀── migrate (one-shot, applies schema)
└──────────────┘ └──────┬───────┘
│ (readonly user)
┌──────────┴──────────┐
▼ ▼ ▼
meshexplorer discord-bot grafana
(web UI :3001) (--profile bot) (:3000)
Quick start
Requirements: Docker + Docker Compose.
cp .env.example .env
# Edit .env — at minimum set:
# CLICKHOUSE_PASSWORD (read/write user, used by ingest + migrations)
# MQTT_BROKERS (JSON array of meshcore MQTT brokers to ingest from)
# Optional, for the Discord relay: DISCORD_WEBHOOK_URL (+ run with --profile bot)
docker compose up --build
Then open http://localhost:3001.
Startup order is handled automatically: ClickHouse becomes healthy → migrate
applies the schema and exits → meshcoreingest and meshexplorer start.
To also run the Discord relay:
docker compose --profile bot up --build
Configuration
All configuration is via environment variables in .env (see
.env.example for the full list and defaults). Highlights:
- ClickHouse — two accounts. The read/write
defaultuser (CLICKHOUSE_PASSWORD) is used by the ingest daemon and the migration runner; thereadonlyuser (CLICKHOUSE_READONLY_PASSWORD) is used by the web app and the Discord bot. ClickHouse is only published to127.0.0.1for debugging and is otherwise reachable only on the internalmeshnetnetwork. - MQTT_BROKERS — a JSON array; each entry is
{ "url", "username", "password", "topics" }(topicsdefaults to["meshcore/#"]). The ingest daemon exits with a clear error if this is unset, so configure at least one broker.
Development
Each component can be run on its own:
- Web app: see
meshexplorer/README.md(npm install && npm run dev). - Ingest: see
ingest/README.md(go build ./...).
Security notes
.envis gitignored — keep real credentials out of version control.- If you previously used the bundled defaults, rotate any secrets before going to production.
Description
Languages
TypeScript
83.6%
Go
10.1%
JavaScript
3.7%
CSS
1.6%
Dockerfile
0.8%
Other
0.2%