Skip to main content
On this page

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

ComponentStackRole
BackendRust (axum, sqlx, tokio), binary piping-backendREST API, session WebSockets, protocol proxy
FrontendReact + Vite + Tailwind + shadcn/RadixOperator single-page application
PostgreSQLpostgres:18-alpineDurable relational state
Redisredis:8.10.1Session state and caching
guacdguacamole/guacd:1.6.0RDP wire-protocol decoding daemon
ansible-runnerHardened 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.

ContextResponsibility
access_controlRBAC roles, permissions, OIDC integration
assistantBuilt-in AI assistant sessions and provider configuration
auditSession lifecycle and resource-access event recording
configWeighted config contexts over inventory scopes
connection_configReusable connection-config records and scope assignments
connectionsSession state, proxy nodes, personal credential sets
inventoryDevices, virtual machines, IP addresses, sites
licensingLicense validation and enforcement
playbooksVersioned playbooks, runs, and the automation layer
secretsCredential storage and resolution
setupFirst-run bootstrap and admin seeding
syncNetBox provider sync, mapping jobs, write-back outbox
sharedCross-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.