StaxSys architecture and platform support
StaxSys separates UI-independent metric collectors from the blessed
terminal interface. src/index.js owns CLI parsing, input modes, refresh
timing, and rendering; collectors expose testable parsing and sampling logic.
config.js ──> index.js ──> system.js / diskio.js / network.js
merge TUI connections.js / process.js
│ │
blessed pure helpers and tests
Collectors that calculate rates retain their previous snapshot. The first sample establishes a baseline and subsequent samples calculate deltas.
Platform coverage
| Feature | Linux | macOS | Windows | BSD family |
|---|---|---|---|---|
| CPU, memory, disk capacity | Yes | Yes | Yes | Yes |
| Disk I/O rate | Yes | No | No | No |
| Network throughput | Yes | Yes | Yes, via PowerShell | No |
| Established connections per interface | Yes | No | No | No |
| Top processes | Yes | Yes, via ps |
Yes, via PowerShell | Yes, via ps |
Windows PowerShell process startup can make network and process samples slower than the configured interval. Linux-only disk I/O and connection rows report that they are unavailable elsewhere rather than synthesising a value.
Metric sources
| Metric | Source |
|---|---|
| CPU and load average | Node.js os.cpus() and os.loadavg() |
| Memory | os.totalmem() and os.freemem() |
| Disk capacity | fs.statfsSync() |
| Linux disk I/O | /proc/diskstats sector-counter deltas |
| Network | /proc/net/dev, macOS netstat -ib, or Windows Get-NetAdapterStatistics |
| Linux connections | /proc/net/tcp and /proc/net/tcp6 |
| Processes | Linux /proc, macOS/BSD ps, or Windows Get-Process |
Linux disk aggregation excludes partitions and loop, device-mapper, RAM, zram, and optical devices to avoid double-counting. Linux connection counts attribute established local addresses to interfaces; connections whose local address cannot be mapped are not counted.
Modules
| Module | Responsibility |
|---|---|
src/index.js |
CLI, terminal UI, input states, refresh loop, and rendering. |
src/system.js |
CPU, memory, and disk-capacity collectors. |
src/diskio.js |
Linux disk I/O sampling and chart rows. |
src/network.js |
Interface counters, throughput rates, and chart rows. |
src/connections.js |
Linux established-connection counts. |
src/process.js |
Process collection, sorting, and filtering. |
src/history.js |
Validated rolling JSON history and atomic writes. |
src/bars.js |
Shared bar and sparkline primitives. |
src/config.js |
Defaults, file/CLI merge, validation, and theme normalisation. |
Rendering and interaction boundaries
Threshold alerts are evaluated by the render layer; collectors do not know
about display thresholds. Network, disk I/O, and per-core CPU charts share
Unicode sparkline primitives. Network pages show at most four interfaces and
cycle automatically or when n is pressed.
Process search samples a pool of up to 500 processes before applying a
case-insensitive name-or-PID substring filter, so searches are not restricted
to the visible top rows. Raw terminal input is used because blessed does not
reliably report punctuation keys such as /.
For the complete implementation-level discussion, see the upstream architecture guide.