Skip to content
Sanity
Get started
  • Sanity Studio - Flexible editing environment
  • Content Lake - Real-time database
  • Developer experience - Tooling you love
  • Structured content - The philosophy behind Sanity
  • Review changes - View edits & rollback instantly
  • Image pipeline - On-demand transformations
  • E-commerce - Better shopping experiences
  • Marketing sites - Control your story
  • Products & services - Innovate and automate
  • Mobile apps - Content backend for every OS
  • Aether - Unique digital shopping experience
  • Morning Brew - Omnichannel media distribution
  • InVision - Delivering exceptional customer experiences
  • DataStax - Personalization for global audience
  • React
  • Gatsby
  • Next
  • Nuxt
  • Eleventy
  • Netlify
  • Vercel
  • Algolia
  • Documentation
  • Reference
  • Guides
  • Resource library
  • Headless CMS
  • Tools & plugins
  • Project showcase
  • Schemas & snippets
  • Agency partners
  • Technology partners
  • Get support
  • Share your work
  • 5 Disadvantages Of Wordpress That Are Holding You Back
EnterprisePricing
Contact salesLog inGet started
Published May 22nd 2018

Make a headless CMS eCommerce front-end for Vue.js, Nuxt.js and Snipcart

Headless CMS for eCommerce. A Vue.js front-end for the Sanity.io e-commerce schema powered by Snipcart.

Even Eidsten Westvang

Even is a Sanity.io co-founder and product person

We’ve been hearing so many nice things about Vue.js. So to get to know it better we though it would be good to build a more complete front-end for it.

Also, the same week Sanity launched the kind folks over at Snipcart built a demo using us as the content backend for a simple e-commerce app.

So we thought we should repay the favor and just a few days ago we added to our install a headless localized e-commerce example as one of the defaults we offer when you install Sanity. So we therefore thought we should, nay must, make an e-commerce front-end for Vue.js, Nuxt.js and Snipcart backed by Sanity.io that you can host as a statically generated build on Netlify.

A grid of tasty Japanese treats

Who is Sanity.io?

That's us. Sanity.io is a cloud hosted content store with a powerful graph oriented query language. The editing environment, somewhat generically named Sanity Studio, is an open source MIT licensed client side application that you can customize to your liking in JavaScript and React.js. Setup takes a two minutes. Give it a try.

What’s Vue.js anyway?

Vue.js is a flexible and lightweight library for building web interfaces with Javascript. Similarly to React.js it offers a virtual DOM and reactive components. Some people like it for it’s brevity. Our in-house designer, Kristoffer, likes the way the people behind it think – how it feels clear and natural and has affordances for the everyday needs of people who build web apps.

And what’s a Nuxt.js?

Inspired by Next.js, Nuxt is a framework for creating universal Vue.js applications. It ships with all the stuff you probably will want, preconfigured: routing, async data, middleware, layouts, etc.

Who is Snipcart?

Snipcart is a full featured, low-threshold shopping cart that lets you add e-commerce functionality to your website by including their javascript and a few data attributes to your pages. This is how we were all told the future would work.

Run it!

We’ve got a sliding scale of getting involved here.

  • Medium: Wander off and click at the example - we've hosted it on Netlify (see instruction below for building a static site). There's also Zeit now as well.
  • Large: Install the Vue.js front-end yourself, with our canned data. The readme has the instructions. Do make sure you have a recent Node installed and don’t change the port numbers as we’re picky about CORS origins.
  • Supersize me: Spend 5 minutes setting up Sanity to power it all with your own product data.

Yes, in five minutes you can add fields or get back at the vikings by removing Norwegian as an available language as well as build your own product database. With variants! Hierarchical categories! Vendors! Tags! Gah!

The readme for the project has the instructions for this as well. All four bullet points of it.

All batteries are included and instructions for deploying on Zeit's Now (type now) as well as Netlify. Fly little rocket ship, fly. 🚀

Check out the source code

We got carried away and added a barcode renderer to the editor, so you can uh, scan it

A tiny caveat or two

Yes, we didn’t implement totally ALL the things implied by the schema. We would maybe have said these were left as exercises to the reader if we weren't afraid of looking super obnoxious.

The localization is locked to English when it should perhaps be reading Accept-Language, yet again your implementation will vary on your hosting. Also: there aren't any product variants displayed. Maybe your store doesn't have any. Maybe the sweaters you're selling are all a tepid cyan. If they're not, we'll gladly accept a pull request for the display of variants!

Page content

  • Who is Sanity.io?
  • What’s Vue.js anyway?
  • And what’s a Nuxt.js?
  • Who is Snipcart?
  • Run it!
    • A tiny caveat or two

Platform

Structured ContentDeveloper experienceContent LakeSanity StudioSecurity & Compliance
  • Sanity vs Contentful
  • Sanity vs Strapi
  • Sanity vs Wordpress
  • Sanity vs Adobe Experience Manager
  • Sanity vs Hygraph
  • Sanity vs Sitecore
  • Sanity vs Storyblok
  • Sanity vs Contentstack
  • Sanity vs Prismic
  • Sanity vs Drupal
  • Sanity vs ButterCMS

Resources

Documentation
  • React Blog
  • Gatsby Blog
  • Next.js Landing Pages
  • Progressive Web Application
  • Single Page Application
  • Svelte & Typescript App
  • Vue & Tailwind Blog
  • Developer Portfolio Templates
  • Form validation with Yup
  • Live Preview with Next.js and Sanity.io
Resource library
  • Agency partners
  • Technology partners
  • Blog Template
  • Personal Website Template
  • Developer Portfolio Templates
  • All Templates
Case Studies
  • Headless CMS
  • What is an API CMS
  • Static Sites 101
  • Headless SEO
  • Localization
  • GraphQL vs REST
  • What is a DXP?
  • Typescript 101
  • Content as a Service
  • Ecommerce SEO
  • React CMS
  • Next.JS CMS
  • CMS for Shopify
  • Content platform
  • Multilingual CMS
  • Static Site CMS
  • Gatsby CMS
  • Node CMS
  • E-commerce CMS
  • Vue CMS
  • Angular CMS
  • GraphQL CMS
  • Newspaper CMS
  • Magazine CMS
  • CMS for apps
  • Remix CMS

Company

Contact SalesEnterpriseCareersTerms of ServiceAccessibility Statement

Stay connected

  • GitHub
  • Slack
  • Twitter
  • YouTube
  • Stack Overflow
  • Blog RSS
  • Newsletter
©Sanity 2023