zeekayandHanzo Dev f2ae99a68f docker: golang 1.26.5, the version go.mod already requires
The base image could not satisfy this module's own go directive, so the
build died at `go mod download`:

    go: go.mod requires go >= X (running Y; GOTOOLCHAIN=local)

GOTOOLCHAIN=local is correct for a hermetic build -- it refuses to silently
fetch a different toolchain -- which turns the gap into a hard error rather
than a slow surprise.

Latent until now: every docker build on this forge failed earlier, first at
`Extract metadata` (git-runner af8b7ce + d0a9bc7) and then at the gha cache
exporter (hanzoai/.github e4492d9). With those cleared the build reaches the
Dockerfile for the first time and 17 repos turn out to share this mismatch.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-01 04:19:16 -07:00

hanzoai/template — canonical Go backend skeleton

This is the one-way shape for a Hanzo-stack Go backend. Copy the tree, rename template everywhere, and wire your routes. Do not deviate from the layout without a spec change in ~/work/hanzo/ARCHITECTURE.md.

The skeleton ships:

  • cmd/app/ — operator CLI (migrate, seed, shell).
  • cmd/appd/ — long-running HTTP daemon.
  • config/config.go — env-only configuration.
  • api/ — HTTP handlers (public + tenant-scoped).
  • models/ — orm.Typed[T] data models.
  • migrations/ — base TS migrations.
  • store/ — thin wrapper around hanzoai/base/store.MultiTenantStore.
  • web/ — optional embedded SPA.
  • LLM.md — next-agent handoff.

The key invariants it enforces:

  1. Gateway-upstream assertion at boot (claims.AssertGatewayUpstream).
  2. claims.Strip → claims.Inject → claims.RequireGateway on every tenant-scoped route.
  3. Per-(org, user) SQLite via store.ForCtx(ctx). No direct file opens.
  4. Public endpoints (/healthz, /readyz, /metrics) mount BEFORE the tenant middleware chain.
  5. Single multi-arch image built in CI — never locally.

To bootstrap a new service:

cp -R ~/work/hanzo/_template ~/work/hanzo/<service>
cd ~/work/hanzo/<service>
find . -type f -exec sed -i '' 's/template/<service>/g' {} +
go mod init github.com/hanzoai/<service>
go mod tidy
go test ./...

Then replace models/example.go and api/example.go with your domain.

S
Description
Starter template for building a Go backend service on the Hanzo stack.
Readme
68 KiB
Languages
Go 96%
Dockerfile 4%