What is Sanity?
Sanity.io is more than your traditional headless CMS. It offers a content management system that truly caters to developers, content creators, and businesses alike, providing a toolbox for crafting your digital landscape.
Sanity treats all of your content as structured data - specifically as JSON documents - giving you lots of flexibility. It all starts with schemas - you set your own rules for content, laying out an orderly, consistent framework across different platforms. For developers, this means an easy-to-follow structure when working with the data in code. For content creators and editors, this provides clear guidelines and creative freedom within defined boundaries. And here's the bonus: you're not confined to standard or predefined structures. With Sanity, you can design custom schemas that perfectly fit your needs.
Sanity stores your data in their “Content Lake”, a real-time, cloud-based database, while Sanity Studio serves as the open-source platform where you can shape and edit your content. What sets Sanity Studio apart is its ability to facilitate collaboration, by displaying real-time updates for all users.
Want to find out more? Let’s dive in.
Signing up for Sanity is as straightforward as it gets. As soon as you set up an account, a brand-new Sanity project is prepped and ready for you.
Next, Sanity gives you a command to run in your terminal to set up Sanity Studio via their CLI.
Sanity’s Getting Started docs are a fantastic starting point to familiarise yourself with the platform. They guide you through creating your first schema, editing content, and give you the details on how to connect your content to frontend frameworks like Next.js, Nuxt.js or SvelteKit. For the visual learners, there’s a short video tutorial that walks you through the main features.
On top of that, Sanity offers a variety of templates that range from clean-slate projects to comprehensive examples. These templates serve as your roadmap, helping you to understand how everything slots together. And if you're curious about integrating Sanity with other frontend frameworks like Gatsby or Remix, they've got you covered with a range of guides and resources.
So far so good!
Sanity Studio is where the magic happens ✨. This is your personal playground to create, manage, and distribute your content.
A standout feature for me is Sanity Studio’s real-time collaboration. When you make changes, they automatically sync to Sanity’s Content Lake and become visible to all active users in real time. No need to hit 'Save', no need for others to refresh, the updates appear as and when they're written for everyone. Sanity even cleverly uses icons to show who's editing what, reducing the risk of any editing clashes. To top it off, you have access to a complete version history, allowing you to revert to older content versions easily. With countless case studies showing how Sanity boosts team productivity, it's clear to see why this feature is a game-changer.
Sanity Studio starts off as a blank canvas with a number of plugins that you can install and set up according to your project’s needs. I particularly liked the “Live Preview” feature, which gives you a sneak peek of your draft content in Sanity Studio before it goes live.
All in all, Sanity Studio provides a versatile workspace where you’re in control. You can even embed the studio into your chosen frontend framework, meaning that you can have your project and content management all in one place.
💡In a nutshell, Sanity Studio is simple on the surface but packed with power - a winning combination, if you ask us.
Sanity’s “Content Lake” is where all of your data and content reside. It's a secure, cloud-based storage system fully managed by Sanity, so there's no need to stress about data hosting.
The Content Lake is more than a home for your data, it's a dynamic ecosystem shaped by the unique schemas you create. As developers craft and update these schemas, the Content Lake adapts to incorporate them. This means you end up with a data structure that's not just robust, but carefully tailored to your project's needs.
To pull this data into your favourite frontend, you can use GROQ, Sanity’s open-source query language. I found GROQ both powerful and intuitive, providing an impressive level of flexibility when pulling data. Pro tip: Install the Vision plugin to play with GROQ queries right the Sanity Studio and use this cheat sheet to help you.
If you’re a developer looking to build a project with Sanity, be sure to join the Sanity Slack workspace. It’s a very active and friendly community and I found it to be a fantastic complement to their documentation.
One thing that impressed me was the consistent engagement of Sanity team members. They actively respond to questions and provide insights into how Sanity works. I particularly enjoyed searching through the Slack’s chat history, offering me a deeper understanding and context of different areas.
Finally, be sure to check out the content that Sanity’s Developer Relations team is putting out. For example, this video tutorial from Kapehe and FreeCodeCamp is a great resource about using Sanity with Next.js’ new app router.
So what do I think? After spending some time with Sanity, I must say, I’m impressed. At first, the level of customisation options felt a little bit overwhelming. However, once I dug in, I realised that it's this very flexibility that makes Sanity shine as a headless CMS.
There is a learning curve, especially when it comes to the more advanced features and customising Sanity Studio. But that's where the active and supportive Sanity community comes in. Their insights and help were invaluable, making my journey much smoother.
A tip from my own experience, specifically for developers out there? Take the time to truly learn the platform. The clean-slate projects are great, but if you're aiming to grasp how everything fits together, try building it from scratch. It might seem daunting at first, but it'll pay off in the long run.
Stay tuned, as I'll soon be sharing an open-source project that I've built using Sanity right here on this blog! 🚀