Architecture
Binaries, chart domain, outbox publisher, and service layout.
Binaries
| Binary | Path | Role |
|---|---|---|
| API | cmd/api | HTTP + background outbox publisher |
| Log consumer | cmd/logconsumer | Dev-only RabbitMQ logger for accounting.# |
The API binary starts publisher.Run in a goroutine after the HTTP server is up — see
services/accounting/cmd/api/main.go.
Domain packages
| Package | Role |
|---|---|
internal/chart | Create account, classifications, hierarchy validation |
internal/command | Same Execute pattern as template |
internal/publisher | Poll outbox, publish to RabbitMQ |
internal/ledger | Placeholder for the next slice |
Handlers: services/accounting/internal/handlers/accounts.go.
Events
Payload structs and golden fixtures live under the domain's events/ package (target:
<domain>/events/ per
docs/decisions/0015-domain-scoped-outbox-and-table-prefixes.md). Today:
services/accounting/events/account.go at the service root (legacy).
Event envelope (including optional why): services/accounting/envelope/.
Migrations
0001_platform.sql— service-scoped principals (target: no domain tables here)0002_chart.sql— charts and accounts (target:chart_*prefix per domain slug)0003_why.sql— audit envelope column
Accounting still uses the legacy service-wide outbox until refactored to docs/decisions/0015-domain-scoped-outbox-and-table-prefixes.md.
Authorization
Cedar policy: services/accounting/policies/policy.cedar. Dev principals seeded
by make dev-seed from services/accounting/testdata/dev-seed.sql.