Workloads

Krewire provides a unified developer experience across eight first-class workload kinds. Rather than stitching together disjointed libraries and runtimes, every workload is defined in a single configuration file (krewire.yaml) and orchestrated through one developer tool (kiw).

Workload kind selection informs the compiler, dev server, and deployment pipeline while preserving standard Go ergonomics and strict downward-only package dependencies.


What is in this Chapter?

This chapter provides comprehensive architectural documentation, configuration guides, and code examples for each of the eight supported workloads:

Single-binary web platforms with Go net/http, embedded static assets, SSR templates, session management, and integrated dependency injection.

Interactive terminal utilities and command trees powered by the lightweight pkg/tui toolkit and POSIX-compliant flag parser.

High-speed marketing sites and landing pages with file-based routing, compile-time scoped .kiw components, and zero JavaScript overhead.

Multi-chapter documentation portals and manuals compiled from Markdown manuscripts using the zero-dependency pkg/book engine.

Asynchronous queue processing, scheduled cron tasks, retry policies, backoff timers, and dead-letter queues via pkg/cloud/worker.

Cloud-native microservices with service discovery, API gateway routing, rate limiting, circuit breaking, and OpenTelemetry distributed tracing.

Declarative Infrastructure as Code (IaC) written in Go structs, supporting deterministic execution plans and multi-cloud provisioning.

Declarative reverse proxies with per-route middleware, rate limiting, timeouts, and service-discovery load balancing.


Workload Comparison Matrix

Workload Kind Entry Point Primary Packages Output Artifact Deployment Target
app cmd/server/main.go or main.go web, app, ui, sec Single Go Binary VPS, Docker, VM
cli cmd/<name>/main.go tui, term, kern/errs Standalone CLI Binary User Terminal, PATH
site pages/index.kiw kiw, web/ssg, ui Static HTML / CSS / JS GitHub Pages, S3, Nginx
book content/ pkg/book, markdown Static Book Site Documentation CDN
worker cmd/worker/main.go cloud/worker, resilience Long-running Daemon Docker, K8s, Systemd
service cmd/service/main.go cloud/service, sec RPC/HTTP Service Kubernetes, ECS, Bare Metal
infra infra/main.go cloud/infra Deployment Plan / State AWS, GCP, Azure, K8s
gateway main.go web/gateway, cloud/service/registry Go Binary (reverse proxy) Edge, Kubernetes, VM

Configuring Workloads in krewire.yaml

To set up project metadata and capabilities, configure krewire.yaml:

project:
  name: "storefront"
  version: "0.1.0"
  author: "Acme Corp"

Krewire automatically detects project capabilities using shape markers and declarative configuration blocks:

  • Directories containing pages/ or an ssg: key activate SSG capabilities.
  • Directories containing content/ activate book documentation capabilities.
  • Projects containing a worker: key activate background worker queues.
  • Projects containing a service: key activate headless service capabilities.
  • Projects containing a gateway: key activate edge API gateway routing.
  • Projects containing an infra: key activate cloud infrastructure management.
  • Repositories containing main.go or cmd/ activate binary app execution.

A pre-scaffold bootstrap project (only go.mod, krewire.yaml, and the starter main.go) is in a pre-init state until krew init equips layout and capabilities.