Project structure
go.work Go workspace (pkg, services/*, tools)
pkg/ shared Go libraries (one module)
gen/authz/v1/ generated protobuf + ConnectRPC code
services/<name>/ one Go module per service (Python for vision)
services/Dockerfile shared multi-stage image for Go services (--build-arg SERVICE=<name>)
proto/authz/v1/ internal RPC definitions (buf.yaml, buf.gen.yaml at the root)
web/ frontend (TanStack Start)
docs/specs/ specifications (binding)
docs/dev/ internal contracts per delivery phase
docs/site/ this Docusaurus site
dev/ local stack configuration (Garage, Keycloak realm)
tools/ dev tooling (lint wrapper, commit-msg hook)
docker-compose.yml local stack
Makefile developer entry points
lefthook.yml git hooks
Service layout
Every Go service follows the same layout (reference implementation: services/audit):
services/<name>/
cmd/<name>/main.go wiring only (config, telemetry, stores, server, consumers)
internal/config/ env loading (pkg/config)
internal/<domain>/ domain logic: commands (write side) and queries (read side)
internal/api/ Gin handlers, request/response DTOs
internal/store/ persistence
openapi.yaml OpenAPI 3.1 of the public API
Rules: shared code lives in pkg/ only (services never modify it; missing features are reported); every
handler error goes through httpx.Fail with a problem.* value; every list endpoint uses cursor pagination;
every write is audited.
Dependencies between services
Dotted arrows are planned (phase 2). See Kafka topics for asynchronous links.
| Service | Depends on (sync) | Shared libraries (pkg/…) |
|---|---|---|
| gateway | authz (RPC), Valkey, Keycloak (OIDC) | audit, authzclient, cloudevent, config, gen, httpx, kafkax, logging, outbox, principal, problem, telemetry |
| authz | MongoDB, Permify, Keycloak admin API (optional) | arn, audit, catalog, cloudevent, config, eventstore, gen, httpx, ids, kafkax, logging, mongox, outbox, pagination, principal, problem, telemetry |
| members | authz (RPC), MongoDB, Google Directory API, Keycloak admin API | arn, audit, authzclient, cloudevent, config, cryptox (+ barbican), csvx, eventstore, httpx, ids, kafkax, lease, logging, mongox, outbox, pagination, principal, problem, telemetry |
| audit | authz (RPC), immudb | arn, audit, authzclient, config, httpx, kafkax, logging, pagination, principal, problem, telemetry |
| vision | none (stateless) | none (Python) |