Thank you for looking. Please read this before you open a pull request.
- Look through the open issues and pull requests so two people do not write the same thing.
- For anything larger than a fix, open an issue first and agree on the shape of it. A big pull request nobody expected is hard to take.
- By contributing you accept the licence and the Code of Conduct.
Welcome: fixes, tests, clearer wording in the game and in the docs, accessibility, and content for the world (organisations, servers, files) that fits the setting.
Not taken:
- Anything that moves a decision from the server into the browser. The server decides every outcome; the page shows state and sends commands. A change that lets the page decide is a change that lets a player decide.
- Anything that collects data about the people who play. The game asks for no e-mail address and keeps no addresses beyond short-lived rate limits.
- Anything the page fetches from another site: no fonts, no scripts, no analytics, no anti-bot service. An instance has to work with no outbound traffic at all.
- A weaker security control without a reason that stands up in review.
You need Go (the version in go.mod), Node 24 for the client, and a
PostgreSQL to develop against. The quickest database is a container:
docker run -d --name darknode-dev-db -e POSTGRES_PASSWORD=postgres \
-p 127.0.0.1:5432:5432 postgres:18.6-alpineThen run the server:
export DARKNODE_DATABASE_URL="postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable"
export DARKNODE_SECRET="$(openssl rand -base64 48)"
export DARKNODE_COOKIE_SECURE=false # the dev client is plain HTTP
go run ./cmd/darknode serveAnd the client, in another terminal:
cd web
npm ci --ignore-scripts
npm run devThe page is then on http://localhost:5173 and talks to the server through Vite's proxy, so the browser sees one origin and the session cookie behaves as it does in production.
| Path | What is in it |
|---|---|
cmd/darknode/ |
The command: serving, migrating, invites, recovery codes |
internal/config/ |
Settings, read from the environment |
internal/store/ |
PostgreSQL: the schema, its migrations and the queries |
internal/auth/ |
Password hashing, the sign-up puzzle, rate limits, codes |
internal/game/ |
The game: the clocks, the simulation loop, runs, commands |
internal/server/ |
HTTP: the API, sessions, the state stream |
internal/world/ |
The world catalogue and the loader that checks it |
data/world/ |
The world itself, as data files |
web/ |
The browser client |
e2e/ |
The browser test that walks a player's path |
- One logical change per pull request, and no unrelated edits carried along.
- No dead code and no commented-out blocks.
- Go code is
gofmt-formatted and passesgo vet ./...and staticcheck. - Every file Prettier reads is formatted with the one config at the root:
run
npm ci --ignore-scripts && npm run formatthere. - Client code passes ESLint and type-checks with no errors.
- A new dependency needs its reason in the pull request. Every lockfile is committed.
A test says what the code has to do, and it is there to catch the code where it does not. Write it from the behaviour you want, not from what the code happens to do today, and never relax one to make a red run green.
export DARKNODE_TEST_DATABASE_URL="postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable"
go test ./...
npm ci --ignore-scripts && npm run format:check
cd web && npm run lint && npm run typecheck && npm run buildThe tests that need a database make one of their own and drop it afterwards.
Without DARKNODE_TEST_DATABASE_URL they skip, which is fine on a laptop; CI
sets DARKNODE_TEST_REQUIRE_DB, so there a missing database fails the run.
The tokenizer that reads what a player typed has a fuzz target, because every
command goes through it. go test ./internal/game runs its seed corpus like
any test; to let it search for new input:
go test -run '^$' -fuzz FuzzTokenize -fuzztime 60s ./internal/gameThe simulation loop carries a benchmark, since how much one tick costs decides whether one loop can hold every player online:
go test -run '^$' -bench BenchmarkEngineStep ./internal/gameOne test uses a browser. It starts the server against a real PostgreSQL, has it serve the client you built, and walks the path a new player walks: sign up, keep the recovery codes, start a run, read it, sign out and come back to it. That is the check that catches the server, the database and the client disagreeing — a client that asks for an endpoint the server does not have type-checks, lints, and passes every test on either side of it.
cd web && npm ci --ignore-scripts && npm run build # the test serves this
cd ../e2e && npm ci --ignore-scripts
npx playwright install chromium # once; about 200 MB
createdb darknode_e2e # it is written to for real
export DARKNODE_E2E_DATABASE_URL="postgres://postgres:postgres@127.0.0.1:5432/darknode_e2e?sslmode=disable"
npm testGive it a database of its own, as above: it migrates the one it is handed and leaves the accounts it made in it. Add to this test with every slice of the game that a player can reach — it is meant to grow into the whole loop, and a feature nobody can reach through it is a feature nobody can play.
Conventional Commits, one topic per commit, a single line:
feat: let a player see the servers they know
fix: stop the trace when the run ends
Commits must be signed.
- Treat everything from the browser as untrusted, and check it on the server. The browser's copy of the state is for showing, never for deciding.
- Never log a password, a session token, a recovery code or an invite code. The codes are stored as HMACs; keep it that way.
- Never put a secret in the image, in a commit, or in a test fixture. If you commit one by accident, treat it as known to everyone, replace it, and report it privately.
- A change to the schema is a new migration file. Never edit one that has been applied: the server refuses to start against a database whose history does not match the build.
- The stage of the Dockerfile that ships carries no shell and no package manager. CI checks this, and the check is not to be relaxed.
This project is built using AI coding tools, as the README says, and your contribution may be too. Do not send output you cannot explain and defend in review: read it, test it, and take responsibility for it.
- Branch from
dev. - Make the change, with tests.
- Open a pull request into
devand fill in the template. - CI has to pass before it is merged.
Do not open a public issue for one. See SECURITY.md.