Core & Foundation Libraries
The foundational tier of Krewire establishes the architectural guarantees, domain rules, and lifecycle supervision required by all workloads.
Packages in this layer adhere to strict design principles:
- Strict Downward-Only Dependencies: Domain primitives and rules reside in
pkg/modelandpkg/errs. Higher packages never inject upward dependencies. - Single Source of Truth (SSOT): Facts, constants, and validation rules are owned by exactly one package and imported elsewhere.
- Zero Third-Party Bloat: Where Go standard library packages suffice, Krewire builds upon them without introducing external dependency chains.
What is in this Chapter?
The foundational domain model: eight workload kinds, project metadata, scope hierarchy, error taxonomy, environment detection, and version contracts.
Imperative control plane of Krewire: kernel supervisor, module registry, dependency ordering, and graceful process shutdown.
Deterministic configuration loading with precedence ordering across CLI flags, environment variables, and layered .env files.
Zero-reflection, composable data validation rules for API payloads, forms, and business logic schemas.
Circuit breakers, jittered exponential retry backoff, deadline budgets, and fault isolation primitives for distributed operations.
Fast assertion utilities, HTTP response recorders, ephemeral server fixtures, and golden test helpers.