simeonGriggs.dev
Twitter
GitHub

Sanity Schema Generator

Trying my hand at adding to the the Developer Experience of Sanity.

View in Sanity Studio

Updated 2020-06-18 | Published 2020-06-09

After 10-ish years of WordPress development I rely on so many amazing developer tools for the platform. While so many newer, fancier CMS's exist to do WordPress does as a platform, it's all these developer experience tools around the edges that are missing.

GenerateWP is one example which makes writing complex queries very simple with some nice UI tools.

So as a recent convert to Sanity, I've wondered if instead of waiting for the tools to come along, perhaps I could build one myself.

Oh and some irony. What has drawn me to Sanity over other headless CMS's such as Prismic or Contentful is that those platforms only allow you to create fields using a user interface. Where Sanity makes you declare them with code. So I went and built a user interface for Sanity.

Take a look

Sanity Schema Generator

This does not currently support all the Sanity Schema field types, nor every option within each field type.

All field types are supported, with the exception of document, block, and span. They're all out of the scope of this project.

And while all field type options are displayed, but not all of them are yet editable.

Caveats:

  • It was also just an excuse to try out Vite
  • It's also made me think I've bitten off more than I can chew...

Mostly I wanted to write something that will eventually generate hoisted objects for me because they do my head in! That's on the todo list.

Try it out. Let me know if it's useful. Let me know where it's broken.