Deploy Sanity and Sveltekit to Production

InstructorBen Patton

Share this video with your friends

Send Tweet

We are now ready to deploy. We can first deploy our CMS by running the command npm run deploy. Make sure you are in that project's terminal when you deploy.

Next we need to set up a github repository for our app. Then we can push our code to the repository.

Finally, we can go to Vercel. Create an account if you do not have one and link it to your github. If you are creating an account you will need to make sure that you give Vercel permission to read your repositories or a selected repository.

Then in your Vercel dashboard click 'New Project' and choose your newly created project for your SvelteKit blog.

Add your environment variables (you can copy and paste them)

Then deploy πŸŽ‰

After deployment go to the url it provides and now you have a deployed blog.

To make sure all works as expected go ahead and log in to Sanity. Choose your project. It will be named whatever name you gave it when creating your Sanity project. Then click "Open Sanity Studio".

Now navigate to Posts and click the create new post icon. Go ahead and create a second post. Click "Publish" and then navigate back to your posts page on your blog site and now we have posts uploading to our site as we write them.

Note: If you are already on the the /posts page on your blog site when you go back to it, you will need to refresh the page.