Element
A node in the composition tree: a kind that selects its renderer, JSON parameters, free content, and a parent. Reusable ones — this site's header — are included by reference wherever needed.
Architecture
One deployment, one Postgres, many sites. Tenant routing runs first on every request: the Host header resolves to a Domain row, the connection's search_path switches to that tenant's schema, and from that moment every query — pages, elements, users, assets — can only see one site's world.
The two right-hand stages almost never run. Computed HTML is cached per page, and a dependency graph keeps that cache honest — which is the part of a CMS that is usually wrong, and the part Uruk treats as the core of the design.
Data model
Every row carries a UUIDv7 key and timestamps. Everything below lives in the tenant's own schema and travels with the site.
A node in the composition tree: a kind that selects its renderer, JSON parameters, free content, and a parent. Reusable ones — this site's header — are included by reference wherever needed.
A node in the URL tree: slug under a parent, unique per level, plus the root_element it renders from. The path /blog/my-post is just a walk down this tree.
CSS, JS, images, fonts — bytes in the database with a sha256 content hash, served immutable at /_assets/<hash>/<name>. A change is a new hash, so caches never lie.
Namespaced JSON configuration. This site's <head> — stylesheet link, favicon — is the site.head_html setting, data like everything else.
The reverse index behind exact invalidation: which elements each page's cached output was built from. Written on render, consulted on every save.
The only shared tables, in the public schema: which schemas exist and which hostnames select them. Unmatched hosts fall back to the default tenant — this site.
Caching rendered HTML is trivial; evicting the right entries is not, because elements are shared across pages. Uruk records the full dependency set at render time, then listens on element save and delete signals. One edit to the header element evicts the four pages that reference it and no others. Deletions survive long enough to be found because the index stores bare UUIDs, not foreign keys.
Because every key is a UUIDv7, a whole site serializes to one JSON archive — elements, pages, assets (bytes included), settings — and restores onto any other Uruk with ids intact and zero collisions. The site you are reading is itself seeded from such an archive on first boot.
{
"uruk_archive_version": 1,
"tenant": { "name": "Uruk" },
"elements": [ … every block of this site … ],
"pages": [ … /, /manifesto, /architecture, /quickstart … ],
"assets": [ … css, js, fonts, favicon — bytes and hashes … ],
"settings": [ … site.head_html … ]
}