Contributing
Set up the repository, run the checks, and follow the few architecture rules that keep HydroGo small.
Open an issue for anything bigger than a bug fix, keep changes small and run the checks. By contributing you agree your work is licensed under the repository's PolyForm Shield 1.0.0 license.
Set up
git clone https://github.com/hydrohq/hydrogo.git
cd hydrogo
go run ./tools/devserver # rebuilds on save, demo data, Vite HMR for the admin
# open http://127.0.0.1:8090 and http://127.0.0.1:8090/adminYou need Go 1.27+ and Node 22. Use -address 0.0.0.0:8090 to open the dev server from a phone on the same network. Optional local PostgreSQL and Redis come from docker compose -f compose.dev.yaml up -d.
Before you push
go run ./tools/check # or: make check
go run ./tools/check -short # skip tests
npm --prefix admin test # admin unit tests
go test ./modules/news/... # one packagecheck runs build, vet, gofmt, the repository guards, the Go tests and the admin lint, typecheck, tests and build. If you changed admin UI, also open the screen and look at it at desktop and phone width.
Architecture rules
- Go serves JSON, not markup. No HTML or CSS in Go strings; the only server-rendered HTML is transactional e-mail.
- No customer-specific content in core. Brand names, menus, dates and demo credentials belong in seed data, config or an example frontend.
- Every migration ships all three dialects and never edits a released migration. Never delete a migration directory.
- No SQL dialect or cache details in services. Keep them in
repository/sqlstoreandinternal/cache. - An inactive module adds nothing: no routes, migrations, workers, assets or admin navigation entries.
- Keep files small. Split a file before it passes about 800 lines.
- Every API response uses the envelope, and errors carry the request id.
- Every admin endpoint works with all three credentials through the shared auth middleware.
- Zero build on content publish. Publishing never requires a frontend rebuild, pre-rendering pipeline or redeploy.
- Never hide a failing test by renaming or skipping it. Fix the code, update the test or delete it with an explanation.
Where changes go
| Guard | Rule |
|---|---|
tools/codeguard | No HTML in Go string literals; files stay under 800 lines. Existing violations are frozen in a baseline that may only shrink. |
tools/migrationguard | Migration metadata, checksums and dependencies are consistent. |
tools/moduleguard | Modules only import what modules/dependencies.json declares. |
Commits and pull requests
- Explain the why in the commit message and describe what a user would notice: before, after, then how.
- Add a test next to the code you change.
- Write a decision record in
docs/decisions/only when you move a module boundary or change a public contract (routes, API, config, migrations). Keep it under a page. - Do not commit status reports, evidence logs or plans to the repository.
Decision records
| # | Decision |
|---|---|
| 0001 | Refocus HydroGo as a CMS rather than a product factory. |
| 0002 | One way to define a content type: a YAML file. |
| 0003 | Social sign-in for staff (link existing accounts only) and members (self-service). |
| 0004 | Theme appearance CSS tokens and runtime configuration. |
| 0005 | Headless core; the admin panel is a Svelte SPA. |
| 0006 | Freeze legacy peripherals and the native view pipeline. |
| 0007 | Distribute HydroGo as a template CMS: releases, installers, hydro new, neutral core. |
| 0009 | Core-owned event outbox and migration baseline. |
| 0032 | Fail-closed RLS and zero-dependency memory engine. |
| 0036 | Config extensions for add-on modules. |
Working on these docs
This documentation site lives in hydrohq/hydrogo-web. Documentation pages are typed data in src/data/hydro-docs/*.ts, one file per section group. Run pnpm dev in that repository, edit, and the page reloads.
pnpm install
pnpm run dev # http://localhost:4321
pnpm run build