Architecture Deep-Dive (Platform Engineering)

This chapter is for platform engineers, architects, and contributors to the Krewire repositories. It explains the rules that keep dozens of independent packages and several product repositories composable: which code may import which, how repositories depend on each other, how systems are scoped, and where data enters a page.

Tip: Building an app or a site? You can skip this chapter entirely. The beginner track and the workload guides are written so that none of the concepts here are required. Come back when you design a multi-service platform, contribute to the core, or need to reason about build-time versus request-time rendering.


Pages in This Track

Layers 0โ€“5, strict downward-only imports, peer decoupling through bridges and gateways, Single Source of Truth, and the pure-Go rule.

How the repositories (krewire, ui, krew, cloud, auth, dash, panel, the sites) depend on each other at compile time and integrate at runtime.

Workspace โ†’ Module โ†’ Domain โ†’ Service โ†’ Unit: the five levels codified in pkg/model and how specs and tests target them.

How data reaches a .kiw view at build time (site, book) and at request time (app), with Go handler recipes and client-side fetch patterns.


Staged Learning Path for Teams

Engineering teams adopting Krewire across several products can follow this six-stage path. It covers the whole documentation, so treat it as a curriculum rather than a prerequisite.

[Stage 1: Core Mental Model] โ”€โ”€โ”€โ–บ [Stage 2: Developer Onboarding]
             โ”‚                                   โ”‚
             โ–ผ                                   โ–ผ
[Stage 3: Workload Mastery]   โ”€โ”€โ”€โ–บ [Stage 4: Domain Packages Deep-Dive]
             โ”‚                                   โ”‚
             โ–ผ                                   โ–ผ
[Stage 5: Daily Dev & CLI]    โ”€โ”€โ”€โ–บ [Stage 6: Cloud, Operations & Scale]

Stage 1: Core Mental Model & Architecture

  1. Why Krewire? โ€” Go resource efficiency, single binaries, no npm/bundler toolchain, and data sovereignty.
  2. Core Philosophy โ€” The Three Pillars (Secure, Sustainable, Scalable) and the stdlib-first convention.
  3. Workload Matrix โ€” The eight project kinds and how they compose without rewrites.
  4. Layered Pyramid, Ecosystem DAG, and Scope Levels โ€” the rules in this chapter.

Stage 2: Developer Onboarding

  1. Beginner track โ€” Quickstart and Fullstack app tutorial.
  2. Installation, Configuration, and Directory Structure.
  3. The .kiw DSL and Agentic Development.

Stage 3: Workload Specialization

Stage 4: Domain Libraries

Stage 5: Daily Workflows & CLI

  1. CLI Command Reference
  2. Configuration Schema Reference
  3. Custom Scripting & Automation

Stage 6: Operations, Cloud & the Open-Core Boundary

  1. Deployment & Operations
  2. Open Core & Licensing

Sources

The rules on these pages summarize the specifications in the core repository, which remain authoritative:

  • krewire/docs/foundation/architecture.md โ€” monorepo layers and the six layering invariants.
  • krewire/docs/foundation/ecosystem-dag.md โ€” the ecosystem DAG and compile-time vs runtime boundaries.
  • krewire/pkg/model/scope.go โ€” the scope hierarchy as code.
  • krewire/layering_test.go โ€” the tests that enforce the layering.