Architecture
Piping consists of a Rust backend and a React single-page frontend, backed by PostgreSQL and Redis. The backend serves the REST API and session WebSockets.
Component overview
| Component | Stack | Role |
|---|---|---|
| Backend | Rust (axum, sqlx, tokio), binary piping-backend | REST API, session WebSockets, protocol proxy |
| Frontend | React + Vite + Tailwind + shadcn/Radix | Operator single-page application |
| PostgreSQL | postgres:18-alpine | Durable relational state |
| Redis | redis:8.10.1 | Session state and caching |
| guacd | guacamole/guacd:1.6.0 | RDP wire-protocol decoding daemon |
| ansible-runner | Hardened sidecar container (non-root, read-only rootfs, no capabilities) | Executes playbook runs in isolation |
All services run on an internal Docker network called piping. The frontend's nginx is the single web entry point; PostgreSQL and Redis also publish their standard ports on the host for direct administration.
Backend domain contexts
Backend contexts live in apps/api/src/contexts/; REST handlers in apps/api/src/api/rest/ call their application use cases.
| Context | Responsibility |
|---|---|
access_control | RBAC roles, permissions, OIDC integration |
assistant | Built-in AI assistant sessions and provider configuration |
audit | Session lifecycle and resource-access event recording |
config | Weighted config contexts over inventory scopes |
connection_config | Reusable connection-config records and scope assignments |
connections | Session state, proxy nodes, personal credential sets |
inventory | Devices, virtual machines, IP addresses, sites |
licensing | License validation and enforcement |
playbooks | Versioned playbooks, runs, and the automation layer |
secrets | Credential storage and resolution |
setup | First-run bootstrap and admin seeding |
sync | NetBox provider sync, mapping jobs, write-back outbox |
shared | Cross-context utilities and types |
REST API contract
The REST contract is apps/api/contracts/piping.openapi.yaml, generated from handler annotations. The web frontend generates its typed HTTP client (apps/web/src/shared/api/schema.gen.ts) from the same contract. See API reference.
Regenerate the contract from the App repository root with cargo run -p piping-backend --bin dump-openapi; CI checks contract drift.
Session proxy and protocol architecture
Every interactive session works the same way regardless of protocol: the browser opens a WebSocket to the backend, and the backend proxy decodes and forwards the native protocol to the target host.
Browser ←──WebSocket──→ Piping backend proxy ←──native protocol──→ Target host
The three WebSocket routes:
/api/v1/ws/ssh/{session_id}
/api/v1/ws/rdp/{session_id}
/api/v1/ws/vnc/{session_id}
Playbook runs stream live output over a separate WebSocket, /api/v1/ws/playbooks/runs/{run_id}.
SSH
The browser side uses xterm.js. The backend opens a native SSH connection to the target host and relays the terminal stream over the WebSocket. No SSH client is needed on the operator's workstation.
RDP
The browser side uses guacamole-common-js. The backend relays to the guacd daemon (running as a sidecar container), which decodes the RDP wire protocol and speaks Guacamole's intermediate protocol to the backend. The browser speaks only WebSocket; all RDP decoding is on the server.
VNC
The browser decodes the framebuffer with noVNC; the backend relays the VNC transport.
Edge proxy run mode
The backend binary has two run modes controlled by PIPING_RUN_MODE:
backend(default) — full API runtime. Serves all REST endpoints, manages inventory, enforces access control, records audit events. Requires PostgreSQL and Redis. Runs SQL migrations on startup.proxy— proxy-only runtime without a database dependency. The central backend dials its registered HTTP(S) base URL to reach targets in that network segment. See Proxy nodes.
The proxy must be reachable from the central backend. See Proxy nodes.
Operator browser
│ WebSocket
▼
Central Piping backend ←── HTTPS ──→ Edge proxy node (inside target network)
│ native SSH/RDP/VNC
▼
Target devices
The browser and the central backend never need IP routing into the target network. Proxy nodes are registered and assigned to devices in the UI — see Proxy nodes.
Frontend
The frontend is a React SPA. Server data uses TanStack Query; the central API client sends session cookies. SSH, RDP and VNC adapters open WebSockets to the backend. English and Russian locales are provided through i18next.
Inventory and sync
The inventory context models devices, virtual machines, IP addresses, and connection targets, mirroring NetBox's entity model — see Inventory. A device or VM with an address bound to an interface is a connection target.
The sync context owns NetBox provider configuration, mapping jobs, signed webhooks, and the site outbox used for explicitly enabled bidirectional write-back — see Inventory sync. The whole inventory can also be exported and re-imported as a single JSON document via inventory transfer.
Access control and audit
access_control applies permissions to protected API operations. OIDC delegates authentication to the configured identity provider and maps its groups or claims to Piping roles. Health probes are public; see API authentication.
audit writes structured JSON event records for:
- Session lifecycle (created, activated, disconnected, terminated, failed)
- Resource access (inventory changes, secret resolution)
- Sign-ins, sync-mapping changes, playbook runs, and MCP tool invocations
The full event catalogue is on the audit log page.
Observability
Host monitoring has two independent paths: /api/v1/monitoring/sd advertises inventory hosts as scrape targets to Prometheus-compatible collectors, and /api/v1/monitoring/latest reads selected host metrics back from the configured source server-side — the browser never queries Prometheus, VictoriaMetrics, or Zabbix directly. See Observability.
OpenTelemetry export is off in the shipped defaults and Compose stack. To export traces, metrics and logs, explicitly enable PIPING_OBSERVABILITY__OTEL_ENABLED (Compose: PIPING_OBSERVABILITY_OTEL_ENABLED) and configure your collector:
OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector.your-company.com:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
Set OTEL_SDK_DISABLED=true to disable all telemetry.
Configuration
The loader reads required config/default.toml and optional config/local.toml relative to its working directory, then overlays PIPING_* environment variables. Source files are under apps/api/config/. See Configuration for paths, nested keys and production secrets.