Skip to main content

Control Center Architecture

The UniPulse Control Center is a standalone internal ops dashboard that runs independently from the main Pulse application on PM2. It provides real-time infrastructure monitoring, Docker management, CI/CD tracking, and team task management.


Why Standalone?

The Control Center monitors Pulse's Docker containers and VPS health. If it ran inside Docker alongside Pulse, a container crash would take down the monitoring tool. By running on PM2, it survives all Docker-related failures and can be used to diagnose and recover from outages.


Tech Stack

LayerTechnologyDetails
FrontendReact 19, Vite 7, TypeScript, shadcn/ui, Tailwind v4Same stack as Pulse for consistency
BackendExpress 4, TypeScriptREST API + Socket.IO
DatabaseSQLite + Prisma (7 models)Lightweight, no external DB dependency
Real-timeSocket.IO (3 namespaces)Live metrics, Docker events, notifications
Process ManagerPM2Auto-restart, memory limits, JSON logging
AuthJWT (15m access + 7d refresh with rotation)Google OAuth via whitelist
Reverse ProxyNginxSSL, rate limiting, WebSocket proxy

Database Models (SQLite -- 7 Models)

ModelPurposeKey Fields
UserAuthenticated team membersemail, name, role, lastLogin
SessionActive JWT sessionsuserId, refreshToken, expiresAt
AuditLogAll actions logged with actoruserId, action, resource, details, timestamp
MetricSnapshotVPS metrics historycpu, memory, disk, network, timestamp
SettingApp configurationkey, value, updatedBy
NotificationAlerts and notificationstype, title, message, read, createdAt
TaskKanban task trackertitle, description, status, assigneeId, priority

Services

ServiceResponsibilityKey Functions
docker.serviceDocker Engine API interactionlistContainers(), start(), stop(), restart(), remove(), logs(), stats(), inspect(), images(), systemInfo()
vps.serviceSystem metrics collectionCPU, memory, disk, network via systeminformation library
metrics.serviceMetrics collection and storage3-second collection interval, 60-second storage interval, 30-day retention
github.serviceGitHub API integrationPull requests, workflow runs, CI stats across repos
auth.serviceAuthentication with token rotationJWT 15-minute access tokens, 7-day refresh tokens with rotation
tasks.serviceKanban task managementCRUD with status transitions
notifications.serviceAlert systemCreate, read, dismiss notifications
audit.serviceAudit trailLog all actions with user context

Task Statuses (Kanban)

TODO -> IN_PROGRESS -> IN_REVIEW -> DONE

Socket.IO Namespaces

All Socket.IO connections require JWT authentication:

NamespaceEvents EmittedFrequencyPurpose
/metricsvps:metricsEvery 3 secondsReal-time CPU, memory, disk, network data
/dockercontainer:status, container:statsOn change + every 5sContainer lifecycle events and resource usage
/notificationsnotification:newOn eventReal-time alert delivery
// Client connection with JWT auth
const socket = io('/metrics', {
auth: { token: accessToken },
});

socket.on('vps:metrics', (data) => {
// { cpu: 45.2, memory: { used: 3.2, total: 8 }, disk: [...], network: [...] }
updateCharts(data);
});

Frontend Pages

PageRouteDescription
Home/Overview dashboard with key metrics
VPS Monitor/vpsReal-time CPU, memory, disk, network charts
Docker Manager/dockerContainer list with actions (start, stop, restart, logs)
Social Stats/social-statsSocial platform metrics overview
Task Tracker/tasksKanban board (TODO, IN_PROGRESS, IN_REVIEW, DONE)
PR Tracking/prsOpen PRs across repositories with review status
CI Analysis/ciGitHub Actions success rates, build times
Deployments/deploymentsDeployment history log
Notifications/notificationsAlert history and management
Settings/settingsApp configuration, GitHub token, allowed emails
Login/loginGoogle OAuth login

Authentication Flow

Email Whitelist

Only emails listed in the ALLOWED_EMAILS environment variable can access the Control Center. This is a critical security control for the ops dashboard.


Architecture Diagram


Cross-Reference