Organize backend into product executable and shared Go modules
This commit is contained in:
1 parent
981e84a4b4
commit
f0720ec66b
382 files changed
+1944
-6989
No files matched your search
+14
-3
@@ -25,11 +25,11 @@ skill to perform this completion workflow.
|
||||
## Use the project error model
|
||||
|
||||
- Do not introduce `fmt.Errorf` or `errors.New`. Use the constructors and
|
||||
wrapping helpers in `backend/pkg/merrors`.
|
||||
wrapping helpers in `backend/shared/errors`.
|
||||
- Preserve the underlying cause when adding context by using an appropriate
|
||||
`merrors` wrapping helper.
|
||||
- When no suitable project error exists, add the smallest generally useful
|
||||
definition or helper to `backend/pkg/merrors` instead of creating an ad hoc error
|
||||
definition or helper to `backend/shared/errors` instead of creating an ad hoc error
|
||||
elsewhere.
|
||||
|
||||
## Keep modules cohesive and names concise
|
||||
@@ -93,7 +93,18 @@ unused dependencies; remove those dependencies from the selected components.
|
||||
Copied BFF components are locally owned and may diverge.
|
||||
Use only Sendico's public HTTP API for platform operations. Never import sibling
|
||||
Sendico modules or access its database, internal gRPC APIs, discovery or message
|
||||
bus. Keep the pinned public wire contract separate from local DTOs and models.
|
||||
bus. Keep consumed public wire contracts inside the owning adapter, separate
|
||||
from local DTOs and models. Do not copy unused API snapshots.
|
||||
Resolve the configured provider organization and customer resource ownership on
|
||||
the server. Never treat all customers as the backend integration principal.
|
||||
Use the copied structured logger, injected at operational boundaries.
|
||||
|
||||
## Go module structure
|
||||
|
||||
`backend/` groups independent Go modules; it is not itself a Go module.
|
||||
`product/` is the customer-facing executable and owns its `main.go` and `go.mod`.
|
||||
`shared/` is a library module for reusable infrastructure and has no entry point.
|
||||
Backoffice belongs in its own executable module (`backoffice/`) when implemented,
|
||||
with its own entry point and configuration, not inside the product executable.
|
||||
Keep feature models, storage, services and transport together inside their owning
|
||||
module. Shared infrastructure must not import a product or backoffice module.
|
||||
Reference in new issue
Block a user