๐ What is unifly?
A complete command-line toolkit for managing Ubiquiti UniFi network controllers. One binary with 25 top-level commands for scripting and a built-in TUI dashboard for real-time monitoring, powered by a shared async engine that speaks every UniFi API dialect.
Manage devices, monitor clients, inspect VLANs, stream events, and watch bandwidth charts, all without leaving your terminal.
UniFi controllers expose multiple APIs with different capabilities. unifly unifies them all into a single, coherent interface so you never have to think about which endpoint to hit.
๐ค AI Agent? ๐ค Human? Both Welcome.
unifly speaks fluent silicon and carbon.
Coding agents get a dedicated skill bundle: full CLI reference, automation workflows, and a ready-made network manager agent that can provision VLANs, audit firewalls, and diagnose connectivity without asking permission for every command. One command to install:
Humans get a gorgeous 8-screen TUI, shell completions, pipe-friendly output, and the quiet satisfaction of never opening the UniFi web UI again. Keep scrolling to Install.
โฆ Features
| Capability | What You Get |
|---|---|
| ๐ฎ Dual API Engine | Integration API (REST, API key) + Legacy API (session, cookie/CSRF) with automatic Hybrid negotiation |
| โก Real-Time TUI | 8-screen dashboard with area-fill traffic charts, CPU/MEM gauges, live client counts, zoomable topology |
| ๐ฆ 25 Top-Level Commands | Devices, clients, networks, WiFi, firewall policies, zones, ACLs, NAT policies, DNS, VPN, hotspot vouchers, DPI, RADIUS, topology, tui... |
| ๐ Flexible Output | Table, JSON, compact JSON, YAML, and plain text. Pipe-friendly for scripting |
| ๐ Secure Credentials | OS keyring storage for API keys and passwords, with plaintext config support when you choose it |
| ๐ Multi-Profile | Named profiles for multiple controllers. Switch with a single flag |
| ๐ง Smart Config | Interactive wizard, environment variables, TOML config, CLI overrides |
| ๐ก WebSocket Events | Live event streaming with 10K rolling buffer, severity filtering, pause/scroll-back |
| ๐ Historical Stats | WAN bandwidth area fills, client counts, DPI app/category breakdown (1h to 30d) |
| ๐จ SilkCircuit Theme | Neon-on-dark color palette powered by opaline. Token-based theming across CLI and TUI with ANSI fallback |
โก Install
Linux / macOS
|
Windows (PowerShell)
irm https://raw.githubusercontent.com/hyperb1iss/unifly/main/install.ps1 | iex
Other Methods
| Method | Command |
|---|---|
| Homebrew | brew install hyperb1iss/tap/unifly |
| AUR | yay -S unifly-bin |
| Cargo | cargo install --git https://github.com/hyperb1iss/unifly.git unifly |
| Binary | Download from GitHub Releases |
๐ฎ Quick Start
Run the interactive setup wizard:
The wizard walks you through controller URL, authentication method, and site selection. Credentials can be stored in your OS keyring or saved in plaintext config, depending on the option you choose.
Once configured:
ID | Name | Model | Status
--------------------------------------+-----------------+-----------------+--------
a1b2c3d4-e5f6-7890-abcd-ef1234567890 | Office Gateway | UDM-Pro | ONLINE
b2c3d4e5-f6a7-8901-bcde-f12345678901 | Living Room AP | U6-LR | ONLINE
c3d4e5f6-a7b8-9012-cdef-123456789012 | Garage Switch | USW-Lite-8-PoE | ONLINE
๐ Authentication
API Key (recommended)
Generate a key on your controller under Settings > Integrations. Full CRUD access via the Integration API.
Username / Password
Legacy session-based auth with cookie and CSRF token handling. Required for events, statistics, and device commands not yet in the Integration API.
Hybrid Mode
Best of both worlds: API key for Integration API CRUD, username/password for Legacy API features. The wizard offers this when both are available.
Environment Variables
| Variable | Description |
|---|---|
UNIFI_API_KEY |
Integration API key |
UNIFI_URL |
Controller URL |
UNIFI_PROFILE |
Profile name |
UNIFI_SITE |
Site name or UUID |
UNIFI_OUTPUT |
Default output format |
UNIFI_INSECURE |
Accept self-signed TLS certs |
UNIFI_TIMEOUT |
Request timeout (seconds) |
๐ป CLI
Commands
| Command | Alias | Description |
|---|---|---|
acl |
Manage ACL rules | |
admin |
Administrator management | |
alarms |
Manage alarms | |
clients |
cl |
Manage clients and DHCP reservations |
completions |
Generate shell completions | |
config |
Manage CLI configuration | |
countries |
List available country codes | |
devices |
dev, d |
Manage adopted and pending devices |
dns |
Manage DNS policies (local records) | |
dpi |
DPI reference data | |
events |
View and stream events | |
firewall |
fw |
Manage firewall policies and zones |
nat |
Manage NAT policies (masquerade, SNAT, DNAT) | |
hotspot |
Manage hotspot vouchers | |
networks |
net, n |
Manage networks and VLANs |
radius |
View RADIUS profiles | |
sites |
Manage sites | |
stats |
Query statistics and reports | |
system |
sys |
System operations and info |
topology |
topo |
Show network topology tree |
traffic-lists |
Manage traffic matching lists | |
vpn |
View VPN servers and tunnels | |
wans |
View WAN interfaces | |
wifi |
w |
Manage WiFi broadcasts (SSIDs) |
tui |
Launch the real-time terminal dashboard |
Most resource groups support list and get; some also expose create, update, delete, patch, or specialized actions. Run unifly <command> --help for details.
Global Flags
-p, --profile <NAME> Controller profile to use
-c, --controller <URL> Controller URL (overrides profile)
-s, --site <SITE> Site name or UUID
-o, --output <FORMAT> Output: table, json, json-compact, yaml, plain
-k, --insecure Accept self-signed TLS certificates
-v, --verbose Increase verbosity (-v, -vv, -vvv)
-q, --quiet Suppress non-error output
-y, --yes Skip confirmation prompts
--timeout <SECS> Request timeout (default: 30)
--color <MODE> Color: auto, always, never
Shell Completions
# Bash
# Zsh
# Fish
# PowerShell
| |
๐ฅ๏ธ TUI
The unifly tui subcommand launches a real-time terminal dashboard for monitoring and managing your UniFi network. Eight screens cover everything from live bandwidth charts to firewall policy management.
Screens
Navigate with number keys 1โ8 or Tab/Shift+Tab:
| Key | Screen | Description |
|---|---|---|
1 |
Dashboard | btop-style overview: area-fill WAN traffic chart, gateway info, connectivity health, CPU/MEM bars, networks with IPv6, WiFi AP experience, top clients, recent events |
2 |
Devices | Adopted devices with model, IP, CPU/MEM, TX/RX, uptime. 5-tab detail panel (Overview, Performance, Radios, Clients, Ports) |
3 |
Clients | Connected clients: hostname, IP, MAC, VLAN, signal bars, traffic. Filterable by type (All/Wireless/Wired/VPN/Guest) |
4 |
Networks | VLAN topology: subnets, DHCP, IPv6, gateway type. Inline edit overlay for live config changes |
5 |
Firewall | Policies, zones, ACL rules, and NAT policies across four sub-tabs with visual rule reordering |
6 |
Topology | Zoomable network topology tree: gateway โ switches โ APs, color-coded by type and state |
7 |
Events | Live event stream with 10K rolling buffer. Pause, scroll back, severity color-coding |
8 |
Stats | Historical charts: WAN bandwidth area fills, client counts, DPI app/category breakdown (1h/24h/7d/30d) |
Dashboard
The dashboard packs eight live panels into a dense, information-rich overview:
- WAN Traffic ยท Area-fill chart with Braille line overlay, live TX/RX rates, peak tracking
- Gateway ยท Model, firmware, WAN IP, IPv6, DNS, ISP, latency, uptime
- Connectivity ยท Subsystem status dots (WAN/WWW/WLAN/LAN/VPN), aggregate traffic bars
- Capacity ยท Color-coded CPU/MEM gauges, load averages, device/client fleet summary
- Networks ยท VLANs sorted by ID with IPv6 prefix delegation and SLAAC mode
- WiFi / APs ยท Client count, WiFi experience %, channel info per access point
- Top Clients ยท Proportional traffic bars with fractional block characters
- Recent Events ยท Two-column compact event display, color-coded by severity
Devices & Clients
Networks & Firewall
Stats
Historical statistics with selectable time windows and dual-API data sourcing:
- WAN Bandwidth ยท TX/RX area fills with Braille line overlay, auto-scaling axes
- Client Count ยท Braille line chart tracking connected clients over time
- Top Applications ยท DPI application breakdown with proportional bars (Integration API names, Legacy fallback)
- Traffic by Category ยท Percentage bars for streaming, gaming, social, etc.
Key Bindings
Global
| Key | Action |
|---|---|
1โ8 |
Jump to screen |
Tab / Shift+Tab |
Next / previous screen |
j / k / โ / โ |
Navigate up / down |
g / G |
Jump to top / bottom |
Ctrl+d / Ctrl+u |
Page down / up |
Enter |
Select / expand detail |
Esc |
Close detail / go back |
/ |
Search |
? |
Help overlay |
, |
Settings |
q |
Quit |
Screen-Specific
| Screen | Key | Action |
|---|---|---|
| Devices | R |
Restart device |
| Devices | L |
Locate (flash LED) |
| Devices (detail) | h / l |
Previous / next detail tab |
| Clients | Tab |
Cycle filter (All โ Wireless โ Wired โ VPN โ Guest) |
| Clients | b / B |
Block / unblock client |
| Clients | x |
Kick client |
| Networks | e |
Edit selected network |
| Firewall | h / l |
Cycle sub-tabs (Policies / Zones / ACL Rules / NAT) |
| Firewall | K / J |
Reorder policy up / down |
| Topology | โ โ โ โ |
Pan canvas |
| Topology | + / - |
Zoom in / out |
| Topology | f |
Fit to view |
| Events | Space |
Pause / resume live stream |
| Stats | h d w m |
Period: 1h / 24h / 7d / 30d |
| Stats | r |
Refresh |
๐๏ธ Architecture
Two crates, clean dependency chain:
unifly (CLI + TUI binaries)
โ
โผ
unifly-api (library)
โโโ HTTP/WS transport
โโโ Controller lifecycle
โโโ Reactive DataStore
โโโ Domain models
| Crate | Purpose |
|---|---|
| unifly-api | Async HTTP/WebSocket client, Controller lifecycle, reactive DataStore (DashMap + tokio::watch), entity models. Published on crates.io |
| unifly | Single binary: CLI commands + unifly tui dashboard via feature flags, profile/keyring config, clap command routing, 8-screen ratatui dashboard with SilkCircuit theme |
Data Flow
Controller URL โโโถ Integration API โโโถ REST (API key auth)
Legacy API โโโโโโโโโถ REST (cookie + CSRF)
WebSocket โโโโโโโโโโถ Push events
โ
โผ
Controller
โโโโโโโโโโโโ
โ DataStore โ โโโ DashMap + watch channels
โ Refresh โ โโโ Background polling (30s)
โ Commands โ โโโ Action channel (mpsc)
โโโโโโโโโโโโ
โ
โโโโโโโโโโโโผโโโโโโโโโโโ
โผ โผ โผ
CLI out TUI render Event stream
The Controller (in unifly-api) wraps Arc<ControllerInner> for cheap cloning across async tasks. EntityStream<T> wraps tokio::watch::Receiver for reactive subscriptions so the TUI receives updates without polling.
โ๏ธ Configuration
Config lives in your platform-standard config directory:
| OS | Path |
|---|---|
| Linux | ~/.config/unifly/config.toml |
| macOS | ~/Library/Application Support/unifly/config.toml |
| Windows | %APPDATA%\unifly\config.toml |
= "home"
[]
= "table"
= "auto"
= false
= 30
[]
= "https://192.168.1.1"
= "default"
= "hybrid"
# API key + password stored in OS keyring
[]
= "https://10.0.0.1"
= "default"
= "legacy"
= "admin"
= true
๐ฆ Library
The engine is published on crates.io. Use it to build your own UniFi tools, integrations, or automations in Rust.
ยท Async HTTP/WebSocket transport, high-level Controller, reactive DataStore, domain models
Quick Start
Low-level API access ยท talk directly to the controller:
use ;
use SecretString;
let transport = new;
let client = from_api_key?;
let devices = client.list_devices.await?;
High-level Controller ยท reactive streams, automatic refresh, data merging:
use ;
use SecretString;
let config = ControllerConfig ;
let controller = new;
controller.connect.await?;
let devices = controller.devices.current;
println!;
Full API documentation on docs.rs/unifly-api.
๐ค AI Agent Skill
Install Options
What's Included
| Component | Description |
|---|---|
| unifly skill | Complete CLI reference, command patterns, output formats, automation tips |
| Network Manager agent | Autonomous agent for provisioning, diagnostics, and security audits |
| Reference docs | Command reference, UniFi networking concepts, workflow patterns |
๐ฆ Development
Prerequisites
- Rust 1.94+ (edition 2024)
- A UniFi Network controller (Cloud Key, Dream Machine, or self-hosted)
Build
Test & Lint
Run
Workspace Layout
crates/
unifly-api/ # Library: HTTP/WS transport, Controller, DataStore, domain models
unifly/ # Single binary: CLI commands + tui subcommand, config, profiles
Lint Policy
Pedantic clippy with unsafe_code = "forbid". See Cargo.toml workspace lints for the full configuration. It's opinionated and we like it that way.
โ๏ธ License
Apache-2.0. See LICENSE