Contributing to OAuthMC
OAuthMC is a standalone Rust crate with a zero-dependency TypeScript SDK (sdk/js) and a node-minecraft-protocol client test matrix (tests/clients).
Toolchain and prerequisites#
- Rust toolchain pinned in rust-toolchain.toml (
1.100.0, withrustfmtandclippy) - Node.js 22.18 or later (for the client matrix and TypeScript SDK tests)
musl-toolsand thex86_64-unknown-linux-muslRust target (only for static release builds outside Docker)- Docker (only for testing the container build)
Build from source#
Run all commands from crates/oauthmc:
cargo build --lockedFor an optimized release binary:
cargo build --release --lockedFor a static Linux musl binary (matching CI and the Dockerfile):
rustup target add x86_64-unknown-linux-musl
CC_x86_64_unknown_linux_musl=musl-gcc cargo build --release --locked --target x86_64-unknown-linux-muslChecks and tests#
Format, lint, and Rust tests#
Run the same Rust checks CI executes:
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test --lockedcargo test --locked runs the unit tests (src/) and integration tests (tests/integration.rs):
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
...
test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered outMinecraft client matrix#
The client matrix in tests/clients/run-matrix.mjs starts a mock Mojang session server (tests/clients/mock-session.mjs) and an OAuthMC binary, then connects real node-minecraft-protocol clients in online mode across:
- Code mode:
1.8.9,1.12.2,1.16.5,1.19,1.19.2,1.20.1,1.21.1,26.1 - Link mode:
1.21.6,1.21.8,1.21.11,26.1
Install the client dependencies once and run the matrix against your built binary:
npm --prefix tests/clients ci --no-audit --no-fund
OAUTHMC_BIN="$PWD/target/release/oauthmc" node tests/clients/run-matrix.mjsEach version prints one OK line with the generated code, verified UUID, and username (using the mock session server's fixture player):
[<version>] OK code=<XXXX-XXXX> uuid=<uuid> name=<player>
...
[<version> link] OK code=<XXXX-XXXX> uuid=<uuid> name=<player> verified=trueTypeScript SDK tests#
From the repository root:
pnpm --filter oauthmc typecheck
pnpm --filter oauthmc testContainer smoke test#
Build the Docker image and run the built-in health check:
docker build -t oauthmc .
docker run -d --name oauthmc-smoke \
-e OAUTHMC_API_KEYS="smoke-test-key-0123456789abcdef0123" \
oauthmc
docker exec oauthmc-smoke /oauthmc healthcheck
docker rm -f oauthmc-smokeReleases#
OAuthMC is released from this monorepo with its own version and tags (oauthmc-v0.3.0), by the same release workflow as sculk.network. The release guide has the model and the steps. In short:
- Every night, if anything under
src/,Cargo.toml,Cargo.lock,rust-toolchain.tomlorDockerfilechanged andci-okpassed onmain, the workflow publishesoauthmc-vX.Y.0-nightly.<date>.<run>and the image tags:X.Y.0-nightly.<date>.<run>and:nightly. - A maintainer promotes the latest nightly to a stable release with
gh workflow run release --ref main -f channel=stable -f product=oauthmc. It publishes:X.Y.0,:X.Yand:latest. - The version lives in the tag and the image's
org.opencontainers.image.versionlabel. LeaveCargo.tomlat0.1.0, and do not keep a changelog: the GitHub Release notes list the commits that touched OAuthMC.
Documentation#
Keep the Markdown under docs/ and the root README.md in sync with the source code:
- Environment variables and default message templates live in
src/config.rsand are documented in docs/configuration.md. - HTTP endpoints, status codes, and error codes live in
src/api.rsand are documented in docs/api.md and docs/openapi.yaml. - Protocol version constants live in
src/mc.rsand are documented in docs/protocol.md. - The default server list icon is
src/favicon.png(64x64, embedded in the binary). The mark (docs/assets/mark.svg), the README banner and the GitHub social preview (docs/assets/social.png, 1280x640) live indocs/assets/. - Use relative links only so every page renders on both GitHub and static-site generators.