How lukegus/termix works
Purpose and Delivery Model
Termix is a self-hosted server-management platform: SSH terminals, files, host metrics, tunnels, container control, serial access, and Guacamole-backed RDP/VNC/Telnet. It runs as a browser/PWA application or packaged Electron desktop client, backed by a Node/TypeScript service. Core entry points are src/main.tsx, src/backend/starter.ts, and electron/main.cjs.
Client Application Shell
The React frontend mounts from src/main.tsx into the tabbed/split-pane application shell in src/ui/AppShell.tsx and src/ui/shell/TabContext.tsx. Feature screens call backend HTTP/WebSocket-facing API modules under src/ui/api/, keeping UI components separated from transport details. Electron-specific browser/native bridging is isolated through electron/preload.js and src/ui/lib/electron.ts.
Backend API and Persistence
The backend bootstrap (src/backend/starter.ts) composes application services, database routes, SSH/terminal routes, Guacamole, homepage, and API documentation (src/backend/swagger.ts). SQLite persistence is centered on src/backend/database/database.ts, schema definitions in src/backend/database/db/schema.ts, and domain route handlers in src/backend/database/routes/. Database encryption, migrations, and field protection form a security boundary in src/backend/utils/database-file-encryption.ts, src/backend/utils/database-migration.ts, and src/backend/utils/field-crypto.ts.
Identity, Authorization, and Audit
User/session management, RBAC, credentials, API keys, SSO/OIDC/LDAP, TOTP, and WebAuthn are persisted and exposed through routes such as src/backend/database/routes/users.ts, src/backend/database/routes/rbac.ts, and src/backend/database/routes/sso-provider-routes.ts. Runtime authorization and request protection are concentrated in src/backend/utils/auth-manager.ts, src/backend/utils/permission-manager.ts, and src/backend/utils/login-rate-limiter.ts. Audit logging provides the cross-cutting accountability path at src/backend/utils/audit-logger.ts.
Remote-Access Execution Plane
SSH is the principal execution boundary: authenticated host resolution, connection reuse, jump hosts, host-key verification, terminal sessions, tmux monitoring, file operations, and forwarding reside in src/backend/ssh/. Key orchestration points are src/backend/ssh/ssh-connection-pool.ts, src/backend/ssh/terminal-session-manager.ts, and src/backend/ssh/tunnel.ts. The frontend presents these streams and controls in src/ui/features/terminal/TerminalApp.tsx, src/ui/features/file-manager/FileManagerApp.tsx, and src/ui/features/tunnel/TunnelApp.tsx. Serial access follows a parallel backend/native path via src/backend/serial/serial.ts and src/ui/features/serial/Serial.tsx.
Infrastructure and Remote Integrations
Remote desktop connections are tokenized/proxied through the Guacamole integration in src/backend/guacamole/guacamole-server.ts and src/backend/guacamole/token-service.ts, with an external guacd service expected by docker/docker-compose.yml. SSH also integrates Docker/Podman (src/backend/ssh/docker.ts), Tailscale, Proxmox, Vault signing, and notification/webhook services. Deployment is container-oriented through docker/Dockerfile and docker/entrypoint.sh; Nginx config supports HTTP/HTTPS fronting.
Observability and Dashboard Products
SSH-collected host telemetry flows through src/backend/ssh/host-metrics.ts and collectors in src/backend/ssh/widgets/, is stored/configured via database routes, and is rendered in src/ui/features/host-metrics/HostMetricsApp.tsx. Alert evaluation and delivery are handled by src/backend/ssh/alert-engine.ts and src/backend/utils/notification-sender.ts. User-configurable dashboard/homepage layouts and widgets span src/backend/homepage.ts, src/ui/features/homepage/HomepageApp.tsx, and src/ui/features/homepage/widgets/WidgetRegistry.ts.
Packaging Boundaries
Web builds are Vite-based (vite.config.ts) and include a service worker at public/sw.js. Desktop packaging uses Electron Builder (electron-builder.json), native main/preload processes, and platform packaging assets under build/, flatpak/, Casks/, and chocolatey/.
Main entry points: starter.ts Backend bootstrap · AppShell.tsx Tabbed app shell · users.ts Domain API routes · auth-manager.ts Identity and authorization
Components 20
Client
- React web entry
src/main.tsx - Tabbed app shell · Split-pane and tab state host.
src/ui/AppShell.tsx - UI API modules
src/ui/api/host-metrics-api.ts - Access feature UIs
src/ui/features/terminal/TerminalApp.tsx - Metrics and homepage
src/ui/features/host-metrics/HostMetricsApp.tsx - Electron bridge
electron/preload.js
Backend
- Backend bootstrap · Composes HTTP, WebSocket, domain, Guacamole, homepage, and docs services.
src/backend/starter.ts - Domain API routes
src/backend/database/routes/users.ts - Identity and authorization · Sessions, RBAC, SSO, MFA, API keys, and rate limiting.
src/backend/utils/auth-manager.ts - Audit logging
src/backend/utils/audit-logger.ts - Encrypted SQLite · Schema, migrations, and field protection form the data-security boundary.
src/backend/database/database.ts
Remote execution
- SSH execution plane · Host resolution, pooling, terminal sessions, files, jump hosts, and forwarding.
src/backend/ssh/ssh-connection-pool.ts - Managed hosts
- Serial access
src/backend/serial/serial.ts - Guacamole proxy · Tokenizes RDP, VNC, and Telnet sessions.
src/backend/guacamole/guacamole-server.ts - guacd
docker/docker-compose.yml - Telemetry and alerts · SSH collectors feed host metrics, alert evaluation, and notifications.
src/backend/ssh/host-metrics.ts
Delivery
- Electron main process
electron/main.cjs - Vite PWA build · Build includes a service worker.
vite.config.ts - Container deployment
docker/Dockerfile
Connections 25
- React web entry → Tabbed app shell: mounts
- Tabbed app shell → Access feature UIs: hosts
- Tabbed app shell → Metrics and homepage: hosts
- Access feature UIs → UI API modules: uses
- Metrics and homepage → UI API modules: uses
- UI API modules → Backend bootstrap: HTTP/WebSocket
- Electron main process → Electron bridge: loads
- Electron bridge → Tabbed app shell: native APIs
- Backend bootstrap → Domain API routes: serves
- Backend bootstrap → Identity and authorization: protects requests with
- Backend bootstrap → SSH execution plane: exposes
- Backend bootstrap → Serial access: exposes
- Backend bootstrap → Guacamole proxy: integrates
- Backend bootstrap → Telemetry and alerts: runs
- Domain API routes → Encrypted SQLite: persists
- Identity and authorization → Encrypted SQLite: reads identity data
- Identity and authorization → Audit logging: records events
- Domain API routes → Audit logging: records changes
- SSH execution plane → Managed hosts: SSH sessions
- Serial access → Managed hosts: serial devices
- Telemetry and alerts → SSH execution plane: collects through
- Telemetry and alerts → Encrypted SQLite: stores configuration
- Guacamole proxy → guacd: proxies to
- Vite PWA build → React web entry: builds
- Container deployment → Backend bootstrap: deploys