Is a Sanity Dataset is like a Database or like a Table?

63 replies
Last updated: Apr 18, 2020
Can anyone explain me if a Dataset is like a database or like a table?
Apr 18, 2020, 6:50 AM
It’s like a database, that is a collection of documents of different types that can contain references to each other.
Apr 18, 2020, 6:51 AM
Apr 18, 2020, 6:52 AM
Oh, so it’s a NoSQL database?
Apr 18, 2020, 6:58 AM
May I know on which cloud are your services running?
Apr 18, 2020, 6:58 AM
Exactly! But with indexed and joinable relationships 🙂
Apr 18, 2020, 6:58 AM
It runs on Google Cloud Platform
Apr 18, 2020, 6:58 AM
Cool!
Apr 18, 2020, 6:58 AM
It's not firebase/firestore, but our own custom backend built with mature and “boring” database technologies.
Apr 18, 2020, 6:59 AM
I want to use this tool in my Development Agencies for those small projects that don’t require custom backend solutions, how many people are actively working in this? I’m comparing alternatives to Contentful
Apr 18, 2020, 7:01 AM
Working at Sanity the company, or with Sanity the solution?
Apr 18, 2020, 7:02 AM
Sanity directly in further develop this tool
Apr 18, 2020, 7:02 AM
We launched publicly in 2017, are currently 25 at the company, and rapidly growing. You can see some of our bigger clients here: https://www.sanity.io/solutions – if you need more references,
user H
is ready to give'em to you.
But I'm confident that you can safely use Sanity for those project. You get a lot of customization too.
Apr 18, 2020, 7:05 AM
What happens when I want to migrate to our own database?
Apr 18, 2020, 7:06 AM
Apr 18, 2020, 7:06 AM
If you want to migrate your content, it's
sanity dataset export <datasetnam>
in the CLI and you get all your documents including image and file binaries neatly packaged in a tar.gz file containing ndjson files
Apr 18, 2020, 7:07 AM
That sounds great
Apr 18, 2020, 7:07 AM
the whole point is that it should be easy to use your content where you need it, which implies it easy to migrate too. The only lock-in is the developer experience, whatever customization you need that relies on real-time features (that we are mostly alone in offering in the CMS space, as far as I know)
Apr 18, 2020, 7:08 AM
just to give you an idea of a dataset + export, here's the endpoint which streams your whole dataset (just public docs if not authenticated)
curl <https://cmghl2o6.api.sanity.io/v1/data/export/production>

Apr 18, 2020, 7:10 AM
Nice
Apr 18, 2020, 7:11 AM
Is there a good example about authentication ?
Apr 18, 2020, 7:11 AM
as you can see, there's some assets documents there too containing the metadata for images you have uploaded
Apr 18, 2020, 7:11 AM
If you use the JS client is mostly:
client.config({ token: process.env.READ_TOKEN })
or

client.config({ withCredentials: true})
if you want to do authed requests on behalf of logged-in users client-side
Apr 18, 2020, 7:13 AM
But how does the user “log in” or get the token?
Apr 18, 2020, 7:13 AM
You invite them to the project and we set a cookie with the auth token on it that's sent with requests against our APIs
Apr 18, 2020, 7:14 AM
the CMS/Sanity Studio is a React SPA which connects to these APIs
Apr 18, 2020, 7:14 AM
I mean, how does app user login or get the token? not the developer
Apr 18, 2020, 7:15 AM
Or all the web/app instances will use the same access token?
Apr 18, 2020, 7:16 AM
So, if you have invited an editor to the project, and they log in to the studio, they are authenticated on all API calls to that project in that browser.
Apr 18, 2020, 7:17 AM
Tokens you can create in settings and add to server environments etc
Apr 18, 2020, 7:17 AM
If you need SSO or third party login, there is that as well, but on the enterprise plan https://www.sanity.io/docs/third-party-login
Apr 18, 2020, 7:18 AM
No no, I mean my app user, in other words, when I publish the app to the stores or when I deploy the web, users will call the API, how will those users get the token?
Apr 18, 2020, 7:18 AM
As far as I understand I get a GraphQL API for my datasets right?
Apr 18, 2020, 7:19 AM
Aha, gotcha. Generally, you'll need to one of two things:
• Have the app request a proxy layer that has got a token with Read and/or Write rights
• Use our custom access control and SSO features in your authentication layer to set the session token in your app
Generally, most people use a public dataset, which means that you can request published documents without authentication (while drafts will still only be visible for logged-in users)
Apr 18, 2020, 7:21 AM
You can deploy a GraphQL API (or several actually using the tag-feature), there is also a dedicated query language for JSON documents called GROQ https://www.sanity.io/docs/how-queries-work
Apr 18, 2020, 7:22 AM
Alright, if I want to have a custom domain name will I have to do the proxy layer too? Or Sanity provides that functionality?
Apr 18, 2020, 7:23 AM
We offer custom domain name (CNAME) on enterprise
Apr 18, 2020, 7:24 AM
But that would still have the sanity.io domain right?
Apr 18, 2020, 7:25 AM
nope, then instead of doing requests to
https://&lt;projectId&gt;.<http://api.sanity.io/v1/data/query/|api.sanity.io/v1/data/query/>&lt;dataset&gt;?query=*
it would be

<https://api.yourdomain.com/v1/data/query/>&lt;dataset&gt;?query=*
(or another subdomain)
Apr 18, 2020, 7:26 AM
What’s the starting price for Enterprise
Apr 18, 2020, 7:27 AM
I'm not actually sure atm 😄 But
user H
will probably DM you when he's up and about 👍
Apr 18, 2020, 7:28 AM
Nevermind, already checked the Advanced plan, which means that the enterprise is above 199/month
Apr 18, 2020, 7:28 AM
Correct
Apr 18, 2020, 7:29 AM
One last question
Apr 18, 2020, 7:29 AM
If I want to offer this option to my agency customers, am I able to resell the service as a managed service by my agency at my own fees?
Apr 18, 2020, 7:30 AM
That is a conversation you'll also have to have with Jacob (Head of Business Development) 🙂
Apr 18, 2020, 7:31 AM
Alright
Apr 18, 2020, 7:31 AM
Thanks
user Y
I guess I’ll get contacted by Jacob right?
Apr 18, 2020, 7:34 AM
Oh, almost forgot, am I able to deploy the Admin dashboard to a custom hosting?
Apr 18, 2020, 7:35 AM
You are! It’s a react SPA so you can even deploy more of them with different configs on the same project :)
Apr 18, 2020, 7:38 AM
So that my customers can edit content from that app deployed on custom hosting?
Apr 18, 2020, 7:39 AM
Yup
Apr 18, 2020, 7:59 AM
I’ll explore this product further, so far it seems promising, my only concern would be that the UI doesn’t seem to bee as elegant as the other solutions (GraphCMS, Contentful, DatoCMS), but I believe that’s something that can be improved very quickly
Apr 18, 2020, 8:03 AM
Aight! fwiw There's an UI overhaul on the roadmap. And you'll quickly notice that you'll be able to express far more advanced content models with it compared to those others. Feel free to ask people here for their experiences compared to other platform in help as well!
Apr 18, 2020, 8:04 AM
Nice to know!, if I may suggest, you should have a public roadmap if you don’t have one, and also, take in count that some admin dashboards require very custom setups, it would be nice if you come up with a trendy micro-frontend compatible update so that we can re-use things already built in Angular or Vue to extend the project
Apr 18, 2020, 8:08 AM
Yeah, we have consciously chosen not to have a public roadmap, because we need to be able to shift course to do new features properly. That being said, you can get a sense of what's going on if you lurk in our PRs and branches here: https://github.com/sanity-io/sanity
I believe we'll stick with giving you customization of Sanity Studio with React for now, but there is libraries like
https://github.com/danielroe/vue-sanity and you'll also have access to the full mutation and patch API if you want to make your own forms to the backend.
Apr 18, 2020, 8:12 AM
The studio contains a lot of APIs and extension points to do custom stuff, from having your own asset selectors to custom publish actions for documents and so on
Apr 18, 2020, 8:13 AM
And if you have specific questions, we're always willing to talk btw
Apr 18, 2020, 8:13 AM
Thanks!
Apr 18, 2020, 8:14 AM
I gotta sleep (2am local time), but before I go, does sanity support localization?
Apr 18, 2020, 8:16 AM
Not just for the content, but for the studio too
Apr 18, 2020, 8:17 AM
Full i18n support for the studio is also on the roadmap, that being said, there isn't a lot of UI that isn't already defined by your schemas.
Apr 18, 2020, 8:17 AM
Nice
Apr 18, 2020, 8:18 AM
Hey Jonathan! Sent you PM now. Happy to help!
Apr 18, 2020, 8:27 PM

Sanity.io – build remarkable experiences at scale

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