The CMS half of munakalati. Five notes, in reading order.
Sanity is the domain this project taught most thoroughly — a headless CMS is the first place many frontend developers meet content modelling as a design activity in its own right, separate from both database design and component design.
- 01 — Setup and the Mental Model — [Beginner] — projectId/dataset/apiVersion/token, why the API version is a date,
useCdnand when it must befalse, the two-client split - 02 — Schema Design ⭐ — [Beginner → Intermediate] — the sixteen types and the four shapes they fall into, the
orderpattern, singletons as a convention not a feature,required()is a form check and not a constraint, presentation leaking into the content layer, and how the hand-written types drifted - 03 — GROQ ⭐ — [Beginner → Intermediate] — the three parts of every query,
->as the whole join story, the projection is the optimisation, parameters vs. injection, conditional filters, and two dead queries found by grep - 04 — Images and Portable Text — [Intermediate] — asset references,
hotspot, theurlForchain, two CDNs in the path, why rich text isn’t HTML,markDefsindirection, the four renderer buckets - 05 — The Embedded Studio and Structure Builder — [Intermediate] —
[[...tool]]optional catch-all,ssr: falseand keeping the Studio out of the site bundle, singletons in the sidebar, Vision
The three things to take away
A headless CMS is a database whose schema doubles as its admin UI and its documentation. Every title and description you skip is an instruction an editor never receives.
required() in a schema is a form check, not a constraint. Anything that entered through the API — every one of the 434 migrated posts — can violate it. Guard in the query with defined().
The projection is where GROQ performance lives. Swapping a 20-field projection for {"slug": slug.current} was the fix in commit f2b69dc, not a change to the filter.
Related
- General: frontend/frameworks/sanity/ · content modeling and headless CMS
- 05 — the migration — how the content got in
- interview: Sanity and content modelling
Software engineering
Infrastructure & security
Computer science
Hardware & engineering