What composable means (to us) (ssr)

Written by Knut Melvær

Missing Image!

Recently, I came across this tweet (or is it “xeet”?), which initially piqued my interest because it reminded me that so much content work still happens in spreadsheets. That train of thought led me down a path where I started thinking about the true value of composability.

In the tweet, Akuya explained that he was trying to bring content from Google Sheets to the Sanity Content Lake. He found a way to do it with a bit of coding. Having the privilege of being more familiar with the platform, I also found a way to do it without having to write custom code—but by leveraging some shell scripting:

~/sanity-studio-folder
$ curl https://docs.google.com/spreadsheets/d/SHEET_ID/gviz/tq\?tqx\=out:csv\&sheet\=SHEET_NAME \
 | npx csvtojson \
 | npx groq "*" -i json -o ndjson \
 > data.ndjson \
 && npx sanity dataset import data.ndjson production

If you aren’t familiar with shell scripting, don't worry, what you see above is a way to connect and run small programs that can take in some information and output it. In the example, we’re seeing:

  1. the spreadsheet data as comma-separated-values (CSV), passing that data on to
  2. a small program that translates CSV into a JSON format, then on to
  3. another program that translates the array of JSON objects into newline delineated objects (NDJSON), and then passes that data on to
  4. the Sanity command line interface that imports the data into individual documents in the Content Lake

You might be thinking, “Wouldn’t it be easier if Sanity had a CSV importer?” —and I don’t disagree, it would be practical. But this example clearly shows that you aren’t dependent on whether or not Sanity has a particular feature in order to get your work done. Because we have the foundational APIs and abstractions, you can do stuff like this with little effort.

The shell environment (what you can access in Terminal.app if you are on a Mac or Command/Power Shell on a Windows) was designed as a composable platform. You can “pipe” information in and out between programs. The shell was a godsend for engineers and computer users, and decades after its conception, it’s still widely used. (For the curious, this episode of Command Line Heroes does a good job of telling the history of “the shell.”)

Not a headless CMS

You might have noticed that Sanity started calling ourselves the “Composable Content Cloud” last year. We’ve never been comfortable with the term “headless CMS,” because we feel we offer something a bit different (and better). Maybe you see this as a marketing ploy, but trust me: the terminology is meaningful and precise. I’ll explain a bit more, and hopefully, you might feel inspired to try new things with our platform.

…but a platform

On the surface, Sanity might look like a CMS. Still, if you look closer, it’s actually a collection of standalone technologies that work well together: Sanity Studio, Content Lake, a range of useful APIs, and supporting libraries and tooling for working with structured content.

This setup is based on the same idea from my original example of the shell environment: with a composable platform, you can quickly and efficiently pass information anywhere you need to. While most headless CMSes (or DXPs) have focused on omnichannel content delivery, we put just as much (if not more!) focus on how you aggregate, store, and manage the content (and data) that gets distributed to any channel.

The three layers of Sanity Composable Content Cloud showing Studio, APIs, and Content Lake

What “composable” means (for us)

What does it take to make a content solution truly composable? If you’re used to thinking about traditional CMSes, these factors might not be obvious:

The sweet spot

So, that’s what composability means to us. But what does it mean to our customers?

We recently talked to a famous design house and fashion brand in the Nordics, and they had an interesting perspective. They were looking to composable technologies because they occupied a sweet spot between an inflexible monolith that was overly opinionated and an unwieldy range of micro-services that bring high maintenance and development costs.

The composable mindset

When we’re talking about “composable” in the context of content management, I think it’s important to consider whether it’s possible to get the content out of the system and to what degree you are enabled and empowered to integrate and interact with the content inside it. It’s all about how the technology sits between and plays with other technologies.

It’s not enough to simply add “APIs” like many CMSes have done; there must also be enough flexibility in the system itself to accommodate your needs. For example, flexibility to model content in a way that’s more true to how your organization works and more resilient to different needs, channels, and website (re)designs.

Composable technologies like Sanity offered the company mentioned above flexibility and convenience. Thus, they could focus their resources on core business needs. In other words, they (mostly) let us worry about scaling the APIs to be performant during high-traffic times while not blocking them from doing things the way they wanted to.

Remember the shell scripting example from earlier? This mix of flexibility and convenience is similar. I could have written the code by hand, but it would have taken more time. Or I could’ve looked for a CMS that had a direct Google Sheets integration, but chances are it would do other things in a way I didn’t like.

Instead, I could quickly assemble some tools and get the desired result. That’s the magic of composability.