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.
Ecosystem DAG โ
How the repositories (krewire, ui, krew, cloud, auth, dash, panel, the sites) depend on each other at compile time and integrate at runtime.
Scope Levels โ
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
- Why Krewire? โ Go resource efficiency, single binaries, no npm/bundler toolchain, and data sovereignty.
- Core Philosophy โ The Three Pillars (Secure, Sustainable, Scalable) and the stdlib-first convention.
- Workload Matrix โ The eight project kinds and how they compose without rewrites.
- Layered Pyramid, Ecosystem DAG, and Scope Levels โ the rules in this chapter.
Stage 2: Developer Onboarding
- Beginner track โ Quickstart and Fullstack app tutorial.
- Installation, Configuration, and Directory Structure.
- The
.kiwDSL and Agentic Development.
Stage 3: Workload Specialization
- Content: Book, Site.
- Terminal tools: CLI & TUIs.
- Web: App, Gateway.
- Distributed systems: Worker, Service, Infra.
Stage 4: Domain Libraries
- Foundations: Model, Lifecycle, Config, Validation, Resilience, Testing.
- Web & UI: Web engine, Application container, Web runtime & WASM, UI, UI components, TUI.
- Data: Database & ORM, Storage, Filesystem, Caching, Mail, Commerce & payments.
- Security & platforms: Security, Auth, Identity, Distributed systems, Hybrid PaaS, AI orchestration, Autonomous agents, Virtual workspace.
Stage 5: Daily Workflows & CLI
Stage 6: Operations, Cloud & the Open-Core Boundary
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.