Skip to main content
HydroGo
ReferenceContributing

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

BASH
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/admin

You 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

BASH
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 package

check 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

  1. Go serves JSON, not markup. No HTML or CSS in Go strings; the only server-rendered HTML is transactional e-mail.
  2. No customer-specific content in core. Brand names, menus, dates and demo credentials belong in seed data, config or an example frontend.
  3. Every migration ships all three dialects and never edits a released migration. Never delete a migration directory.
  4. No SQL dialect or cache details in services. Keep them in repository/sqlstore and internal/cache.
  5. An inactive module adds nothing: no routes, migrations, workers, assets or admin navigation entries.
  6. Keep files small. Split a file before it passes about 800 lines.
  7. Every API response uses the envelope, and errors carry the request id.
  8. Every admin endpoint works with all three credentials through the shared auth middleware.
  9. Zero build on content publish. Publishing never requires a frontend rebuild, pre-rendering pipeline or redeploy.
  10. 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

GuardRule
tools/codeguardNo HTML in Go string literals; files stay under 800 lines. Existing violations are frozen in a baseline that may only shrink.
tools/migrationguardMigration metadata, checksums and dependencies are consistent.
tools/moduleguardModules 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
0001Refocus HydroGo as a CMS rather than a product factory.
0002One way to define a content type: a YAML file.
0003Social sign-in for staff (link existing accounts only) and members (self-service).
0004Theme appearance CSS tokens and runtime configuration.
0005Headless core; the admin panel is a Svelte SPA.
0006Freeze legacy peripherals and the native view pipeline.
0007Distribute HydroGo as a template CMS: releases, installers, hydro new, neutral core.
0009Core-owned event outbox and migration baseline.
0032Fail-closed RLS and zero-dependency memory engine.
0036Config extensions for add-on modules.
Security issues are not reported in public issues. Follow Reporting vulnerabilities.

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.

BASH
pnpm install
pnpm run dev      # http://localhost:4321
pnpm run build