Building with Sanity and Nuxt with Ekene Eze
Hello and welcome back. To set up a new sanity project first go to sanity dot io and click on. Get started.
Here you have a command that is already available for you. The first part of the command will install sanity globally for you. While the last part will create a new sanity application for you.
I already have sanity installed globally on my machine. So I'll just go ahead and run the last command to create a new Sanity project.
First I'll make a new directory.
And here I can run my sanity init command.
If you do not already have a sanity account. It will ask you to create a new account or to log into your existing account.
I already do have an account, so I can go ahead and create a new project. By selecting, create new projects and clicking enter. here, you can give your sanity project a name. I will call it sanity mission.
The output part is correct.
So these are existing sample schemas that sanity provides. If you do want to start with a blank schema, you have the option to do that.
But I'll go ahead and use the e-commerce sample schema. Just so that I have some sample data to work with for a start.
Yes, so that we can have some sample products in our schema to work with.
So our sanity. The application has been created successfully. What I want to do next is open it up in visual studio code and show you what the initial folder structure looks like.
I'm particularly interested in showing you two files. The sanity. Jason file. And the schemas folder. So open your top in videos. To your code.
So, if you look at the sanity mission, project. And checks on it. Jason file. Here. The data set is set according to our specification.
It can be called development or anything else you'd like to call your dataset. But in my case, I'll go ahead and use the production data set.
You also have the project ID which can help you connect your sanity application to a frontend as we'll do in the later stages of this mission. And the name of the project is sanity mission.
As we specified earlier
These are all default files that came with the e-commerce schema I will show you what they looked like in the sanity studio but in the meantime, just know that these are all just sample data that are created by default for us to work with.
So let's go ahead and look at sanity studio. run sanity start to start the sanity development server.
I'm in the wrong directory. I have to move into the project directory.
And now I can run sanity start Copy this to the browser.
Once again, I'll log in with the same account. I used to create the sanity application. So we have a functional sanity project.
It has a few contents by default based on the e-commerce schema we selected the first one is the product, that we need for our e-commerce application.
Here we have a search bar that allows you to search for any content in your production data set.
And here we have the vision tab. Which you can click to search for any product or run any queries in this dataset.
For instance, you can run queries to fetch all the products that are available in your project. And we can do that just by clicking the run query button
And with that, we've come to the end of this lesson about setting RP, sanity. Unity application and introducing you to sanity studio.
In the next lesson, we'll go ahead and discuss schemas in more detail and also show you how to create them. We'll also look at document types and how they work together in sanity.
See you there.