Skip to content

Contributing

Thank you for your help. Open an issue before a large change, so that we can agree on the approach first.

Set up

Requirements: Node 22.22 or later, pnpm (the version in packageManager), Docker.

Terminal window
docker run -d --name genga-postgres -p 54329:5432 \
-e POSTGRES_USER=genga -e POSTGRES_PASSWORD=genga -e POSTGRES_DB=genga postgres:18
pnpm install
pnpm build

Checks

Run these before you open a pull request. CI runs them too.

Terminal window
pnpm lint # oxlint
pnpm format # oxfmt --check (pnpm format:fix to fix)
pnpm typecheck
pnpm test # vitest, against Postgres
pnpm build
pnpm test:pack # packs the packages, installs the tarballs in copies of the examples, builds them
pnpm test:e2e # the Next.js example against the Genga server, with Playwright (needs E2E_DATABASE_URL)
pnpm test:e2e:admin # the admin of the React Router example, with Playwright (needs E2E_DATABASE_URL)
pnpm test:e2e:nuxt # the Nuxt example against the Genga server, with Playwright (needs E2E_DATABASE_URL)
pnpm test:e2e:sveltekit # the SvelteKit example against the Genga server, with Playwright (needs E2E_DATABASE_URL)
pnpm test:e2e:astro # the Astro example against the Genga server, with Playwright (needs E2E_DATABASE_URL)
pnpm i18n:check # git8n check: the locale files parse, and no translation loses a placeholder
pnpm --filter genga-docs check:links # after pnpm build: no broken link in the documentation site

The tests of the S3 adapter run against MinIO when GENGA_TEST_S3_ENDPOINT is set (CI sets it):

Terminal window
docker run -d --name genga-minio -p 59000:9000 \
-e MINIO_ROOT_USER=genga -e MINIO_ROOT_PASSWORD=genga-minio-test bitnamilegacy/minio:2025.7.23-debian-12-r5
GENGA_TEST_S3_ENDPOINT=http://localhost:59000 GENGA_TEST_S3_ACCESS_KEY=genga \
GENGA_TEST_S3_SECRET_KEY=genga-minio-test pnpm test

The tests create and empty the genga_test and genga_server_test databases. To use another server, set GENGA_TEST_ADMIN_URL (a database that can create databases) and GENGA_TEST_DATABASE_URL. pnpm test:pack also runs the migrations if DATABASE_URL is set, and then builds the admin route modules of 0.3 next to @genga-cms/react-router (scripts/fixtures/legacy-admin) and checks both on one database. This check writes to the database of DATABASE_URL: it adds an admin and a post, then deletes the post and disables the admin. Use a development database. It uses the React Router 8 of the example. pnpm test:pack --react-router=7 installs React Router 7 and TypeScript 6 in the copy. CI runs both. pnpm test:e2e deletes all content of the database of E2E_DATABASE_URL (its name ends in _e2e or _test, for example genga_e2e), and needs pnpm build and two browsers of Playwright (pnpm --filter genga-example-next exec playwright install chromium webkit).

The headless server

Terminal window
docker build -f apps/server/Dockerfile -t genga .
GENGA_SECRET="$(openssl rand -base64 48)" GENGA_IMAGE=genga \
docker compose -f apps/server/docker-compose.example.yml up

The server tests (apps/server/test) call the public API handler and the listener of the server (node:http and @genga-cms/node, no React Router), against Postgres.

Texts and translations

The texts of the admin and of the admin API are JSON locale files in packages/genga/src/i18n/locales/, one folder per language and one file per screen or part:

packages/genga/src/i18n/locales/
├── manifest.json read by git8n: English is the source
├── en/ the source, written by developers
│ ├── app-shell.json
│ ├── server.json
│ └── …
└── fr/ a target, written in git8n
└── …
  • Add or change a text in en/ only. A text is an ICU message: {name}, {count, plural, one {# file} other {# files}}, {n, number}. A component reads its file with messages(en, fr) from src/i18n/admin.ts, then t('key', { name }).
  • Do not write in fr/ or another target. The translations go through git8n: translators propose the texts in the editor, a reviewer publishes them, and each publication is a commit of the git8n GitHub App on this repository.
  • To remove or rename a key, change en/ and remove or rename the same key in each target in the same pull request: a target key that the source does not have fails the tests.
  • A key that a target does not hold yet shows in English: the admin never shows a key name.
  • pnpm i18n:check runs git8n check, as CI does: a file that does not parse, or a translation that loses or adds a placeholder of its source, fails. A missing translation is only a warning, on purpose: a new English text must not block a pull request, and English shows until the translation arrives.
  • git8n reads this repository with these settings (kept in git8n, not in the repository): the locales folder packages/genga/src/i18n/locales, the languages en (the source, first) and fr, the base branch main, and the publication mode pull_request.
  • A new language needs a folder, a value of Locale in src/i18n/index.ts, its files passed to messages() in src/i18n/admin.ts and in each component (they import fr/*.json today), and the language in the git8n settings.

Documentation site

apps/docs builds the documentation site with Starlight. It has no text of its own: each page reads a Markdown file of the repository when the site builds. So you change the documentation in docs/, in the READMEs, in CONTRIBUTING.md or in CHANGELOG.md, and the site follows.

  • apps/docs/src/sources.ts lists the pages. A page takes its title from the first # heading of its file. A page can also take some ## sections of a file, as the home page does with README.md. If one of these sections gets a new name, change sources.ts too: the build fails until you do.
  • The README of each package in packages/ other than genga is a page of the “Adapters” group. A new adapter package gets its page with no change to the site.
  • Relative links between these files go to the pages of the site. A link to another file of the repository goes to that file on GitHub. The images of docs/assets/ are served by the site.
  • The API reference comes from docs/openapi.yaml.
Terminal window
pnpm docs:dev # the site at http://localhost:4321, reloads when a file changes
pnpm --filter genga-docs build # the static site in apps/docs/dist
pnpm --filter genga-docs check:links # fails on a link to a page or a heading that does not exist

The site is gengacms.dev. DOCS_SITE (default https://gengacms.dev) and DOCS_BASE change the public URL at build time, for example DOCS_BASE=/genga for a site under a sub-path.

The image of the site

apps/docs/Dockerfile builds the site and serves it with nginx (unprivileged) on port 8080. Build it from the repository root: apps/docs/Dockerfile.dockerignore replaces the root .dockerignore for this image, because the site needs docs/.

Terminal window
docker build -f apps/docs/Dockerfile -t genga-docs .
docker run --rm -p 8080:8080 genga-docs # http://localhost:8080, health check at /healthz
  • nginx (apps/docs/nginx/) sends the 404 page of Starlight, compresses with gzip, caches the hashed files of _astro/ and of Pagefind for one year, and makes the browser check the HTML again at each visit.
  • The security headers are in apps/docs/nginx/security-headers.conf. If the site loads a new kind of resource (a font or an image from another origin, for example), change the Content-Security-Policy there.
  • Dokploy on em-sakuga-01 runs the image behind Traefik, which terminates TLS and redirects www.gengacms.dev to gengacms.dev. The image has no TLS and no redirect of its own.

Conventions

  • Commit subjects follow Conventional Commits: feat:, fix:, docs:, ci:, chore:.
  • Write a comment only when the code cannot say it: a risk, a reason, a public contract.
  • The admin must stay accessible (WCAG 2.2 AA): keyboard access, visible focus, labels, live regions. Use only open-source dependencies.
  • Migrations are expand-only. Add a new entry to packages/genga/migrations/migrations.mjs; never change one that shipped.
  • Add a line to CHANGELOG.md under “Unreleased” for each user-visible change.

CI and pull requests from forks

CI runs on GitHub-hosted runners, which are free for a public repository. A pull request from a fork runs on a fresh machine of GitHub, with no secret of this repository. The repository settings also require approval before workflows run for outside contributors.

Do not move these workflows to self-hosted runners: a workflow there runs the code of the pull request on our own machines.

Release

  1. Open a release pull request. Update the version in every packages/*/package.json and in apps/server/package.json: all of them share one version. Move the “Unreleased” notes of CHANGELOG.md under a heading ## [X.Y.Z] - YYYY-MM-DD.
  2. Merge it. release-tag.yml sees the new version on main, checks that every manifest says the same version and that CHANGELOG.md has its section, then creates the tag vX.Y.Z and the GitHub release, with that section as its notes. It uses the token of the org’s GitHub App, because a release that github.token creates starts no other workflow. If the tag exists, it does nothing.
  3. The release starts release-npm.yml: the checks of CI on the tag, the tarball, then the publication. The publication waits until a person approves the environment npm. The tag also starts docker.yml, which pushes the image to GHCR for linux/amd64 and linux/arm64, with provenance and SBOM attestations.

A tag pushed alone publishes nothing on npm. A run from « Run workflow » packs and checks, and publishes nothing, also on a tag. To try a failed release again, use « Re-run jobs » on its run: a version that npm already has is skipped.

No npm token exists. npm trusts the OIDC token of release-npm.yml, in the environment npm, as the trusted publisher of each package. To set it again, a person who can publish the package runs, with npm 11.5.1 or later:

Terminal window
npm trust github genga --file release-npm.yml \
--repository sakuga-software/genga --environment npm --allow-publish
npm trust github @genga-cms/next --file release-npm.yml \
--repository sakuga-software/genga --environment npm --allow-publish
for name in @genga-cms/react @genga-cms/react-router @genga-cms/node @genga-cms/nuxt @genga-cms/sveltekit @genga-cms/astro; do
npm trust github "$name" --file release-npm.yml \
--repository sakuga-software/genga --environment npm --allow-publish
done

WARNING: set the trusted publisher of a new package before its first release. Without it, the publication of that package fails. If npm refuses a trusted publisher for a package that it does not have yet, the owner of the @genga-cms organization publishes a first version by hand.