Local Setup

Prerequisites

For local development you need:

  • Node.js (incl. npm)
  • PostgreSQL (local or reachable server)
  • Unity Hub + Unity 2022.3.33f1 (see room-of-horror-unity/ProjectSettings/ProjectVersion.txt)
  • optionally a VR headset (Meta Quest); without a headset the desktop mode works with mouse/keyboard

On Windows, PowerShell may block npm.ps1. In that case use npm.cmd.

Create environment files

All secrets live in local .env files (never commit them!). Copy the templates:

cp room-of-horror-api/.env.example room-of-horror-api/.env.dev
cp room-of-horror-frontend/.env.example room-of-horror-frontend/.env.dev

Then fill the required values in room-of-horror-api/.env.dev — details and generation commands are in CONFIGURATION.md:

DEV_MODE=true
USE_HTTPS=false
PORT=8080
ORIGIN_PATH=/api

# JWT secrets (each: openssl rand -base64 48)
AUTH_KEY=...
ACCESS_KEY=...
RECOVERY_KEY=...

# AES keys (openssl rand -base64 24 and 12 respectively)
ENCRYPTION_KEY=...
ENCRYPTION_IV=...

# PostgreSQL
DATABASE_URL=postgres://postgres:postgres@localhost:5432/room_of_horror

Important frontend values (room-of-horror-frontend/.env.dev):

PORT=3000
REACT_APP_PORT=3000
REACT_APP_ORIGIN=localhost
REACT_APP_BACKEND_ORIGIN=localhost
REACT_APP_BACKEND_PORT=8080
REACT_APP_BACKEND_PATH=api

Prepare PostgreSQL

An empty database is enough — the API creates tables, migrations, and seed data (error catalog, patients A–F) itself at startup:

CREATE DATABASE room_of_horror;

Start the backend

cd room-of-horror-api
npm install
npm run dev          # or: npm run dev:watch

Expected local API path: http://localhost:8080/api

At startup, utils/Config.ts validates all environment variables. Missing values abort with [CONFIG] Invalid environment configuration — the message lists every missing variable.

Start the frontend

cd room-of-horror-frontend
npm install
npm run dev

Expected local website path: http://localhost:3000

Open the Unity project

In Unity Hub open the folder room-of-horror-unity (the first import takes a while). Then point the connection at the local backend in the Inspector of the Env object:

Backend Origin: http://localhost:8080/api/

The device identity comes from useLocalTestDeviceUUID by default (Assets/Scripts/Env.cs); for multiple test clients enter individual UUIDs.

Mail server note

Login and registration send e-mail links. For local work no SMTP server is needed: with DEV_MODE=true the API returns the tokens (authToken, recoveryToken) directly in the HTTP response — visible e.g. in the browser dev tools or via Postman (roh_2_1.postman_collection.json). The token can then be passed directly to GET /account/auth.

Start order

1. PostgreSQL is running
2. Start the backend
3. Start the frontend
4. Open/start the Unity project (play mode or build)
5. Enter the game code from the Unity lobby in the dashboard
6. Select patient + errors, start the game

Testing without a VR headset

The scene includes a desktop mode (DesktopMovement, MouseLook, DesktopClickInteractor): move with WASD/mouse, select errors with mouse clicks. This allows playing through the complete game flow without a headset.


Information sources

  • room-of-horror-api/package.json, .env.example, utils/Config.ts
  • room-of-horror-frontend/package.json, .env.example
  • room-of-horror-unity/ProjectSettings/ProjectVersion.txt, Assets/Scripts/Env.cs, desktop scripts
  • Root CONFIGURATION.md

Assumptions

  • The PostgreSQL credentials postgres:postgres are example values from .env.example; local installations may differ.

Suggested improvements

  • Add a docker-compose.yml with PostgreSQL + API + frontend for a one-command setup.

Last build: 19 Aug 2026, 05:20+00:00


This site uses Just the Docs, a documentation theme for Jekyll.