๐Ÿ”ฎ Sanity Create is here. Writing is reinvented. Try now, no developer setup

Using multiple Sanity CMS instances in Gatsby project

17 replies
Last updated: Apr 18, 2022
hi I want to use 2 sanity CMS in one of my gatsby project, is it possible? When I configured 2 CMS in the source plugin, I got no error but the second one is not fetched. anyone tried tihs?
Apr 17, 2022, 5:16 PM
Do you mean 2 different datasets? Like one for development and one for production? Or do you want to pull in from 2 different datasets or projects at the same time?
Apr 17, 2022, 10:15 PM
not like development and production.
Apr 18, 2022, 5:18 AM
I want to pull in from 2 different projects at the same time
Apr 18, 2022, 5:19 AM
What's the use case for that? Pretty sure you'll need to do some setup yourself to fetch from two different projects at the same time.
Apr 18, 2022, 5:20 AM
Let's say I have 2 different editors editing their own content. I don't want any of them to mess around with the others content (this is exactly I want to do, but your question got me thinking that I might me doing something wrong from my design point.......)
Apr 18, 2022, 5:22 AM
It sounds like you're complicating that a lot. Would they never collaborate? Besides, if you set it up like 2 separate projects how do you decide which version to use?
Apr 18, 2022, 5:23 AM
Sanity has pretty good version history so if there's a clash the editors can fairly easily revert the wrong change.
Apr 18, 2022, 5:23 AM
2 different projects all different contents. like, 1 guy is creating songs the other one creating announcements
Apr 18, 2022, 5:24 AM
Another big downside to that is that you don't get the benefits of connected content. So the editor creating announcements can't link directly to songs.
Apr 18, 2022, 5:24 AM
I am trying to understand I am complicating my design. hmm...
Apr 18, 2022, 5:26 AM
thank you for the help ๐Ÿ™‚
Apr 18, 2022, 5:26 AM
user W
While the full user roles system is only for Enterprise plans still, I believe, even the free tier has access enough to basic user data in the studio to see who is doing what. If you combine that knowledge with the Desk Structure tool, you can make it so that the two different people can only see those document types you which for them to interact with. It's not like it's hidden with styles, either; they literally just don't exist to use for that person.

This article is an example of interacting with a user object and some reference material on the GROQ filtering of such a list.
Apr 18, 2022, 1:54 PM
Really great replies
user S
user S
, thank you!
Apr 18, 2022, 3:39 PM
user U
I used to have a snippet where I explored the showing/hiding, because the documentation at the time mentioned a means for access that was being deprecated and I didn't want to wire things up just to have it be phased out. My old messages are limited in their visibility to me, though, so I can't find it.

user M
has something similar I can still access: https://github.com/sanity-io/sanity-recipes/blob/main/snippets/deskStructureWithRoles.js#L11 and all I did was console.log the user object enough to see their e-mail / ID since I don't have any actual roles. Worked like a charm.
Apr 18, 2022, 4:09 PM
Racheal is pretty rad - Iโ€™m busting it to catch up to them
Apr 18, 2022, 4:40 PM
Thank you. Really appreciated
Apr 18, 2022, 5:34 PM
Iโ€™m going to check this off, but please follow up with how things turn out for you ๐Ÿ˜Š
Apr 18, 2022, 5:36 PM

Sanityโ€“ build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?