Stage 7 · Master
Workspace Layout, Design Principles, and the Platform Library
The Platform Library
libs/platform's five packages — config, logging, errors, response, and tenancy — and the shared conventions they enforce across every service.
Why a Shared Library
Four independently deployed services need identical conventions for configuration, logging, error shape, and tenant propagation — otherwise each service reinvents its own, and cross-service log correlation and API consistency break down. libs/platform holds five small packages implementing these conventions once, imported by every service module via the go.work replace directive established in the previous chapter.
config
logging
errors and response — the Platform Contract
The Platform Contract is the API shape shared between every Meridian service and meridian-web, the frontend BFF. Success responses look like { data, meta?, error: null }; failures look like { code, message, trace_id, details? }. Both shapes are implemented as Go types in libs/platform today, though no handler yet constructs them — see Current Adoption Status below.
tenancy
Current Adoption Status
All five packages compile and are unit-tested today. No service handler currently constructs a response.Envelope, returns an errors.APIError, or reads a tenancy.TenantIDHeader — every service's only route is /healthz, which predates the need for any of these types. Chapters 4 through 6 are where each package is first put to use by a real handler.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.