Self-hosted RTMP ingest, streaming dashboard, and recording management
  • JavaScript 79%
  • CSS 11.6%
  • PowerShell 3.7%
  • XSLT 2.9%
  • HTML 2.5%
  • Other 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-01 03:23:30 +02:00
frontend Initial RTMP site import 2026-09-27 08:19:10 +02:00
nginx Initial RTMP site import 2026-09-27 08:19:10 +02:00
.gitattributes Initial RTMP site import 2026-09-27 08:19:10 +02:00
.gitignore Initial RTMP site import 2026-09-27 08:19:10 +02:00
README.md updated readme 2026-10-01 03:23:30 +02:00
start-prod.bat Initial RTMP site import 2026-09-27 08:19:10 +02:00
start-prod.ps1 Initial RTMP site import 2026-09-27 08:19:10 +02:00
start.bat Initial RTMP site import 2026-09-27 08:19:10 +02:00
start.ps1 Initial RTMP site import 2026-09-27 08:19:10 +02:00
stop-prod.bat Initial RTMP site import 2026-09-27 08:19:10 +02:00
stop-prod.ps1 Initial RTMP site import 2026-09-27 08:19:10 +02:00
stop.bat Initial RTMP site import 2026-09-27 08:19:10 +02:00
stop.ps1 Initial RTMP site import 2026-09-27 08:19:10 +02:00

VRCDJ Live

A self-hosted broadcast control room for live VR DJ events.

Publish from OBS, manage operators and live sets, and deliver HLS playback to browser previews and VR worlds.

Features · Architecture · Setup · Deployment · Documentation

About the project

VRCDJ Live is a Windows-first streaming platform built to make running virtual DJ events less fragmented. It brings account management, per-operator stream keys, live status, browser previews, VR-ready playback links, set archives, and platform administration into one interface.

The project began as a PHP-based RTMP utility and has grown into a React and Node.js application backed by nginx-rtmp and FFmpeg. It is both a working self-hosted service and an exploration of the systems behind a small live-streaming platform: ingest authentication, media transcoding, session state, access control, and operational tooling.

The main user is an event operator who needs to answer a few practical questions quickly: where to send OBS, whether the stream is actually arriving, which URL the world player should use, and whether the set has been saved. The administrator sees the same system at platform level, including accounts, active broadcasts, traffic, and moderation actions.

The repository brings together the web interface and the processes behind it. Its value as a software project is the coordination between application state and a real media pipeline, rather than a standalone dashboard backed by simulated status.

Features

  • Operator dashboard with OBS connection details, masked stream keys, live health, and in-browser HLS preview
  • RTMP ingest authentication using per-user keys and nginx HTTP callbacks
  • Dual HLS output tuned separately for dashboard preview and VR world playback
  • Automatic set recording with downloadable archives and configurable retention
  • Account lifecycle including registration, invite-only access, email verification, password recovery, and session revocation
  • Admin control room for live-stream monitoring, user moderation, key rotation, invite credits, traffic metrics, and audit history
  • Flexible persistence with MySQL in production and a zero-setup JSON store for local development
  • Operational scripts for starting and stopping the complete development or production stack on Windows

Before, during, and after a set

Before going live, an operator signs in, configures booth metadata, and copies the OBS endpoint and private stream key. While broadcasting, the dashboard reports ingest state and presents an HLS preview, alongside the playback manifest intended for a VR world.

When the ingest session ends normally, the recording pipeline finalizes a downloadable set archive. Archives include session metadata, size, and expiry information so operators can retrieve recordings within the configured retention window.

Administration and account management

The admin panel combines live-session visibility with a user directory, registration controls, invitations, key resets, account disabling, and stream-worker termination. A separate private audit trail records administrative actions, independently of the recent activity feed.

Email verification and password recovery are optional SMTP-backed workflows. Registration can remain open or switch to invitations. Display names, world names, and current set names are editable without changing the underlying ingest key.

How it works

flowchart LR
    OBS[OBS / RTMP encoder] -->|RTMP :1935| NGINX[nginx-rtmp]
    NGINX -->|publish callbacks| API[Node.js / Express API]
    API -->|authenticate and persist| STORE[(MySQL or local JSON)]
    API -->|start and monitor| FFMPEG[FFmpeg workers]
    NGINX -->|Local RTMP pull| FFMPEG
    FFMPEG -->|HLS manifests and segments| NGINX
    NGINX -->|HLS :8081| WORLD[VR world / media player]
    NGINX -->|HLS preview| UI[React dashboard]
    UI <-->|REST API :8787| API

When an operator starts broadcasting, nginx sends the stream key to the API. The API authenticates the publisher, records the live session, and launches FFmpeg workers that pull the local RTMP feed. FFmpeg creates short HLS playlists for the dashboard and VR playback; nginx serves those files while the React interface reports live state and stream health.

Publish lifecycle

  1. OBS connects to the nginx live application using the account's stream key.
  2. The publish-start callback checks the key, opens a stream session, and starts preview and recording work.
  3. Heartbeats update the session and can reattach missing media workers.
  4. The browser polls application status and plays the dashboard rendition through hls.js.
  5. On a normal disconnect, the stop callback marks the session offline and finalizes the recording.

The media paths are deliberately distinct. Dashboard manifests use /hls/preview/<token>/playlist.m3u8, while world manifests use /hls/world/<token>/playlist.m3u8. Both are generated by FFmpeg and served as files by nginx.

An API health response, a live RTMP publisher, and a playable HLS manifest are separate checks. A stream can reach nginx successfully while the FFmpeg worker fails, so the interface exposes pipeline state as well as ingest state.

Engineering decisions

HTTP callbacks bridge nginx and the application

The supplied Windows nginx-rtmp configuration uses HTTP notifications rather than process execution hooks. This lets the API authenticate stream keys and coordinate media workers through the same application and storage layer used by the dashboard.

Two renditions serve different playback contexts

The dashboard and VR world output have separate encoder, profile, resolution, bitrate, and audio settings. This allows the operator preview and the world player to make different quality and compatibility tradeoffs. Short HLS playlists reduce buffering relative to longer playlists, but actual latency still depends on the encoder, player, and network.

One storage interface, two operating modes

The API chooses between a local JSON store and a MySQL adapter. JSON lowers the setup cost for exploring account and dashboard flows; production deliberately requires MySQL. The MySQL adapter preserves compatibility with the legacy user table and creates additional console tables around it.

Recording and playback have different lifecycles

HLS output is transient playback data. Set recordings are longer-lived files associated with completed sessions and retention metadata. The recording code uses an intermediate .part.mkv file before finalizing an MP4; an interrupted recording is therefore a different state from a completed downloadable archive.

Project scope

This repository covers the full path from an authenticated RTMP publisher to an HLS consumer. It includes the operator-facing application, API, ingest callbacks, media-worker orchestration, local and database storage adapters, administrative workflows, and Windows service scripts.

It is designed for a single self-hosted installation rather than a multi-region streaming network. The current process-managed FFmpeg workers are practical for a small deployment, but larger installations should move media jobs into a dedicated supervisor or queue. Playback URLs are tokenized but are not yet protected by production-grade signed manifests. See Current limitations for the remaining hardening work.

Area Included Boundary
Operator workflow Account access, OBS setup, booth metadata, preview, playback links OBS and the VR player remain external applications.
Ingest Per-account keys and publish/stop/heartbeat callbacks The example config defines the primary live application only.
Media FFmpeg HLS renditions and set recordings No distributed worker queue or adaptive bitrate ladder is provided.
Administration User controls, invites, traffic visibility, activity, audits Media-worker termination is not a claim of nginx publisher eviction.
Hosting Windows startup scripts and reverse-proxy routing Multi-region delivery and CDN operations are outside the current design.

Technology

Layer Technology
Interface React 18, Vite, hls.js
API Node.js, Express
Authentication Token sessions, bcrypt password hashing
Persistence MySQL or local JSON
RTMP ingest nginx with the nginx-rtmp module
Media pipeline FFmpeg, H.264/AAC, HLS
Email Nodemailer with an SMTP provider
Operations PowerShell and Windows batch scripts

Repository layout

.
├── frontend/
│   ├── public/              # Brand assets
│   ├── src/                 # React application and UI components
│   ├── server/              # Express API, storage, email, and media pipeline
│   └── scripts/             # Development runtime helpers
├── nginx/
│   ├── conf/                # RTMP ingest, callbacks, stats, and HLS serving
│   └── html/                # nginx status-page assets
├── ffmpeg/                  # Local FFmpeg installation (ignored by Git)
├── recordings/              # Generated set archives (ignored by Git)
├── start.ps1 / start.bat    # Development launcher
├── start-prod.ps1 / .bat    # Production launcher
├── stop.ps1 / stop.bat      # Development shutdown
└── stop-prod.ps1 / .bat     # Production shutdown

Getting started

Prerequisites

The supplied launch scripts target Windows 10/11 or Windows Server. You will need:

  • Node.js 22 or newer with npm
  • FFmpeg for Windows, placed at ffmpeg/ffmpeg.exe
  • A Windows nginx build that includes the nginx-rtmp module, placed at nginx/nginx.exe
  • OBS Studio or another RTMP encoder for an end-to-end broadcast test
  • MySQL 8+ for production; local development can use the built-in JSON store
  • An NVIDIA GPU for the default NVENC configuration, or the software-encoding override described below

Third-party executables and generated media are intentionally excluded from Git. A sanitized nginx configuration template, helper scripts, and web assets remain in the repository; the local nginx.exe binary and deployment configuration need to be supplied.

1. Install the application

git clone <your-repository-url> rtmp-site
Set-Location "rtmp-site\frontend"
npm ci

2. Create a local environment file

Copy-Item .env.example .env

For a minimal local setup, update these values in frontend/.env:

APP_ENV=development
PUBLIC_DOMAIN=127.0.0.1
RTMP_HOST=127.0.0.1
CALLBACK_BASE_URL=http://127.0.0.1:5173
WORLD_PREVIEW_BASE_URL=http://127.0.0.1:5173/hls/world
DB_ENABLED=false
EMAIL_VERIFICATION_REQUIRED=false
INGEST_WEBHOOK_SECRET=replace-with-a-long-random-value

The default media profile uses NVIDIA NVENC. On a machine without a compatible NVIDIA GPU, add:

PREVIEW_VIDEO_ENCODER=libx264
WORLD_VIDEO_ENCODER=libx264
PREVIEW_PRESET=ultrafast
WORLD_PRESET=ultrafast

The explicit WORLD_PREVIEW_BASE_URL makes local world links use HTTP on the Vite port. Without it, the application constructs an HTTPS URL from PUBLIC_DOMAIN, which is unsuitable for a plain-HTTP development server. For a player on another device, use a reachable host and appropriate network access instead of 127.0.0.1.

Never commit frontend/.env; it may contain database, SMTP, and ingest credentials.

3. Configure the ingest callbacks

For a new checkout, create your local nginx configuration from the sanitized template. Preserve an existing deployment configuration instead of overwriting it:

Copy-Item ..\nginx\conf\nginx.conf.example ..\nginx\conf\nginx.conf

Open nginx/conf/nginx.conf and make the secret query parameter on all three callback URLs match INGEST_WEBHOOK_SECRET:

  • /api/ingest/publish-start
  • /api/ingest/publish-stop
  • /api/ingest/heartbeat

Use a new secret for every deployment. Do not publish a production secret in the nginx configuration of a public repository.

4. Start the development stack

Return from frontend to the repository root and launch the stack:

Set-Location ..
.\start.ps1

You can also double-click start.bat. The launcher starts Vite, the Express API, and nginx.

Service Local address
Web application http://127.0.0.1:5173
API health check http://127.0.0.1:8787/api/health
nginx RTMP stats http://127.0.0.1:8081/stat
RTMP ingest rtmp://127.0.0.1:1935/live

Stop the stack with:

.\stop.ps1

5. Test a broadcast with OBS

  1. Register an operator account in the web application and sign in.
  2. Copy the OBS server address and stream key shown in the dashboard.
  3. In OBS, open Settings → Stream, choose Custom, and paste both values.
  4. Start streaming. The dashboard should move to a live state after the nginx callback is accepted.
  5. Verify the HLS preview in the dashboard and the world playback URL shown for the session.

If the API sees the stream but no preview appears, check that FFmpeg can use the configured encoder and that ports 1935 and 8081 are available.

Configuration

A deployment template lives in frontend/.env.example. The most important groups are:

Group Examples Purpose
Application APP_ENV, PUBLIC_DOMAIN, PORT Runtime mode, public host, and API binding
Ingest RTMP_HOST, RTMP_APP, INGEST_WEBHOOK_SECRET OBS endpoint and callback authentication
Media FFMPEG_PATH, HLS_OUTPUT_ROOT, PREVIEW_*, WORLD_* Transcoding, rendition quality, and HLS output
Storage DB_ENABLED, DB_HOST, DB_NAME, DB_USER MySQL connection or local JSON selection
Email SMTP_*, EMAIL_* Verification and password-reset delivery
Security TRUST_PROXY, API_SESSION_TTL_HOURS, RATE_LIMIT_* Proxy handling, session lifetime, and abuse limits

Media settings

The example environment enables NVENC and sets the preview to 1920 × 1080 at 30 fps, with a separate 854 × 480 world output. The code's fallback settings differ from some template values, so compare the environment template with the configuration module when tuning a deployment.

Both rendition encoders must match the host's capabilities. Software encoding with libx264 is supported, but CPU use grows with resolution and the number of simultaneous streams. The one-second segments and four-entry playlist are output settings, not a guarantee of one-second viewer latency.

Administrative access and email

Stored user roles control admin access. ADMIN_USERNAMES can bootstrap or promote configured usernames; treat it as a privileged deployment setting and reserve those account names. Configure SMTP and the verification/reset URL bases before requiring email verification.

Ports and application names

Changing PORT, the RTMP application name, or the nginx HTTP port requires corresponding edits to nginx callbacks, Vite proxy targets, and reverse-proxy routes. These files do not automatically synchronize from the environment file. A BACKUP_APP setting exists, but the example nginx configuration does not define a backup ingest application.

Development and verification

Command Run from Purpose
.\start.ps1 / .\start.bat Repository root Start the development API, Vite, and nginx.
.\stop.ps1 / .\stop.bat Repository root Stop the managed development stack.
npm run dev frontend/ Start the API watcher and Vite; nginx must already be available.
npm run build frontend/ Build the React application into dist/.
npm run start:server frontend/ Run the API using the configured environment.
.\start-prod.ps1 Repository root Build and start the production processes.
.\stop-prod.ps1 Repository root Stop the production processes tracked by the scripts.

A frontend build verifies that the React source bundles, but does not validate database access, OBS authentication, encoding, or archive finalization. The package currently has no automated test command.

For an end-to-end check, register a local account, inspect /api/health, stream a short test through OBS, confirm both manifests become playable, then stop OBS and check the completed archive. Repeat with the software encoder if testing a host without NVENC.

The start/stop scripts reuse shared ports and manage tracked processes. Development startup can stop a production API occupying the configured development port; use separate instances if development and production must run simultaneously. The development launcher's printed API URL currently mentions port 8788, but the API, callbacks, and Vite configuration use 8787.

Deployment

Production mode requires MySQL; the JSON store is intentionally disabled when APP_ENV=production.

  1. On a new installation, copy frontend/.env.example to frontend/.env and provide production domain, database, SMTP, and ingest-secret values.
  2. Set APP_ENV=production, DB_ENABLED=true, and configure DB_HOST, DB_NAME, DB_USER, and DB_PASSWORD.
  3. Set the same ingest secret in the nginx callback URLs.
  4. Configure a public reverse proxy with TLS:
    • / → http://127.0.0.1:5173
    • /api → http://127.0.0.1:8787/api
    • /hls → http://127.0.0.1:8081/hls
  5. Run .\start-prod.ps1 from the repository root.

The production launcher builds the Vite bundle, starts the API and static frontend server in the background, starts nginx, records PIDs under .runtime, and performs basic health checks. Stop all managed services with .\stop-prod.ps1.

Keep ports 5173, 8787, and 8081 bound to loopback or protected by a firewall. Only the TLS reverse proxy and RTMP ingest port should be exposed intentionally.

Database prerequisite

The MySQL adapter expects the legacy users table to exist. It creates supporting tables for sessions, profiles, activity, invitations, verification, and archives, and adds the admin column to the user table. It does not create the base user table.

An empty MySQL database is therefore insufficient for the current production startup path. Provision or migrate the compatible user schema before enabling production, including the identity, username, email, password-hash, and stream-key fields expected by the adapter. A standalone initial-schema migration is still needed for a fully automated fresh production installation.

Reverse proxy and release behavior

Route /api and /hls before a catch-all frontend route when the proxy uses ordered matching. The static frontend server does not proxy these routes by itself. Set production world playback URLs to the externally reachable HTTPS origin.

A running production process is reused by the launcher if its tracked PID is still active. To apply server-code or environment changes, stop the managed production stack and then start it again during a suitable maintenance window. Review the API and web logs under .runtime/ after restart.

The scripts provide process startup and shutdown, not an operating-system service with automatic crash recovery. A long-running installation still needs external supervision and storage monitoring.

Data and recovery

Path or service Contents Recovery considerations
MySQL Production accounts, sessions, stream history, and administration records Back up with an appropriate database tool and preserve schema compatibility.
frontend/server/data/state.json Development JSON state Private local data; copied only when preserving a development instance.
recordings/ Completed archives and intermediate recordings Preserve alongside the database records that describe each archive.
nginx/tmp/hls/ Generated manifests and short-lived segments Runtime output; it is not a recording backup.
frontend/.env and nginx/conf/nginx.conf Credentials, paths, hosts, and callback configuration Keep private recovery copies and restore matching callback secrets.
.runtime/ and nginx/logs/ Process tracking and operational logs Useful for diagnosis; stale PIDs do not represent restorable service state.

SET_ARCHIVE_RETENTION_DAYS controls the archive retention window; the default is 30 days. Capacity planning should include concurrent encoders, transient HLS, and retained recordings. Downloads and expiry checks rely on both stored session metadata and files being present.

The repository does not include a full backup/restore orchestrator. Before a deployment migration, preserve database records, recordings, and private configuration together. An intermediate recording left after a crash should be investigated separately rather than assumed to be a finished archive.

Security and privacy

  • Rotate any credential that has previously appeared in source control; adding it to .gitignore does not remove it from Git history.
  • Use a long, unique INGEST_WEBHOOK_SECRET and keep the API bound to loopback behind a trusted reverse proxy.
  • Treat frontend/server/data/state.json as sensitive runtime data. It can contain users, hashed credentials, sessions, stream keys, and audit records and is ignored by the root .gitignore.
  • Generated HLS segments and recordings may contain private event footage. They are also ignored and should be protected with suitable filesystem access and retention policies.
  • Terminate public HTTP traffic with TLS and restrict the nginx statistics endpoint in an internet-facing deployment.

The playback token is part of a media path, and nginx serves generated HLS files directly. It is not equivalent to a signed authorization check on every segment request. Treat copied playback links as shareable access information.

The example nginx configuration permits RTMP playback. Anyone with the appropriate source path may be able to pull that feed if the RTMP service is reachable, so treat stream keys as secrets and design network exposure accordingly. Public status and statistics should disclose only the information intended for the audience.

Current limitations

  • FFmpeg workers run inside the API process; after a complete API restart, an active publisher needs the next nginx heartbeat to restore its media workers.
  • Playback tokens are application-managed identifiers, not cryptographically signed HLS manifests.
  • The operational scripts and bundled nginx configuration are Windows-specific.
  • The system is designed for a small self-hosted event platform and has not been built as a horizontally scaled CDN.
  • Automated test coverage and external service supervision are still future work.
  • Fresh production provisioning requires a compatible legacy user schema; supporting-table creation does not initialize the base user table.
  • Configuration changes across nginx, Vite, environment variables, and the public proxy require coordinated edits.
  • The example configuration supplies one primary RTMP application; a displayed backup endpoint requires additional nginx setup.
  • Account and stream moderation stops application-managed media workers, but does not implement a dedicated nginx control-plane disconnect.
  • Recording recovery after an abrupt process or host failure is not a complete automated workflow.

Troubleshooting

Symptom What to check
OBS publishing is rejected Confirm the account's current stream key, callback URL, and matching webhook secret.
API starts locally but fails in production Verify MySQL credentials and the existing legacy users schema; production does not fall back to JSON.
Ingest is live but preview stays unavailable Inspect FFmpeg errors, encoder availability, RTMP reachability, and output-directory permissions.
Dashboard preview works but the world link fails Check the separate world rendition, its manifest path, and WORLD_PREVIEW_BASE_URL. Loopback URLs only work on the same machine.
Local links unexpectedly use HTTPS Set the explicit HTTP world base URL from the development instructions.
nginx fails to start Confirm the RTMP-enabled binary, local config, available ports, and writable logs/ directory.
Verification blocks local registration Disable email verification for local testing or provide working SMTP and verification URL settings.
Restart does not apply a configuration change Stop the tracked production processes before starting them again.
An archive is missing Check whether the stop callback ran, finalization succeeded, retention expired, and the recording file still exists.

Further documentation

The older ingest and migration notes capture earlier stages of the rewrite. For current dual-rendition paths and production storage behavior, use this README together with the configuration and implementation linked above.