English | 简体中文
A low-overhead, SSD-friendly home-server management panel built specifically for macOS & Apple Silicon — combining Unraid-style storage and share workflows with Activity Monitor telemetry, Apple Container / OrbStack management, native LaunchAgent / Homebrew orchestration, and zero-dependency built-in security.
Default bind: 127.0.0.1:8086 (loopback only). Set SERVERHUB_HOST=0.0.0.0 for LAN access. Mandatory authentication is enforced once first-run setup completes. Never expose port 8086 raw to the public internet — place it behind a Cloudflare Tunnel, WireGuard, or a TLS-terminating reverse proxy.
All screenshots below are rendered from the real Vue 3 SPA against 100% fictional demo data — no real hostnames, IP addresses, accounts, tokens, disk serials, or personal paths are included.
| Domain | Capabilities | Documentation |
|---|---|---|
| Dashboard & Telemetry | Activity-Monitor-style twin CPU & Apple GPU plots, unified memory breakdown (App / Wired / Compressed / Cached), NVMe SMART wear & temperature,UPS chip, local LLM chip, and tiered metrics (90s / 5m / 1h from 1 hour to 1 year) | docs/metrics.md |
| Storage & Pool | Physical disk inventory, format/mount/eject with device-identity guards, NVMe/SATA SMART self-tests, AppleRAID, JBOD Union Pool placement planning, APFS snapshots, directory usage analytics | — |
| Shares & Time Machine | Native macOS SMB share CRUD (guest, read-only, SMB encryption), Time Machine network backup destinations with per-share GB quotas, per-user filesystem ACL editor, NFS exports, macOS System Sharing toggles (Screen Sharing, SSH) | docs/time-machine.md |
| Containers & App Store | Dual engine support (Apple container on macOS Virtualization.framework + OrbStack / Docker), idle BuildKit VM auto-reaper, XiaomiHub central gateway lifecycle & role telemetry, Dockge-style Compose editor, 50 built-in templates (native Homebrew/GPU + container stacks) + optional SHA-256-pinned remote catalog |
docs/app-catalog.md |
| Services & Native Stack | Auto-discovery across launchd, Homebrew, containers, UTM/Orb VMs, and listening ports; one-click adoption, log tailing, native Immich (Metal/ANE + VideoToolbox) health checks, and PhotosHub bridge management |
docs/app-catalog.md |
| Local AI & In-Panel Assistant | Ollama / mlx-lm model management, live streaming chat/test bench, and built-in Assist / Explain This Page copilot across English, Simplified Chinese, and Japanese |
— |
| Networking & Edge | Interface order, DHCP/static IP, virtual IP aliases with auto-bind, wired/Wi-Fi automatic failover, WireGuard peers + QR/conf export + pf NAT + wstunnel obfuscation, Cloudflare Tunnel, Nginx gateway, and automatic Local Sites discovery (/sites) |
— |
| Scheduler & Backups | Built-in cron scheduler (shell, rsync, Compose stack backup, APFS snapshot), rsync dry-run preview, crash-safe stack backups, external-volume-first PostgreSQL & config archives |
docs/scheduler-and-backups.md |
| UPS & Power Safety | Native USB UPS monitoring (pmset), AC-loss / low-battery alerts, and a two-layer safe-shutdown policy (ordered graceful workload stop + dry-run drill + automatic power-return restore) |
docs/ups.md |
| Notifications | Multi-channel alert routing across SMTP, ntfy, Telegram, Discord, Slack, generic Webhooks, and Home Assistant with per-channel severity thresholds and secret redaction | docs/notifications.md |
| Security & Multi-User | Mandatory setup-token bootstrap, Admin & Member roles with per-service grants, TOTP 2FA + recovery codes, SHA-256 hashed API keys, append-only auth audit log, SSRF & WebSocket origin guards | docs/authentication.md |
| Tools & Diagnostics | Audited Web Terminal (host PTY + container exec) with lazy-loaded xterm.js, one-click redacted diagnostics bundle, syslog viewer, LaunchAgent inspector, panel & Homebrew updater |
docs/upgrade.md |
Home servers on Apple Silicon run 24/7 on soldered internal NVMe storage. ServerHub is explicitly architected to keep idle CPU, RAM, and NAND write amplification near zero:
- Zero-Tempfile Subprocess Capture: Bounded pipe +
selectorscapture (hub/util.py) reads CLI output in memory without creating/tmpfiles on every poll. - Batched Telemetry & Write Guards: Metrics buffer in RAM and flush/roll up on a 30-minute cadence (
fsync=Falseon non-critical telemetry); state caches (brew_cache,alerts,metrics_rollup) skip disk rewrites when bytes are unchanged. - 1 Hz Quiet Event Loop & In-Process
libproc: Custom uvicorn tick (hub/quiet_server.py) + direct macOSlibproc/sysctlreads avoid spawningpsortopduring background ticks. - Auto-Reaped Ephemeral VMs: Idle Apple Container
buildkitVMs are detected in-memory viapsutiland automatically stopped once builds complete, reclaiming 2 GiB RAM without deleting cached image layers. - Sub-90 KiB First-Paint SPA: Every route (including
/and/login),xterm.js, QR generator, and locale dictionary (en/zh-CN/ja) is code-split;vite buildhard-fails if the entry bundle ever exceeds 150 KiB.
- Backend: Python 3.10+ / FastAPI (
hub/, entryapp.py), standard-library TOTP, scrypt password hashing, API-key hashing, cron matcher, and notification senders (no heavy auth/ORM/crypto bloat). - Frontend: Vue 3.5 + Vite 6 (
web/→ prebuiltstatic/), zero Options API runtime, 3 themes (macOS,Unraid,Dockerin Light/Dark/System) and 3 locales (English,简体中文,日本語). - Container Engines: First-class support for both Apple
container(container_engine: apple) and OrbStack / Docker (container_engine: docker), selectable inservices.yamlor Settings. - Native macOS Menu Bar App: Pure AppKit Swift launcher (
macos/ServerHubLauncher.swift→ServerHub.app) using ephemeral zero-disk-cacheURLSession, non-modal alert sessions, sleep/wake pause, and automatic backoff.
Requires macOS 13+ and Python 3.10+. (Prebuilt SPA assets ship in static/; Node.js 20/22+ is only needed when editing web/.)
git clone https://github.com/elvin-li/ServerHub.git
cd ServerHub
./install.sh
open http://localhost:8086./install.shcreates.venv, preserves any existingservices.yamlanddata/, installs and bootstrapslocal.serverhub.panel+local.serverhub.watchdog, and generates a one-timedata/.setup-token(0600).- Visiting
http://localhost:8086from the same Mac auto-supplies the setup token so you can create the administrator account immediately. When connecting through a reverse proxy or Cloudflare Tunnel, paste the token fromdata/.setup-token. - To uninstall:
./uninstall.sh(append--purgeto also delete localservices.yamlanddata/).
| Variable | Default | Purpose |
|---|---|---|
SERVERHUB_HOST |
127.0.0.1 |
Listen address (0.0.0.0 to allow LAN access) |
SERVERHUB_PORT |
8086 |
HTTP listen port |
SERVERHUB_STATE_DIR |
repo root | Directory holding mutable services.yaml and data/ |
SERVERHUB_LOG_DIR |
~/Library/Logs |
Target directory for deploy/run-panel.py stdout/stderr logs (supports external-volume symlinks) |
SERVERHUB_TRUSTED_PROXIES |
127.0.0.1/32,::1/128 |
Reverse-proxy CIDRs trusted for X-Forwarded-For / CF-Connecting-IP client attribution |
Health probes:
GET /ready— unauthenticated zero-discovery readiness probe.GET /api/health— lightweight watchdog liveness probe.GET /api/status— authenticated full service and system inventory (every response carriesX-Request-ID).
Build and install into /Applications or per-user ~/Applications (no sudo required):
mkdir -p "$HOME/Applications"
./macos/build_app.sh "$HOME/Applications/ServerHub.app"
open "$HOME/Applications/ServerHub.app"- Automatically follows macOS system language (
简体中文/English, overridable viaSERVERHUB_LANGUAGE=zh-Hansoren). - Displays live health counts, problematic services at the top, grouped service links, one-click start/stop/restart actions, and maintenance tasks.
- Settings → Panel inside the Web UI can inspect
ServerHub.app, toggle login autostart, or restart the background panel service.
- Upgrading & Rollback — supported
install.shand in-place upgrade flows, LaunchAgent lineage (local.serverhub.panel,local.serverhub,com.elvin.serverhub), config & git rollback - Authentication & Access Control — setup token, Admin/Member roles, TOTP 2FA, API keys, SMB ACL mapping
- App Catalog & Remote Sources — 50 built-in native/container templates, dynamic placeholders, SHA-256-pinned remote catalog trust model
- Scheduler & Backups — cron jobs,
rsyncpush/pull with dry-run preview, Compose stack & database backups - Time Machine Destinations — hosting network Time Machine backups with quotas for other Macs
- UPS & Safe Shutdown — USB UPS monitoring and two-layer graceful shutdown + auto-restore
- Metrics & Rollups — tiered
90s/5m/1hretention and range query API - Notifications — multi-channel alert delivery and secret storage
Built-in and remote templates never hardcode host-specific paths or addresses. ServerHub expands these variables automatically at install time:
| Placeholder | Resolves to |
|---|---|
{{HOME}} |
Current user's home directory |
{{SERVICES}} |
Managed services root (defaults to ~/Services) |
{{HOST_IP}} |
Detected primary LAN IPv4 address (or configured settings.host_ip) |
{{TZ}} |
Host IANA timezone from /etc/localtime (fallback UTC) |
{{OCR_LANG}} |
Tesseract language list derived from macOS preferred languages (e.g. eng+chi_sim) |
{{UI_LANGS}} |
Locale list for multi-language apps such as Stirling-PDF (e.g. en_GB,zh_CN) |
Authoring note: Always quote YAML front-matter defaults beginning with
{{(for exampledefault: "{{HOME}}/Music").tests/test_template_metadata.pyvalidates every shipped template in CI.
Run from the repository root:
# Backend test suite (-t . isolates mutable state into a temp directory via tests/__init__.py)
.venv/bin/python -m unittest discover -s tests -t . -q
# Frontend unit/a11y/i18n/contrast tests, Knip dead-code check, and production build (<150 KiB entry gate)
npm --prefix web test
npm --prefix web run check:dead-code
npm --prefix web run build
# Static unused-code checks
.venv/bin/python -m pyflakes hub tests app.py menubar.py
.venv/bin/python -m vulture hub tests app.py menubar.py --min-confidence 100Restarting whichever LaunchAgent label manages your checkout:
DOMAIN="gui/$(id -u)"
for label in local.serverhub.panel local.serverhub com.elvin.serverhub; do
if launchctl print "$DOMAIN/$label" >/dev/null 2>&1; then
launchctl kickstart -k "$DOMAIN/$label" && echo "restarted $label"
break
fi
done



