Skip to main content
psys is a real-time process and network connection monitoring tool built with Next.js 15 and the App Router. It visualizes which processes expose ports (LISTEN) and how they connect to other services (ESTABLISHED).

Stack

psys uses modern web technologies for a fast and responsive experience:

Framework

Next.js 15.0.0 with App Router and React 19.0.0

Language

TypeScript 5.x with strict mode enabled

Styling

Tailwind CSS 3.4 with custom theme and animations

UI Library

shadcn/ui components built on Radix UI

Key Dependencies

package.json (excerpt)

Architecture Overview

Data Flow

psys follows a straightforward data collection and rendering pipeline:
  1. Data Collection (lib/connections.ts)
    • Executes ss -tlnp to get listening ports
    • Executes ss -tnp to get established connections
    • Reads process info from /proc/{pid}/comm and /proc/{pid}/cmdline
    • Queries Docker containers via docker ps for container labels
    • Parses and normalizes addresses, ports, and process names
  2. API Layer (app/api/connections/route.ts)
    • Exposes GET endpoint at /api/connections
    • Calls getConnectionsData() from lib/connections.ts
    • Returns JSON with listeners and connections arrays
    • Marked as dynamic = "force-dynamic" for real-time data
  3. Frontend (components/connections-dashboard.tsx)
    • Fetches data from API every 5 seconds
    • Transforms data into React Flow nodes and edges
    • Renders dual views: interactive diagram and sortable table
    • Provides process kill functionality via /api/connections/kill

File Structure

Next.js Configuration

The Next.js configuration is minimal, optimized for development experience:
next.config.ts
  • devIndicators: Disabled for cleaner UI during development
  • outputFileTracingRoot: Ensures proper file tracing for standalone builds

TypeScript Configuration

psys uses strict TypeScript with ES2017 target:
tsconfig.json
Path aliases use @/* for clean imports throughout the codebase.

Development Scripts

The start:bg script runs the app on port 30999 in the background using nohup, perfect for long-running monitoring.

Platform Requirements

psys requires Linux with the ss command (from iproute2) and access to the /proc filesystem. It will not work on macOS or Windows.
Optional dependencies:
  • Docker: For container name detection and labeling
  • Permissions: To see all system processes, run with elevated privileges (not recommended for daily use)

Data Types

The core data structures defined in lib/connections.ts:5-33:

Rendering Strategy

  • Client-side rendering: The main dashboard is a client component ("use client") for real-time updates
  • Dynamic API routes: All API routes use export const dynamic = "force-dynamic" to prevent caching
  • Polling: The frontend polls /api/connections every 5 seconds for fresh data
  • React Flow: Nodes and edges are computed client-side from the connections data