| title | Overview |
|---|---|
| description | Backend contribution guidelines for the Go application. |
| sidebar_position | 1 |
| hide_table_of_contents | false |
The backend is a Go application under backend/.
Each domain package under internal/ follows a flat structure:
| File | Purpose |
|---|---|
service.go |
Service interface + business logic |
handler.go |
HTTP handlers |
store.go |
Data access layer |
model.go |
Domain models and DTOs |
constants.go |
Package constants |
error_constants.go |
Error messages and codes |
store_constants.go |
DB queries and table names |
init.go |
Package initialization and route registration |
- File naming:
snake_case(e.g.,error_constants.go) - Exports: Only export service interface and models used in service. Keep implementations, constants, queries unexported.
- Logging: Use
logpackage frominternal/system. Avoid PII; useMaskStringfor sensitive data.
After changing any interface, regenerate mocks:
make mockery:::warning
CI has a verify-mocks job that will fail your build if mocks are out of sync with the interfaces.
:::
| Purpose | Command |
|---|---|
| Unit tests | make test_unit |
| Integration tests | make test_integration |
| Specific test | make test_integration RUN="TestName" |
| Specific package | make test_integration PACKAGE="pkg/path" |
| All backend tests | make test |