Skip to content

Contributing

cyril-fl edited this page Nov 30, 2026 · 2 revisions

Contributing

How to run Tide for development, test it, and add the usual things. Read Architecture first.

Run

You need Go, Bun and Docker (Colima on macOS). Then Installation.

Target Does
make up / make down Starts / stops Postgres, Silo, the API and the web app (logs in .build/web.log)
make api Rebuilds and restarts the API container
make dev BRANCH=<branch> The same stack from another branch's worktree; make dev comes back
make test The Go tests (ARGS=./core/... to narrow)
make e2e The browser tests (Playwright) against the running stack
make perf Measures the API and the pages on 50,000 generated notes
make openapi Regenerates docs/swagger.yaml (then bun run types in web/)
make backup / make purge See Installation
make pgsql Opens psql, or runs a query with QUERY="..."
make connect Logs the CLI in to an API (TO=local)
make setup Installs the git hooks (lefthook)

The CLI by hand, from the repo: go run ./cmd/tide <args> (and ./cmd/tide-server for the server's), with the .env loaded and CONFIG_FILE=$PWD/config/config.yaml.

To use the CLI of the repo on that stack: go build -o "$(go env GOPATH)/bin/tide" ./cmd/tide && make connect TO=local.

Port 5432 on the host belongs to the stack's Postgres: if a tunnel to another database holds it, run the Go tests in the note-app container instead.

Test

  • Go: each test runs in a rolled-back transaction of its own database, where it creates the schema. make test gives each run its own database and its own Silo bucket, removed afterwards, so several runs can go at once. A process test passes the transaction and silo.NewMemory().
  • Web: bun run test (unit tests), bun run typecheck, bun run lint, bun run format, bun run e2e (Playwright in Chrome, against make up).
  • A new or changed e2e test passes --repeat-each 10, not once, and waits for what the app shows rather than for a fixed time.

Conventions

  • Commits: one per change, prefixed feat:, fix:, refactor:, test:, docs:, chore: or style:, checked by a lefthook commit-msg hook (make setup). Commit messages are in English.
  • Releases: an annotated tag per version (v1.45.2).
  • CI runs on every push and pull request: Go format, vet and tests; lint, Prettier, unit tests, typecheck and build of the app; swagger.yaml and api.d.ts up to date; the e2e on the Docker stack; the server image built.
  • The lefthook hooks run gofmt, Prettier and actionlint, and check the commit prefix.
  • Rules a machine can check live in scripts/rules.sh, run by lefthook and CI.

Add a command

A command is declared in config/config.yaml (commands.<verb>-<noun>: its help, flags and examples), wired in cmd/<verb>.go, and run by cli/cmd-<verb>-<noun>/cmd.go. It is a client of the API: it talks through cli/services/apiclient.

  • Every command that reads takes --json; the shape only grows (a test pins it: go test ./cmd -run JSONContract -update after adding a field).
  • A missing value opens a form; an edit command changes only what a flag asks for.
  • The same capability goes to the MCP in the same change (a flag on the CLI, a field of an existing tool on the MCP: few tools, short descriptions).
  • Add its test against the test server, and its line in the README.

Add a route

One folder per route in core/api/<verb>-<noun>/, wired in router.go. The handler decodes with respond.Decode, runs a process and answers with respond.JSON or respond.Error. The swag comments above the handler are the OpenAPI. Then:

make openapi          # docs/swagger.yaml and the CLI's client
cd web && bun run types   # the web app's types

A new sentinel error of a process goes into the statuses table of respond.go, or the API answers 500. A route that moves big bodies lifts its own deadline: the server cuts a request at 30 s.

Add a setting

A setting on the account is a column: the domain field in core/domain/users.go, the schema (created at start, or a one-time migration if a default or a type changes), the validating process (edituser), the PATCH /api/me route and its OpenAPI, the settings page, the two locale files and the tests. A feature gated by a plan is one more entry of domain.Features and web/app/utils/features.ts.

Add a theme

A theme is six palettes: an accent color (primary), a gray scale (neutral) and four status colors (success, info, warning, error). See Theme.

Add a column to a business table

Add the field to the model: the server adds the column at its next start. A rename, a type change or a default to rewrite goes in migrations.go. Fill a NOT NULL column without a default in the same migration when the table has rows.

Clone this wiki locally