Contributing
Read CONTRIBUTING.md
first: it covers which branch a pull request targets (main for fixes, dev
for the transport and virtual-display migration), how issues are reported, and
the changelog entry every change carries. This page covers the project's
internals — the Web UI, localization and the test suites.
Recommended Tools
| Tool | Description |
|---|---|
| CLion | Recommended IDE for C and C++ development. Free for non-commercial use. |
Project Patterns
Web UI
- The Web UI uses Vite and its Rolldown bundler.
- Bun runs the build, type checks, and tests.
- The HTML pages used by the Web UI are found in
./src_assets/common/assets/web. - The Style System is provided by Bootstrap.
- Vue single-file components hold the page templates and TypeScript.
Building
From src_assets/common/assets/web, run bun install --frozen-lockfile, then
bun run dev for front-end development. Use the
web-assets build feature to build and stage the
production pages with the Hermes executable.
Documentation
The documentation site uses Docusaurus. Use the Node.js
version pinned in docs/site/.node-version with Doxygen and Graphviz on PATH.
Start a local preview from the repository root.
npm --prefix docs/site ci
npm --prefix docs/site run start
Run npm --prefix docs/site run build to check links and generate the
production site in docs/site/build/. Preview that build with
npm --prefix docs/site run serve.
For a hosted build, set HERMES_DOCS_URL to the site's origin and
HERMES_DOCS_BASE_URL to its path, such as /Hermes/. Use the same values for
the build and preview. CI uploads the built site as an artifact. GitHub Pages
setup is documented in docs/site/README.md.
Edit guides in docs/, group them in docs/site/sidebars.ts, and edit the
homepage in docs/site/src/pages/index.tsx. Edit the C++ source comments to
update the generated API reference. Use .cppm for
named module interfaces and place a brief Doxygen comment before the
export module declaration. Doxygen reads these declarations directly and
lists them in the C++ module index.
Documentation sources
The site uses one Docusaurus collection so the guides, package docs, and companion docs share link checking and search. Routes are relative to the site's base path.
| Source | Where it appears |
|---|---|
Hermes guides in docs/ | Existing routes such as /building and /configuration |
Package READMEs and docs/ under rust/ or mcpp/ | Developers → Package docs, at /developers/rust or under /developers/mcpp/ |
| Selected Hestia-rs and Hermes-KMS Markdown | Project → Companion projects, under /companions/<project>/ |
Edit local docs in place. Use relative Markdown links, such as a link from
docs/building.md to ../rust/README.md, so they work in GitHub and Docusaurus.
For a new source directory, add its Markdown pattern to localDocs in
docs/site/content-sources.mjs and wire its route and sidebar. New READMEs and
Markdown in package docs/ directories already match the allowlist.
Add or update a companion in remoteSources in the same registry. Set the
repository, full commit SHA, license, and selected Markdown paths, including
its root README. Imported pages retain a link to the pinned original and the
upstream license. Builds and previews fetch the selected files into
target/docs-content/, with the download cache under cache/.
After the first build has warmed the cache, use it for an offline build.
HERMES_DOCS_OFFLINE=1 npm --prefix docs/site run build
Localization
The strings Hermes ships are inherited from Sunshine's localization, and the default language is en (English).
[!IMPORTANT] Upstream's CrowdIn integration is not wired up in this fork: there is no localization workflow in
.github/workflows, so nothing here pushes templates to CrowdIn or opens translation PRs. Add new English strings toen.jsonas shown below; translations for them arrive when a fork-side localization route exists, or through a pull request that edits a language file directly.
Translation Basics
- The brand names Hermes, Hestia and Sunshine should never be translated.
- Other brand names should never be translated. Examples include AMD, Intel, and NVIDIA.
Extraction
Web UI
Hermes uses Vue I18n for localizing the UI. The following is a simple example of how to use it.
-
Add the string to the
./src_assets/common/assets/web/public/assets/locale/en.jsonfile, in English.{"index": {"welcome": "Hello, Hermes!"}}[!NOTE] The JSON keys should be sorted alphabetically. You can use jsonabc to sort the keys.
[!NOTE] Add new strings only to en.json. The other language files come from upstream's translation process; editing them here makes the next merge from upstream conflict.
-
Use the string in the Vue component.
<template><div><p>{{ $t('index.welcome') }}</p></div></template>[!TIP] More formatting examples can be found in the Vue I18n guide.
C++
There should be minimal cases where strings need to be extracted from C++ source code; however it may be necessary in some situations. For example the system tray icon could be localized as it is user interfacing.
- Wrap the string to be extracted in a function as shown.
#include <boost/locale.hpp>#include <string>std::string msg = boost::locale::translate("Hello world!");
[!TIP] More examples can be found in the documentation for boost locale.
[!WARNING] The below is for information only. Contributors should never include manually updated template files, or manually compiled language files in Pull Requests.
Strings are extracted from the code to the locale/hermes.po template file. Upstream generates it from a
localize.yml workflow; this fork has no such workflow, so extract locally when you add a translatable C++ string.
To maintain native translations locally, install GNU gettext, which
supplies xgettext, msginit, msgmerge, and msgfmt. This is separate from the Web UI's JSON translations.
-
Extract, initialize, and update
./scripts/_locale.sh --extract --init --update -
Compile
./scripts/_locale.sh --compile
[!IMPORTANT] Do not include extracted or compiled localization files in pull requests.
Testing
There are two suites, and the test job in
.github/workflows/build.yml
runs both on every push and pull request. Nothing else is gated: this fork has no
clang-format lint job and no coverage upload, so run these locally before opening a PR.
C++ unit tests
Hermes uses GoogleTest, included as a submodule. The suite compiles the host sources with test hooks and coverage instrumentation. Prepare the local mcpp toolchain and run from the repository root.
MCPP_HOME="$PWD/.mcpp/local-home" MCPP_TOOLCHAIN="path:$PWD/.toolchain" \
xvfb-run -a mcpp test --offline -p hermes-host --features kwin,web-assets \
--profile coverage -- --gtest_color=yes
Xvfb supplies an X11 capture source on a headless machine. Pass GoogleTest
options after --, such as --gtest_filter='SessionBroker*'. Wayland cases
use the compositor identified by WAYLAND_DISPLAY. CI runs a second pass
against a headless compositor to exercise output layout and scaling.
Cases that need unavailable hardware report a skip.
Network lifecycle tests without a GPU
A focused target compiles the production src/network.cpp and runs the socket
and shared-resource tests without the capture/encoder dependencies or a display
server. It covers failed startup cleanup, repeated reconnects, OS error reporting,
and executed helpers retaining control, video, or audio sockets. Linux clipboard
tests also exercise the actual helper pipe code with deliberately inheritable
sockets, full-size/empty content, failed commands, and broken pipes. The target supplements the full suite;
it does not exercise RTSP negotiation, capture, or actual client sessions.
Use the project-local mcpp toolchain setup. Run from the repository root.
git submodule update --init third-party/googletest third-party/moonlight-common-c
git -C third-party/moonlight-common-c submodule update --init enet
MCPP_HOME="$PWD/.mcpp/local-home" MCPP_TOOLCHAIN="path:$PWD/.toolchain" \
mcpp run --offline --profile sanitize -p hermes-network-lifecycle \
network_lifecycle_tests -- --gtest_color=yes
The Network lifecycle regressions workflow runs this target with AddressSanitizer,
UndefinedBehaviorSanitizer, and leak detection. In environments that block
LeakSanitizer's process inspection, ASAN_OPTIONS=detect_leaks=0 allows the other
sanitizers to run; leak detection must still run on an unrestricted CI runner.
Web UI tests
The Web UI tests run with Bun. The production Vite configuration takes asset paths from the native build and emits eight HTML pages with precompiled Vue templates.
cd src_assets/common/assets/web
bun install --frozen-lockfile
bun run typecheck
bun run test
Clang Format
Source code follows the .clang-format file. Nothing enforces it in CI, so format before committing.
Option 1:
find ./ -iname *.cpp -o -iname *.h -iname *.m -iname *.mm | xargs clang-format -i
Option 2 (will modify files):
./scripts/update_clang_format.sh