A comprehensive solution for managing multiple displays in office environments. This system allows centralized control of dashboards across multiple mini PCs, with automatic authentication handling and real-time monitoring.
Managing multiple displays in an office setting presents several challenges:
- Displays automatically turn off, losing displayed content
- Authentication sessions expire, requiring manual login on each device
- Time-consuming process to configure each display individually via TeamViewer
- No centralized way to monitor or manage all displays
This system provides:
- HTTP Registration: Host agents register with web admin via HTTP heartbeats
- Centralized Web Admin: Manage all displays from a single interface
- gRPC Communication: Fast, efficient command execution via gRPC
- Automated Window Control: Open dashboards in kiosk mode using Electron
- Cookie Synchronization: Share authentication across all devices
- Real-time Monitoring: SSE-based updates for live status tracking
- System Tray Integration: Easy access to host agent controls
- Auto-update System: Keep all agents updated automatically
- Single Instance Protection: Prevents multiple instances from running simultaneously
- Prevents Duplicate Instances: Only one host agent can run per mini PC
- Port Conflict Prevention: Automatically checks port availability before starting
- Automatic Cleanup: Removes stale lock files from crashed processes
- Production Ready: Ideal for production environments where service uniqueness is critical
- Multi-Monitor Support: Handles multiple displays per mini PC
- Kiosk Mode: Full-screen dashboard display with Chromium
- Automatic Recovery: Restores displays after power loss or system restart
- Display Identification: Visual overlay showing display numbers (Ctrl+Shift+D)
- Per-Display Controls: Open, refresh, restart, remove dashboards individually
- Screenshot Capture: Take screenshots of any display remotely
- gRPC Commands: Fast, reliable command execution
- HTTP Heartbeats: 30-second interval status updates
- SSE Updates: Server-Sent Events for live UI updates
- Status Polling: Hybrid approach for offline detection
- Smart Status Detection: Automatically detects disconnected hosts
- Visual Cookie Editor: Easy-to-use interface for cookie management
- Domain-based Sync: Share authentication across all devices
- Secure Storage: Cookies stored per domain
- Bulk Operations: Sync cookies to multiple hosts simultaneously
- Real-time Metrics: CPU, memory, uptime tracking
- Live Logs: View host logs via gRPC in terminal-style UI
- Debug Overlay: System metrics and display info on screen
- Health Checks: Automated health monitoring
- Color-coded Status: Visual indicators for host/display states
-
Web Admin (Next.js): Centralized web interface for management
- Dashboard management UI
- Host monitoring and control
- Cookie editor and sync
- PostgreSQL database for persistence
- SSE for real-time updates
-
Host Agent (Electron): Desktop application running on each mini PC
- System tray integration
- gRPC server for commands (port 8082)
- Window management (Chromium-based)
- HTTP client for heartbeats
- Auto-updater
- Debug overlay
[Web Admin]
โ
โโโ HTTP POST /api/hosts/heartbeat โโโโ [Host Agent] (every 30s)
โ (status, metrics, displays)
โ
โโโ gRPC :8082 โโโโโโโโโโโโโโโโโโโโโโโ [Host Agent]
โ (commands: open, refresh, restart, screenshot, logs, etc.)
โ
โโโ SSE /api/hosts/events โโโโโโโโโโโโโ [Browser]
(real-time updates)
[Host Agent] โ [Display 1, Display 2] (Chromium windows)
[Web Admin:3000] โโgRPC/HTTPโโ> [Mini PC 1:8082] โโ> [Display 1, Display 2]
[Mini PC 2:8082] โโ> [Display 3, Display 4]
[Mini PC 3:8082] โโ> [Display 5, Display 6]
[Mini PC 4:8082] โโ> [Display 7, Display 8]
- Mini PCs with dual HDMI outputs (Dell or equivalent)
- Displays connected via HDMI
- Network connectivity between all devices
- Windows 10/11 on mini PCs
- Node.js 18+ on all devices
- Electron runtime (included in application)
- Local network connectivity between Web Admin and host agents
- Port 8082 (gRPC) open on each mini PC
- Port 3000 (Web Admin) accessible from your browser
- Firewall configured to allow HTTP/gRPC traffic
From the root directory:
# Install all dependencies
npm install
# Start both services in development mode
npm run devThis will automatically:
- Install dependencies for both web-admin and host-agent
- Start both services concurrently with colored output
- Web Admin: http://localhost:3000
- Host Agent gRPC: localhost:8082
Test the single instance functionality:
# Windows
scripts\test-single-instance.bat
# Linux/macOS
node scripts/test-single-instance.jsThis will demonstrate:
- First instance starts successfully
- Second instance is blocked
- Resources are properly cleaned up
From the root directory:
npm run dev- Start both services in development modenpm run dev:web- Start only web-adminnpm run dev:host- Start only host-agentnpm run build- Build both services for productionnpm run start- Start both services in production mode
cd web-admin
npm install
# Set environment variables
cp .env.example .env.local
# Edit .env.local with your database URL and web admin URL
npm run dev # Development
# OR
npm run build # Production
npm start # ProductionThe web interface will be available at http://localhost:3000
Environment Variables:
DATABASE_URL=postgresql://user:password@localhost:5432/displayops
WEB_ADMIN_URL=http://localhost:3000cd host-agent
npm install
npm run dev # Development with hot reload
# OR
npm run build # Build for production
npm run package # Create installer (DisplayOps Host Agent Setup.exe)Initial Configuration:
- On first run, agent will prompt for Web Admin URL
- Agent ID is auto-generated based on hostname
- gRPC server starts on port 8082
- System tray icon appears for easy access
cd web-admin
# Install PostgreSQL (if not already installed)
# Create database
createdb displayops
# Run migrations
npm run migrate- Access the web admin interface at http://localhost:3000
- Navigate to "Dashboards" page
- Click "Add Dashboard" to create a new dashboard
- Configure:
- Dashboard name and URL
- Refresh interval
- Category (optional)
- Save dashboard
- Go to "Hosts" page to see all connected mini PCs
- Click on a host to view details
- For each display:
- Click "Open Dashboard" to assign a dashboard
- Select dashboard from the list
- Use "Refresh", "Restart", or "Remove" as needed
- Take screenshots to verify display content
- Navigate to "Cookies" page in web admin
- Select a domain or create a new one
- Click "Edit Cookies" to open the cookie editor
- Add/edit cookies in JSON format or use the visual editor
- Click "Sync to Hosts" to push cookies to all agents
- Verify sync status in the hosts list
- Real-time Updates: Status, metrics, and displays update automatically via SSE
- Color-coded Status:
- ๐ข Green = Online
- ๐ด Red (pulsing) = Offline
- ๐ก Orange = Stale data (>2 minutes)
- Metrics Cards: CPU, Memory, Status, Display count
- Per-Display Actions: Open, Refresh, Restart, Remove, Screenshot
- Live Logs: Click "Load Logs" to view host logs in real-time
- Debug Overlay (Ctrl+Shift+D on mini PC): Shows system metrics and display info on screen
- Display Identification: Click "Identify Displays" to show numbers on all screens
- Screenshot Capture: Take screenshots of any display remotely
- Log Viewer: View last 100 log entries with level filtering
- Health Checks: Automated system health monitoring
office_tv/
โโโ web-admin/ # Next.js web interface
โ โโโ src/
โ โ โโโ pages/ # Next.js pages and API routes
โ โ โโโ components/# React components
โ โ โโโ lib/ # gRPC client, repositories
โ โ โโโ contexts/ # React contexts (Toast, etc.)
โ โ โโโ types/ # TypeScript types
โ โโโ database/ # PostgreSQL schema
โ โโโ migrations/ # Database migrations
โ
โโโ host-agent/ # Electron desktop app for mini PCs
โ โโโ src/
โ โ โโโ main.ts # Electron main process
โ โ โโโ managers/ # Window, config, tray managers
โ โ โโโ services/ # gRPC, registry, state services
โ โ โโโ preload/ # Preload scripts
โ โ โโโ renderer/ # Debug overlay, cookie editor
โ โโโ release/ # Built installers
โ
โโโ shared/ # Shared protobuf definitions
โ โโโ proto/ # gRPC protocol definitions
โ
โโโ docs/ # Documentation
โโโ scripts/ # Utility scripts
- All code and documentation in English
- TypeScript for type safety
- Follow ESLint and Prettier configurations
- See
.cursor/rules.mdfiles for specific guidelines
- Update shared types if needed
- Implement in appropriate module
- Update API documentation
- Add tests for new functionality
NODE_ENV=production
PORT=3000
DATABASE_URL=postgresql://user:password@localhost:5432/displayops
WEB_ADMIN_URL=http://your-admin-url:3000NODE_ENV=production
WEB_ADMIN_URL=http://admin-ip:3000
LOG_LEVEL=INFO # DEBUG, INFO, WARN, ERRORDevelopment Mode Features:
- When
NODE_ENVis not set toproduction, developer tools are enabled in browser windows - Press
F12in any dashboard window to toggle dev tools - Press
Ctrl+Shift+Dto open debug overlay for real-time monitoring - Dev tools are automatically disabled in production for security and performance
web-admin/.env.local: Web admin environment variableshost-agent/data/display-state.json: Display assignments and state (auto-generated)- Host agent settings stored in app data directory
Host not showing up in Web Admin
- Check if host agent is running (system tray icon visible)
- Verify Web Admin URL is configured correctly in host agent
- Check network connectivity between host and web admin
- Verify firewall allows HTTP traffic on port 3000
- Check web admin logs for heartbeat errors
Host shows as Offline
- Host status is calculated based on last heartbeat (30s interval)
- Host is marked offline if no heartbeat for >2 minutes
- Check if host agent is actually running
- Verify network connectivity
- Check host agent logs for errors
gRPC Commands Not Working
- Verify port 8082 is open on mini PC firewall
- Test gRPC connectivity:
telnet mini-pc-ip 8082 - Check host agent logs for gRPC errors
- Ensure host agent gRPC server started successfully
Window management fails
- Check Electron application is running properly (system tray icon)
- Verify display configuration in Windows Settings
- Test monitor setup with Windows display settings
- Check host agent logs for window manager errors
- Try "Identify Displays" to verify display detection
Authentication issues
- Use Cookie Editor to sync cookies from web admin
- Verify cookie domain matches dashboard URL domain
- Check that cookies are being set correctly in browser windows
- Re-sync cookies if session expires
Display not showing dashboard
- Check if dashboard URL is accessible from mini PC
- Verify display is detected (check Displays count in host details)
- Try "Identify Displays" to see if display is working
- Check for errors in host agent logs
- Take screenshot to verify what's actually showing
Database connection errors
- Verify PostgreSQL is running
- Check DATABASE_URL in .env.local
- Run migrations:
npm run migrate - Check web admin logs for database errors
Web Admin:
- Browser console (F12)
- Next.js server logs (terminal running npm run dev)
- Check
/api/hosts/[hostId]/logsendpoint for host logs
Host Agent:
- In-memory logs (last 1000 entries)
- View via Web Admin โ Host Details โ "Load Logs"
- Or check Electron console if running in dev mode
- Windows Event Viewer for crashes
Log Levels:
- ERROR: Critical issues requiring attention
- WARN: Potential problems
- INFO: Normal operations
- DEBUG: Detailed troubleshooting info
- gRPC-based architecture for commands
- HTTP heartbeat registration
- Electron-based window management
- Cookie synchronization with visual editor
- Web admin interface for management
- Real-time monitoring with SSE
- PostgreSQL database persistence
- System tray integration
- Debug overlay system
- Display identification
- Screenshot capture
- Live log viewing
- Per-display dashboard controls
- Auto-updater system
- Advanced scheduling features (time-based dashboard switching)
- Alert system (email/SMS notifications)
- Dashboard rotation/playlist
- Custom display layouts
- Mobile app for quick control
- Performance analytics and reporting
- Backup and restore configuration
- Cloud deployment (Vercel/AWS)
- Multi-tenant support
- Advanced analytics dashboard
- Multi-location/site management
- Integration with office automation systems
- API for third-party integrations
- Role-based access control (RBAC)
- Follow the development guidelines in
.cursor/rules.md - Create feature branches for new functionality
- Include tests for new features
- Update documentation as needed
Internal project - All rights reserved