Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 2.43 KB

ARCHITECTURE.md

File metadata and controls

28 lines (20 loc) · 2.43 KB

appkitc — architecture

1. Overview in One Minute

appkitc turns the declaration of an app (config/app.go) into the files that start it: the server, the browser and the migration binary. It is a development tool: it ships inside the webtyp program, which connects it to the server (SetMainGenerator); no app lists it in its go.mod and no production binary contains it. Its templates are compiled, in its own tests, against the libraries it requires, so a template that no longer matches them is not published.

2. Repository Pieces & On-Disk Layout

File Single responsibility
generate.go GenerateMain: chooses what to write for the kind of project, writes only files that carry the generated header, upgrades the libraries the templates call when output changed (UpgradeGeneratedLibraries).
templates.go The templates, one constant each; the only place that knows what a generated file contains.
services.go Refuses an app whose config/ is not split by side and moves the old removed.go.
migrations.go Builds config/services/migrations.go from App.Modules.
register_args.go The Register(...) call of apps that still use config/routes.go.
tests/fixtureapp/ The smallest compilable app; its generated files are committed and compiled by the tests.

3. Step-by-Step Flows

  • Generate: docs/diagrams/GENERATED_MAINS.md — webtyp dev asks the connected generator for the app's files; if any changed it runs go get <library>@latest for each library the templates call.
  • Publish: the fixture test regenerates the fixture, compares it with the committed copy and compiles it (native and GOOS=js GOARCH=wasm) against the libraries in go.mod. A template that does not compile fails here, never in an app.

4. Security Boundaries & Contracts

  • appkitc imports webtyp.com/server (project detection, MainConfig) and the libraries its templates call; neither server nor appkit may import appkitc, and no app lists it: the program that starts the server connects it.
  • A test fails if any main of the fixture depends on webtyp.com/appkitc.
  • A file without the Code generated by webtyp.com/ header belongs to the developer and is never written.
  • No go.mod/go.sum line is written by hand: only go get and go mod tidy.