Skip to main content
psys uses a component-based architecture with React 19 and shadcn/ui. The main components handle data fetching, visualization, and user interactions.

Main Components

ConnectionsDashboard

The primary component that orchestrates the entire UI. Located at components/connections-dashboard.tsx:142. Features:
  • Fetches connection data from /api/connections every 5 seconds
  • Manages React Flow nodes and edges state
  • Provides tab navigation between diagram and table views
  • Handles process termination via kill button
Key State:
Props: No props - this is a top-level component rendered directly by app/page.tsx.

React Flow Nodes

psys defines two custom node types for the diagram view:

ListenerNode

Represents a process listening on a port. Defined at components/connections-dashboard.tsx:44. Props:
Rendering:
  • Border with primary color accent
  • Process icon + optional Docker icon
  • Service label with optional “(typical: X)” suffix
  • Port number below label
  • Source handle on the right for connections
Example:

TargetNode

Represents a connection target (service being connected to). Defined at components/connections-dashboard.tsx:66. Props:
Rendering:
  • Muted border and background
  • Service label (e.g., “MongoDB”)
  • Address:port below label
  • Target handle on the left for incoming connections

Icon Components

ProcessIcon

Dynamic icon component that displays the appropriate logo based on process type. Located at components/process-icon.tsx:30. Props:
Icon Mapping: Usage:

DockerIcon

Displays the Docker whale logo for containerized processes. Located at components/docker-icon.tsx:5. Props:
Usage:

shadcn/ui Components

psys uses shadcn/ui components for consistent styling. All components are in components/ui/.

Card

Location: components/ui/card.tsx Components:
  • Card - Container wrapper
  • CardHeader - Header section
  • CardTitle - Title text
  • CardContent - Main content area
Usage in psys:
components/connections-dashboard.tsx:245

Table

Location: components/ui/table.tsx Components:
  • Table - Table wrapper
  • TableHeader - Header row container
  • TableBody - Body rows container
  • TableRow - Individual row
  • TableHead - Header cell
  • TableCell - Data cell
Usage in psys:
components/connections-dashboard.tsx:275

Badge

Location: components/ui/badge.tsx Variants:
  • default - Primary style
  • secondary - Muted style
  • destructive - Error style
  • outline - Outlined style
Usage in psys:
components/connections-dashboard.tsx:339

Button

Location: components/ui/button.tsx Variants: default, destructive, outline, secondary, ghost, link Sizes: default, sm, lg, icon Usage in psys:
components/connections-dashboard.tsx:225

Tabs

Location: components/ui/tabs.tsx Components:
  • Tabs - Container
  • TabsList - Tab buttons container
  • TabsTrigger - Individual tab button
  • TabsContent - Content for each tab
Usage in psys:
components/connections-dashboard.tsx:233

Service Logos

All service logos are in components/ui/svgs/ and follow a consistent API: Available SVGs:
  • nodejs.tsx - Node.js logo
  • nextjsIconDark.tsx / nextjsLogoLight.tsx - Next.js logos
  • redis.tsx - Redis logo
  • mongodbIconLight.tsx / mongodbIconDark.tsx / mongodbWordmarkLight.tsx / mongodbWordmarkDark.tsx - MongoDB variations
  • postgresql.tsx / postgresqlWordmarkLight.tsx / postgresqlWordmarkDark.tsx - PostgreSQL variations
  • mysqlIconLight.tsx / mysqlIconDark.tsx / mysqlWordmarkLight.tsx / mysqlWordmarkDark.tsx - MySQL variations
  • docker.tsx - Docker whale logo
Props:

Component Utilities

buildFlow

Transforms ConnectionsData into React Flow nodes and edges. Located at components/connections-dashboard.tsx:78. Signature:
Algorithm:
  1. Create listener nodes (left side) with vertical spacing
  2. Build a map of unique connection targets
  3. Create target nodes (right side) for each unique target
  4. Create edges from listeners to targets
  5. Deduplicate edges to prevent visual clutter
Node Positioning:
  • Listeners: x: 40, y: 40 + index * (NODE_HEIGHT + GAP)
  • Targets: x: 40 + LISTENER_NODE_WIDTH + 120, y: 40 + index * (NODE_HEIGHT + GAP)
React Flow handles node dragging and viewport controls automatically. The fitView prop ensures all nodes are visible on initial render.