Creating visual displays for Node.js server on local machine

I’m working on a project where I need to set up a Node.js application that controls two separate monitors connected to the same physical computer. This is different from typical web servers because everything runs locally on one machine.

The setup involves a Node.js backend that needs to display different content on each screen. The whole system will be packaged as a portable solution for clients. I’m planning to use a CDN for static assets while keeping the main server local.

I’m trying to figure out the best approach to make Node.js communicate with GUI applications that will render content on both displays. Here are some ideas I’m considering:

const express = require('express');
const app = express();
const { spawn } = require('child_process');

// Start display manager
const displayManager = spawn('display-app.exe', ['--dual-screen']);

app.get('/update-screen/:id', (req, res) => {
  const screenId = req.params.id;
  const data = req.body;
  
  // Send commands to display application
  displayManager.stdin.write(`UPDATE_SCREEN:${screenId}:${JSON.stringify(data)}\n`);
  res.json({ success: true });
});

Option 1: Build a wrapper application with embedded browser windows that connect to localhost endpoints served by Node.js

Option 2: Create a native application using a game engine that receives updates from Node.js through command line interface or file system communication

Which approach would work better for real-time updates between Node.js and the display applications? Are there other methods I should consider for this local dual-screen setup?

option 1’s definitely easier to pull off. electron might be overkill - you could just run chrome in kiosk mode and point each screen to different localhost ports. something like chrome --kiosk --display=1 http://localhost:3000/screen1 works great in my experience.

Interesting setup! Why not use websockets instead of CLI pipes for real-time communication? What’s your display-app.exe built with - custom code or existing tools? And what refresh rates are you targeting for content updates?

I did something similar with a hybrid setup - WebSockets plus desktop automation libraries. Skip the external processes and just use Node.js packages like robotjs or desktop-screenshot to handle window positioning and updates directly. Here’s what worked for me: run two Express servers on different ports, then use the open package to launch fullscreen browser windows on specific displays. Way simpler than dealing with inter-process communication, and you still get real-time updates through Socket.IO. I bundled everything with pkg and added browser launch scripts that auto-detect displays and position windows. Performance was great for dashboard content updating every few seconds.