Development

Documentation menu

Prerequisites: Node.js 26+ plus curl, unzip, tar, and xz-utils.

1. Install dependencies and local media binaries:

npm install
npm run dev-install   # downloads SRS and pinned FFmpeg into ./objs

The relay lives in the sibling ../goryu repo in development (and in live-miracles/goryu releases for production installs). Rerunning npm run dev-install refreshes that repo when it has no local changes and rebuilds ./objs/goryu.

To use a local SRS binary:

SRS_LOCAL_BIN=./build/srs npm run dev-install

2. Start SRS (terminal 1):

npm run srs           # runs ./objs/srs -c srs.conf in the foreground

3. Start Goryu (terminal 2):

npm run goryu          # runs the ./objs/goryu binary built by dev-install
npm run goryu:update   # pulls the latest ../goryu source and rebuilds ./objs/goryu

The relay also exposes a local HTTP status endpoint on the default status_port (127.0.0.1:8081) in development. The dashboard backend polls that endpoint to show the top-level relay health and the per-pipeline bonded-input status.

4. Start the app (terminal 3):

npm run dev           # node --watch + tsc watch + tailwind watch

npm run dev seeds a fresh database with the password admin, or BUNRYU_DASHBOARD_PASSWORD when it is set. The app itself has no default: started another way on a fresh database without that variable, it refuses to start. Later starts use the hash stored in the database.

There are no migrations. When a change bumps the schema version, npm run dev finds the old db.sqlite before it starts the watchers and asks whether to wipe it. Answer y and the file is deleted and the app creates a fresh database; anything else leaves it untouched and does not start. Without a terminal it only prints the error and stops.

Tests

npm test              # unit and integration tests
npm run typecheck
npm run lint          # ESLint: unhandled promises, dead code
npm run format:check

The tests are TypeScript. npm run typecheck checks them against the types in src/ (tsconfig.test.json, strict), so a fake that no longer matches the real interface fails there instead of passing quietly. Build a partial fake in one typed factory with a single as unknown as RealType cast, not a cast at every use, and use test/helpers/http.ts to drive an Express app in an API test.

test/malformedInput.test.ts feeds seeded random mutations of ss output, destination URLs, names, the relay config and the relay /status JSON to their parsers and asserts they never throw, hang or return a malformed value. A failure prints the seed and input; turn it into a regression test next to the parser's own. Add a parser that reads text from outside the process (a new ss, FFmpeg, SRS or relay output) to that file.

scripts/test-stack.sh starts an isolated local stack (its own SRS, control plane and fresh database, with a fake output FFmpeg) that does not touch a developer's own npm run dev. It is documented in skills/run-bunryu/SKILL.md.

Edit this page on GitHub