- Documentation
- Concepts
- JSON-LD Architecture in AI Launch Kit
JSON-LD Architecture in AI Launch Kit
A technical deep-dive into how AILK's schema package generates, validates, and emits structured data for every page type.
JSON-LD Architecture in AI Launch Kit
@ailk/schema is the structured-data layer of the AILK stack. It ships one builder per schema.org type — 45 in Phase 2 — and a dispatcher that maps a typed ContentPageInput to the right builder at runtime.
The builder contract
Each builder is a pure function:
type Builder<T extends ContentPageInput> = (
input: T,
pack: SiteIdentityPack,
) => JsonLdObject;Builders are pure — no side effects, no network access, no randomness. The same input always produces the same output.
The dispatcher
buildJsonLdWithPack(input, pack) looks up the input's type in the registry and delegates to the matching builder. Unknown types throw at runtime rather than silently producing empty output.
The registry
pageTypeRegistry maps each key (the frontmatter type value) to a pageType (the schema.org @type string), a family, and a tier. Builders within the same family share structural conventions; tiers signal OSS vs. extended availability.
The pack
A SiteIdentityPack carries stable site-wide metadata (URL, organization name, logo) resolved once per build or request. Every builder uses it to populate publisher, url, and inLanguage.