Replace the per-request argMax/GROUP-BY views with insert-triggered (incremental) materialized views so map node positions, node search, and public-channel chat read pre-aggregated state instead of re-scanning all of meshcore_packets on every query. - 005: meshcore_adverts_latest_state (AggregatingMergeTree of argMaxState/ min/maxState) + incremental MV + backfill; meshcore_adverts_latest becomes a -Merge view with the identical column contract. Node search reads it directly; map (unified_latest_nodeinfo) is unchanged. - 006: meshcore_public_channel_messages_raw, a decoded payload_type=5 MergeTree keyed (channel_hash, ingest_timestamp); chat dedups by message_id at read time over a timestamp-bounded scan. Streaming/pagination push channel+cursor onto the primary key. - Neighbor-edge MVs stay hourly REFRESH (they read the preserved view). Verified against full prod data (14.5M rows): exact parity (0 mismatches) and 5-9x faster reads with no regressions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
MeshExplorer
MeshExplorer is a real-time map, chat client, and packet analysis tool for MeshCore mesh networks. It enables users to visualize mesh nodes on a map, communicate via chat, and analyze packet data in real time.
This directory contains the web app only. For the full stack (ClickHouse, migrations, ingest, and this app) see the root README and the unified
docker composesetup.
Features
- Real-time map of mesh network nodes (MeshCore)
- Integrated chat client for mesh channels
- Packet analysis and inspection tools
- Customizable map layers and clustering
- Modern, responsive UI
Getting Started
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
Environment Variables
ClickHouse Database Configuration
The application connects to ClickHouse using the following environment variables:
CLICKHOUSE_HOST- ClickHouse server hostname (default:localhost)CLICKHOUSE_PORT- ClickHouse server port (default:8123)CLICKHOUSE_USER- ClickHouse username (default:default)CLICKHOUSE_PASSWORD- ClickHouse password (default:password)
NEXT_PUBLIC_API_URL
This environment variable allows you to override the API base URL for frontend development purposes. When set, all API calls will be made to the specified URL instead of using relative URLs.
Use case: This is useful when you want to develop the frontend without direct access to the ClickHouse database, by pointing to a remote API endpoint.
Example:
NEXT_PUBLIC_API_URL=https://map.w0z.is
Important: When this environment variable is set, the local API routes (/api/*) will not work. Make sure the remote API endpoint provides the same API structure and endpoints.
Default behavior: If not set, the application uses relative URLs and works with the local Next.js API routes.
CORS Support
The application includes middleware (middleware.ts) that automatically adds CORS headers to all API routes. This allows:
- Cross-origin requests from localhost to production APIs
- Cross-protocol requests (HTTP on localhost to HTTPS in production)
- Preflight OPTIONS requests are handled automatically
The middleware applies the following CORS headers to all /api/* routes:
Access-Control-Allow-Origin: *Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONSAccess-Control-Allow-Headers: Content-Type, Authorization, X-Requested-WithAccess-Control-Allow-Credentials: true
Learn More
- Next.js Documentation - learn about Next.js features and API.
- MeshCore - mesh network firmware
Docker Deployment
This app is deployed as part of the unified stack at the repository root. From the repo root:
cp .env.example .env # then edit
docker compose up --build
The web app is served on http://localhost:3001. ClickHouse, migrations, and the MeshCore ingest are started for you. See the root README for the full list of services and environment variables.
Deploy
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out the Next.js deployment documentation for more details.