Development
The repository is a monorepo:
| Folder | What it is |
|---|---|
cloud/ |
GitNotify on Cloudflare Workers (src, tests, migrations, scripts), with the email relay in cloud/relay/ |
selfhosted/ |
self-hosted GitNotify in Rust with SQLite, one binary |
docs/ |
these guides, the canonical source of the documentation site |
site/ |
the documentation site, built with Astro and Starlight |
The source is at https://git.h1n054ur.dev/borderless-tech/gitnotify. GitNotify is free software under the GNU General Public License, version 3 or (at your option) any later version.
The Cloudflare Worker
Section titled “The Cloudflare Worker”Requires bun. Commands run from cloud/.
cd cloudbun installcp .dev.vars.example .dev.vars # local values, never commit itbun run db:migrate:localbun run dev # wrangler dev| Command | Does |
|---|---|
bunx biome ci . |
lint and format check (bun run format writes) |
bun run check |
wrangler types and tsc --noEmit |
bun run test |
Vitest: unit (Node) and integration (workerd with D1, queues and Durable Objects), including a 50-server load test |
All three must be green before you push, and CI runs the same. Changing wrangler.jsonc needs bun run check, which regenerates worker-configuration.d.ts. The compatibility_date must not be newer than the workerd bundled with @cloudflare/vitest-plugin, or the integration tests refuse to start. New D1 migrations go in cloud/migrations/ and are applied before the code that needs them is deployed.
Where things live
Section titled “Where things live”| Path | What it is |
|---|---|
src/index.ts |
the GitHub, Discord, Slack and Telegram endpoints, the sign-in pages, the admin API, and the queue and cron handlers |
src/queue.ts |
the queue consumer: facts to core state, then fan-out to servers, workspaces and groups, intents, setup and repair, and digest jobs |
src/core/ |
the platform-neutral core: signature verification, event parsing, pull request and run state, incidents, installations, and the digest builder and schedule |
src/discord/, src/slack/, src/telegram/ |
the three integrations: rendering, delivery, commands, interactions, setup and repair, digests |
src/shared/ |
platform-neutral helpers for GitHub proof, linking, ownership, digests, email, encryption and audit |
tests/unit, tests/integration, tests/fixtures |
the tests and GitHub payload fixtures |
Rules the tests enforce
Section titled “Rules the tests enforce”src/corenever importssrc/discord,src/slack,src/telegramorsrc/shared.src/sharedmay import core but never an integration. The three integrations never import each other.tests/unit/boundary.test.tsandtests/unit/platform-boundary.test.tscheck this.- Core holds raw GitHub text. Escaping happens only in each integration's renderer.
- The Zod schemas in
src/core/github/events.tsdeclare only the fields the cards read. - Logs carry ids and outcomes, never payload text. Telegram tests also assert that logs hold no text, titles, usernames or secrets.
- Every rendered Discord card is checked for its flags, empty
allowed_mentionsand length. Slack cards stay within Block Kit's limits, and Telegram cards within 4,096 characters.
Integration tests run in workerd. They fake the chat platforms by stubbing fetch, and never call the real Discord, Slack or Telegram APIs. Seed state with the helpers in tests/integration/.
The email relay
Section titled “The email relay”The relay in cloud/relay/ is a separate Worker with its own package.json, lockfile and tests. It must stay self-contained, because it is deployed on its own.
cd cloud/relaybun installbun run check && bun run testLint runs from cloud/ with bunx biome ci .. src/index.ts holds the checks and the send, src/render.ts the Ember HTML and text, src/types.ts the protocol, and tests/ the signature, replay, allowlist, cap and escaping tests. See Email relay.
The self-hosted server
Section titled “The self-hosted server”Requires a current Rust toolchain. Commands run from selfhosted/.
cd selfhostedcargo fmt --checkcargo clippy --all-targets --locked -- -D warningscargo test --lockedAll three must be green before you push. The self-hosted server's behaviour is held to the Worker's by shared golden cases: bun run golden:export in cloud/ runs the Worker's own functions and writes the cases to cloud/tests/golden and selfhosted/tests/golden. To run the server, see Install GitNotify.
The documentation site
Section titled “The documentation site”The guides are Markdown files in docs/. Edit them there, never in site/src/content: the site generates its Starlight collection from docs/ using the route list in site/scripts/docs-map.mjs, which also drives the sidebar.
cd sitebun installbun run dev # local previewbun run verify # sync the docs, astro check, build and check linksWhen you write a guide:
- Start the file with one
# Titleon the first line and no frontmatter. The site uses it as the page title. - Link to other guides by their bare file name, such as
[Discord](discord.md)or[Repair](slack.md#repair). Anchors must match real headings. - Link to repository files outside
docs/with full URLs to the forge. - Use tables, numbered steps and short lists. The site does not render Mermaid or HTML.
- Add a new page to
site/scripts/docs-map.mjsand todocs/README.md.
Before you push
Section titled “Before you push”Run the checks for every folder your change touches:
cd cloud && bunx biome ci . && bun run check && bun run testcd cloud/relay && bun run check && bun run testcd selfhosted && cargo fmt --check && cargo clippy --all-targets --locked -- -D warnings && cargo test --lockedcd site && bun run verifyCI runs only the jobs for the folders a change touches. Update the guide in docs/ in the same change as any user-facing behaviour.