devmesh 0.1.4

Peer-to-peer dev mesh for sharing local services across machines
Documentation
DevMesh Roadmap – Advanced Engineering Features
================================================

PHASE 1: DX (Developer Experience) – Quick wins
------------------------------------------------

1.1 devmesh up
   Start proxy + spawn all configured services in one command.
   Like `docker compose up` but for devmesh.toml.
   Each service: run cmd from config or spawn subprocess.

1.2 Service commands in config
   [services.mono]
   port = 3000
   command = "pnpm dev"           # spawn and manage
   # or: run = "node server.js"
   Restart on crash (optional watch mode).

1.3 devmesh install --auto
   Detect hosts file, offer to append automatically (with --yes).
   Or generate dnsmasq/CoreDNS config for local resolution.

1.4 Hot reload
   Watch devmesh.toml; reload config without restarting proxy.

PHASE 2: Observability
-----------------------

2.1 Prometheus /metrics endpoint
   Expose: requests_total, request_duration, peer_count, service_up.
   Grafana dashboards for local dev.

2.2 Structured request logging
   Optional JSON logs: method, path, status, peer_id, duration.
   Log to file or stdout; RUST_LOG controls verbosity.

2.3 Dashboard: real-time
   WebSocket push instead of 3s poll.
   Live peer join/leave, service up/down.

2.4 Request tracing
   X-DevMesh-Trace-ID header, optional OpenTelemetry export.

PHASE 3: Reliability & Operations
---------------------------------

3.1 Health checks
   [services.mono]
   health = "http://localhost:3000/health"
   health_interval = "5s"
   Don't route to unhealthy services; mark stale in dashboard.

3.2 Proxy: connection pooling
   Reuse connections to backends (local + peers).

3.3 Proxy: retries
   On 5xx or connection failure, retry next peer (if any).

PHASE 4: Routing & Discovery
-----------------------------

4.1 Path-based routing
   [services.api]
   routes = ["/api/*", "/v1/*"]
   Route by path prefix in addition to Host.

4.2 Peer preference / affinity
   Route to specific peer by ID (devmesh route mono --peer abc123).
   Or: prefer same-peer for session stickiness.

4.3 Multicast discovery
   IPv4 broadcast + IPv6 multicast for dual-stack networks.

4.4 Kubernetes bridge
   Import services from k8s cluster (minikube, kind) into mesh.
   devmesh k8s sync --context minikube

PHASE 5: Security
-----------------

5.1 mTLS between peers (optional)
   [proxy] tls = true, with cert paths.
   Encrypt peer-to-peer traffic.

5.2 Namespace auth
   Require token or secret to join a namespace (shared team secret).

PHASE 6: Integration
--------------------

6.0 Docker auto-discovery (done)
   devmesh from-docker – discover running containers with published ports.
   devmesh from-docker --write – merge into devmesh.toml.

6.1 Docker Compose sidecar
   devmesh compose up – run alongside docker compose.
   Register compose services into mesh.

6.2 VS Code / Cursor tasks
   Generate tasks.json that runs devmesh up + services.

6.3 CLI plugins
   devmesh plugin list, devmesh plugin run <name>.
   Extensible via config or external binaries.

RECOMMENDED ORDER
-----------------
1. devmesh up + service commands (biggest DX win)
2. Health checks (foundation for reliability)
3. Prometheus metrics (observability)
4. Real-time dashboard (polish)
5. Path-based routing (flexibility)