Skip to content

brain-fuel/cadence

Repository files navigation

cadence

goforge.dev/cadence is the serving strategy foundation for server-driven UI: the region model, the Tree/Diff content substrate, and the Strategy/Policy algebra that decides how and when a region's content is produced and delivered. It is host-agnostic and standard library only, with zero third-party runtime dependencies.

A Region is a cheap Skeleton shown immediately and an expensive Render produced afterward, both returning a Tree. Tree interleaves static and dynamic parts, and Tree.Diff compares two renders of the same region to return only the dynamic slots that changed, or reports that the region's shape itself changed and needs a full replace.

A Strategy has one of three kinds:

  • Eager: computed on the server, inline, before the first byte.
  • Deferred: a skeleton first, then content after first paint, from a chosen Where (Server or Client) on a chosen Trigger (OnLoad, OnVisible, OnHover).
  • Live: server-held state pushing patches as it changes.

A Policy assigns a Strategy per region (Fixed, Uniform today; adaptive policies come later). The algebra carries one law: with JavaScript off, every strategy degrades to Eager. NoScript projects any Strategy to Eager, and FallbackHolds checks that law against a concrete Interpreter and Region.

cadence defines the algebra; it does not ship a transport. Interpreters that turn a Strategy into real delivery live above it and import it: a net/http transport library such as quicken (in progress, being rebased onto cadence), and, later, a TEA-style client interpreter.

Sketch

p := cadence.Fixed(map[string]cadence.Strategy{
	"comments": {Kind: cadence.Deferred, Where: cadence.Client, On: cadence.OnVisible},
})

s := p.StrategyFor("comments", cadence.RequestContext{}, nil)
// s.Kind == cadence.Deferred, s.Where == cadence.Client, s.On == cadence.OnVisible

License

MIT. Copyright (c) 2026 Goforge.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages