|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | + |
| 5 | +This repo is a Go workspace (`go.work`) containing multiple Go modules: |
| 6 | + |
| 7 | +- `service/`: main OpenTDF server and platform services (binary entrypoint: `service/main.go`). |
| 8 | +- `sdk/`: Go SDK and generated clients. |
| 9 | +- `lib/*/`: shared libraries (e.g., `lib/ocrypto`, `lib/identifier`). |
| 10 | +- `protocol/` and `service/`: protobuf sources; generated Go lives under `protocol/go/` and docs under `docs/grpc/` + `docs/openapi/`. |
| 11 | +- `tests-bdd/`: BDD/integration-style tests (Godog) and feature files (`tests-bdd/features/`). |
| 12 | +- `docs/`, `examples/`, `adr/`: documentation, example code, and architecture decisions. |
| 13 | + |
| 14 | +## Build, Test, and Development Commands |
| 15 | + |
| 16 | +Prefer `make` targets at repo root: |
| 17 | + |
| 18 | +- `make toolcheck`: verifies required tooling (Buf, golangci-lint, generators). |
| 19 | +- `make build`: regenerates protos/codegen and builds `opentdf` + `sdk` + `examples`. |
| 20 | +- `make lint`: runs `buf lint`, `golangci-lint`, and `govulncheck` across modules. |
| 21 | +- `make test`: runs `go test ./... -race` across core modules (does **not** include `tests-bdd/`). |
| 22 | +- `docker compose up`: brings up local infra (Postgres + Keycloak). See `docs/Contributing.md`. |
| 23 | + |
| 24 | +## Coding Style & Naming Conventions |
| 25 | + |
| 26 | +- Go formatting is enforced: run `make fmt` (uses `golangci-lint fmt`; Go uses tabs for indentation). |
| 27 | +- Imports should be goimports-compatible; keep package names lowercase; exported identifiers use `PascalCase`. |
| 28 | +- Protobuf changes must pass `buf lint` and should be regenerated via `make proto-generate`. |
| 29 | + |
| 30 | +## Testing Guidelines |
| 31 | + |
| 32 | +- Unit tests: `*_test.go` next to code; run `make test`. |
| 33 | +- BDD tests: run `cd tests-bdd && go test ./...` (requires Docker; feature files are `tests-bdd/features/*.feature`). |
| 34 | +- Integration tests may require the compose stack; follow module README(s) under `service/`. |
| 35 | + |
| 36 | +## Commit & Pull Request Guidelines |
| 37 | + |
| 38 | +- Commit messages follow Conventional Commits (e.g., `feat(sdk): ...`, `fix(core): ...`). |
| 39 | +- DCO sign-off is required: use `git commit -s -m "feat(scope): summary"`. See `CONTRIBUTING.md`. |
| 40 | +- PRs should describe changes, include testing notes, and update docs/tests when applicable (see `.github/pull_request_template.md`). |
| 41 | + |
| 42 | +## Security & Configuration Tips |
| 43 | + |
| 44 | +- Don’t commit secrets/keys. Use local configs like `opentdf-dev.yaml` and follow `SECURITY.md`. |
0 commit comments