The SPACE web interface provides a comprehensive, real-time dashboard for managing and monitoring the mesh data system with integrated gossip protocol support. This implementation follows the Next-Gen Web Interface Specification with full support for epidemic-style state propagation, peer discovery, and event notification across distributed nodes.
For the modular monolith boundaries and the MVC split between Axum (controllers), shared state (model), and Leptos (views), see docs/specs/SPACE_ARCHITECTURE_DESIGN_SPEC.md.
The web interface consists of three main crates:
Foundation layer providing:
- Type definitions for peers, nodes, and gossip messages
- Trait abstractions for storage backends and gossip handlers
- Error types and result wrappers
- Configuration structures
Location: crates/mesh-core/
Implements epidemic-style message propagation using libp2p:
- Probabilistic propagation with configurable fanout
- Message signing and verification (HMAC-SHA256)
- TTL-based flood control
- Heartbeat-based liveness detection
- Topic-based pub/sub
Location: crates/gossip-layer/
Full-stack web application:
- Backend: Axum-based HTTP server with REST APIs and WebSocket support
- Frontend: Leptos reactive components (optional, feature-gated)
- Real-time updates: WebSocket integration with gossip layer
- Metrics: Prometheus-compatible metrics endpoint
Location: crates/web-interface/
The web interface registers the following counters/gauges in the Prometheus registry:
space_api_requests_total- Total API requests handled (includes public endpoints).space_ws_messages_total- Total WebSocket messages broadcast.space_connected_peers- Current connected gossip peers.space_gossip_sent_total- Total gossip messages sent.space_files_stored_total- Total files stored via the API.
- Dynamic peer discovery and status updates
- Gossip propagation path visualization
- Storage usage and health metrics
- Convergence time metrics
- Message duplication rates
- Bandwidth usage tracking
- Active topics and peer counts
- Interactive file upload via web dashboard
- Streaming multipart uploads (no base64 bloat) with gossip notifications
- Blake3 hash verification
- File listing with metadata (size, hash, upload time)
- File download with binary content delivery
- In-memory storage with auto-refresh
- Automatic replication notifications
- ETL operations with gossip propagation
- Transformation status tracking
- Migration intent broadcasting
- Message authentication (HMAC-SHA256)
- Role-based access control (RBAC)
- Security alert broadcasting
- Zero-trust architecture ready
- Versioned REST surface under
/api/v1with domains:system,mesh,data,gossip. - Standard response envelope (
success,data,error,meta) and pagination helpers. - JWT middleware injects claims +
RequestContext;system/healthstays public for probes. - Streaming multipart uploads for
POST /api/v1/data/objects; downloads viaGET|HEAD. - OpenAPI generated at
/api-docs/openapi.jsonwith Swagger UI at/swagger-ui. - See
docs/SPACE_CONTROL_PLANE_API.mdfor endpoint taxonomy and usage notes.
- Subscribe to gossip topics
- Live peer updates
- Event streaming
- Heartbeat notifications
- Rust 1.75+ (for async trait support)
- Cargo workspace setup
- Optional: wasm-pack for frontend builds
# Build all crates
cargo build --release
# Build with frontend support
cargo build --release --features frontend
# Build only the backend
cargo build --release -p web-interface# Run with default configuration
cargo run -p web-interface --bin web-server
# Run with custom configuration
BIND_ADDR=0.0.0.0:8080 \
GOSSIP_FANOUT=12 \
GOSSIP_HEARTBEAT_MS=500 \
GOSSIP_TTL=15 \
cargo run -p web-interface --bin web-server| Variable | Description | Default |
|---|---|---|
BIND_ADDR |
Server bind address | 127.0.0.1:3000 |
GOSSIP_FANOUT |
Number of peers to gossip to | 8 |
GOSSIP_HEARTBEAT_MS |
Heartbeat interval in ms | 1000 |
GOSSIP_TTL |
Message time-to-live (max hops) | 10 |
GOSSIP_SIGNING_KEY |
Hex-encoded signing key (32 bytes) | Default dev key |
Deep health check endpoint with per-subsystem checks.
Response: 200 OK
{
"data": {
"status": "ok",
"uptime_ms": 12345,
"checks": [
{
"id": "GOSSIP_OK",
"severity": "ok",
"message": "Gossip layer connected to 3 peers"
}
]
}
}Health Check IDs:
| ID | Severity | Condition |
|---|---|---|
GOSSIP_OK |
ok |
Gossip peers connected and reachable |
GOSSIP_NO_PEERS |
warn |
No peers connected; standalone mode |
GOSSIP_PEERS_DEGRADED |
warn |
Some peers offline within the heartbeat window |
GOSSIP_NO_MESSAGES |
warn |
No gossip messages sent since startup (>30s) |
GOSSIP_UNREACHABLE |
error |
Gossip layer returned an error |
METRICS_EMPTY |
warn |
Prometheus registry has no metrics registered |
Status derivation: error if any check is error, else warn if any check is warn, else ok.
Get all known peers with gossip metrics.
Response:
{
"peers": [
{
"id": "peer-123",
"addr": "127.0.0.1:8080",
"role": "Viewer",
"storage_usage": 104857600,
"status": "online",
"gossip_version": 1,
"last_gossip_heartbeat": 1700000000
}
],
"gossip_metrics": {
"convergence_time_ms": 0.5,
"duplication_rate": 0.05,
"bandwidth_usage": 1024
},
"total_count": 1
}Get a specific peer by ID.
Response: 200 OK with peer object, or 404 Not Found.
Upload a file to the mesh.
Request:
{
"path": "/data/myfile.txt",
"content": "SGVsbG8sIFdvcmxkIQ==" // base64 encoded
}Response:
{
"success": true,
"message": "File uploaded successfully: /data/myfile.txt",
"hash": "abc123..."
}List all stored files with metadata.
Response:
{
"files": [
{
"path": "/data/myfile.txt",
"size": 13,
"hash": "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262",
"uploaded_at": 1700000000
}
],
"total": 1,
"total_size": 13
}Download a specific file by its path.
Parameters: path - File path (e.g., /api/files/data/myfile.txt)
Response: 200 OK with file content as binary data, or 404 Not Found.
Get gossip protocol statistics.
Response:
{
"stats": {
"messages_sent": 1000,
"messages_received": 950,
"avg_convergence_ms": 0.8,
"duplication_rate": 0.05,
"active_topics": 5,
"connected_peers": 10,
"bandwidth_usage": 2048
},
"additional": {
"peer_count": 10
}
}Broadcast a custom gossip message.
Request:
{
"topic": "custom-events",
"payload": [1, 2, 3, 4]
}Response:
{
"success": true,
"message": "Message broadcasted successfully",
"hash": null
}Get Prometheus-compatible metrics.
Response: Text format Prometheus metrics.
Registered metrics:
| Metric | Type | Description |
|---|---|---|
api_requests_total |
Counter | Total API requests handled |
ws_messages_total |
Counter | Total WebSocket messages broadcast |
connected_peers |
Gauge | Current connected peer count |
gossip_sent_total |
Counter | Total gossip messages sent |
files_stored_total |
Counter | Total files stored via the API |
Real-time updates via WebSocket.
Client Messages:
// Subscribe to a topic
{
"type": "Subscribe",
"topic": "updates"
}
// Unsubscribe from a topic
{
"type": "Unsubscribe",
"topic": "updates"
}
// Ping
{
"type": "Ping"
}Server Messages:
// Gossip update
{
"type": "GossipUpdate",
"topic": "updates",
"message": "Heartbeat { peer_id: \"node-1\", ... }"
}
// Subscription confirmation
{
"type": "subscribed",
"topic": "updates"
}
// Error
{
"type": "Error",
"message": "Failed to subscribe: ..."
}
// Pong
{
"type": "Pong"
}# Test all crates
cargo test
# Test specific crate
cargo test -p mesh-core
cargo test -p gossip-layer
cargo test -p web-interface# Run integration tests
cargo test --test integration_test
# Run with output
cargo test --test integration_test -- --nocapture# Install tarpaulin
cargo install cargo-tarpaulin
# Run coverage
cargo tarpaulin --workspace --out HtmlThe gossip protocol can be tuned for different network conditions:
GossipConfig {
fanout: 12,
heartbeat_interval_ms: 500,
message_ttl: 5,
..Default::default()
}GossipConfig {
fanout: 8,
heartbeat_interval_ms: 1000,
message_ttl: 10,
..Default::default()
}GossipConfig {
fanout: 6,
heartbeat_interval_ms: 2000,
message_ttl: 15,
enable_compression: true,
..Default::default()
}- Typical overhead: <5% of total bandwidth
- Zero-copy message passing via
bytescrate - Batch message processing for efficiency
- Tested up to 1,000 simulated nodes
- O(log n) convergence time
- Topic sharding for >10,000 nodes
- LRU cache for peer views (configurable size)
- Message deduplication via hash-based tracking
- Automatic cleanup of stale connections
All gossip messages are signed using HMAC-SHA256:
- 32-byte signing key (configurable)
- Signature verification on receive
- Byzantine fault detection ready
- Optional message encryption (AES-GCM via
ring) - TLS for HTTP/WebSocket (recommended in production)
- Zero-trust architecture compatible
Node roles supported:
- Admin: Full control
- Editor: Read/write data
- Viewer: Read-only access
- StorageNode: Storage provider
- Gateway: External access point
- Increase
fanoutparameter - Decrease
heartbeat_interval_ms - Check network latency between peers
- Decrease
fanoutparameter - Increase
message_ttlto reduce retransmissions - Enable message compression
- Check CORS configuration
- Verify bind address is accessible
- Check firewall rules for WebSocket traffic
- Verify signing key matches across peers
- Check that peers can reach each other
- Review logs for authentication errors
- AI-tuned gossip parameters (using
linfaML library) - Holographic data flow visualization
- Voice-command integration for AR
- Post-quantum cryptography support
- Federated search over gossiped indices
- Self-organizing storage rebalancing
- Browser-based peers via Wasm
- Zero-knowledge gossip for privacy
- Integration with TEE (Trusted Execution Environments)
- Quantum-resistant signatures
- Follow Rust standard formatting (
cargo fmt) - Run Clippy before submitting (
cargo clippy) - Add documentation for public APIs
- Include tests for new features
- Unit tests for all new functions
- Integration tests for API endpoints
- Property-based tests for gossip convergence
- Minimum 85% code coverage
MIT OR Apache 2.0 (consistent with SPACE project)