Installation & Setup
Prerequisites
| Requirement | Version |
|---|---|
| Node.js | 18 or later |
| npm | 9 or later |
| MongoDB | 6 or later (local or MongoDB Atlas) |
Clone the repository
git clone https://github.com/ratava/PoolStat-Scoreboard-PWA.git
cd PoolStat-Scoreboard-PWA
npm install
Environment variables
Create a .env file in the project root (never commit this file):
# MongoDB connection string
MONGODB_URI=mongodb://localhost:27017/poolstat
# Session secret — use a long random string
SESSION_SECRET=change-me-to-a-long-random-string
# Admin password for /admin.html
ADMIN_PASSWORD=your-admin-password
# Competition login password for /competition.html
COMPETITION_PASSWORD=your-competition-password
# MQTT broker connection
MQTT_BROKER_URL=wss://your-broker-host:9001/
MQTT_USERNAME=your-mqtt-username
MQTT_PASSWORD=your-mqtt-password
# YouTube OAuth (optional — required only for YouTube integration)
YOUTUBE_CLIENT_ID=your-google-client-id
YOUTUBE_CLIENT_SECRET=your-google-client-secret
YOUTUBE_REDIRECT_URI=http://localhost:3000/auth/youtube/callback
# Facebook agent (optional)
FACEBOOK_GROUP_URL=
# Environment
NODE_ENV=development
PORT=3000
Start the server
npm start
Open http://localhost:3000 in your browser.
Deploying to Render
The PWA is designed for deployment on Render:
- Create a new Web Service on Render
- Connect to the GitHub repository
- Set Build Command:
npm install - Set Start Command:
node server.js - Add all environment variables from the list above under Environment
- Set
NODE_ENV=production - Deploy
For MongoDB, use MongoDB Atlas and set the MONGODB_URI to your Atlas connection string.
OBS browser source setup
On each OBS machine that will be a rig:
- In OBS, add a Browser Source to your scene
- Set the URL to:
https://your-server-url/browser-source.html?rigId=your-rig-idReplace
your-rig-idwith the Rig ID you will configure in Admin. - Set width to 1920 and height to 1080 (or your stream resolution)
- Enable Shutdown source when not visible — OFF
- Enable Refresh browser when scene becomes active — optional
The browser source must remain loaded (even if not visible) to receive MQTT commands. It does not need to be in the currently active scene.