Skip to content

Contributing

Thanks for helping out! Here’s how the project is laid out and how to check your work before you send it.

Folder What’s in it
crates/nyquist The server: ingest, sources and failover, playback, viewer sessions, the REST API, the panel and /metrics.
crates/nyquist-config The nyquist.toml model, its defaults and checks, the settings catalog and edits that keep comments.
crates/nyquist-core Streams, publishers and the stream registry.
crates/nyquist-rtmp, crates/nyquist-srt The RTMP server and client, and the SRT bindings.
crates/nyquist-mpegts, crates/nyquist-packager, crates/nyquist-codec MPEG-TS, HLS, DASH and CMAF packaging, and codec parsing.
web The admin panel, a Svelte app that gets baked into the binary.
docs This website, built with Starlight.
assets The logo and the wordmark.

These all have to pass:

Terminal window
cargo fmt --all --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked

The panel and the docs have their own:

Terminal window
cd web && npm ci && npm run check && npm test && npm run build && cd ..
cd docs && npm ci && npm run build && cd ..

Commits follow Conventional Commits, one line each, like feat(config): add a setting for the thing or docs: explain the thing.

The panel is a Svelte app in web/. Run npm run dev in there while Nyquist runs and it proxies the API for you. It looks for Nyquist at http://127.0.0.1:8080, so if yours listens somewhere else, point it there with NYQUIST_URL:

Terminal window
NYQUIST_URL=http://127.0.0.1:9090 npm run dev

fake:// replays crates/nyquist/assets/test-pattern.ts, a loop of 64 frames at 30 fps, 2.13 seconds, which is exactly 100 AAC frames at 48 kHz. It starts on a keyframe and has no B frames, so Nyquist can play it over and over with timestamps that keep counting up. It’s the second half of a two loop encode, which keeps the audio encoder warmed up and the loop seamless, and the tone is 1003.125 Hz so it fits the loop a whole number of times. To make a new one:

Terminal window
ffmpeg -f lavfi -i "testsrc2=size=1280x720:rate=30" -f lavfi -i "sine=frequency=1003.125:sample_rate=48000" \
-t 4.2666667 -c:v libx264 -preset veryslow -profile:v main -pix_fmt yuv420p -bf 0 -g 32 -keyint_min 32 \
-sc_threshold 0 -b:v 700k -maxrate 1000k -bufsize 1400k -c:a aac -b:a 96k -ac 2 -f mpegts two_loops.ts
ffmpeg -ss 2.1333333 -i two_loops.ts -c copy -f mpegts crates/nyquist/assets/test-pattern.ts

The docs are a Starlight site in docs/. The pages are Markdown files in docs/src/content/docs, with guides in guides/ and reference pages in reference/. The sidebar lives in docs/astro.config.mjs.

Terminal window
cd docs
npm ci
npm run dev

That serves the site at http://localhost:4321 and reloads as you type. npm run build makes the static site in docs/dist, the same way the docs host does. The Node version the build needs is in docs/.node-version.

Every setting has exactly one default, in the Default impl of its section in crates/nyquist-config. To add one:

  1. Add the field and its default, and check its value in the section’s validate.
  2. Describe it in the settings catalog, crates/nyquist-config/src/catalog/entries.rs: a label, a one sentence help text, its kind and limits (use the same constants the check uses), whether it applies live or after a restart, and whether it’s an advanced knob.
  3. Regenerate the config reference (see below) and commit it.

The catalog tests fail until every setting has an entry, every entry points at a real setting and every limit matches what the check accepts, so you can’t forget a step.

The config reference is generated from the settings catalog, so it always matches the code. A test fails when the committed page is out of date. To write it again:

Terminal window
NYQUIST_WRITE_DOCS=1 cargo test -p nyquist-config --test reference

Then commit docs/src/content/docs/reference/config.md along with your change.