Skip to content
Sanity
    • Platform

      Sanity Studio

      Flexible editing environment

      APIs

      Connect to anything

      Content Lake

      Real-time database

      Try product demo

      Features

      Real-time collaboration

      Fearlessly work with content

      Precise content querying

      Treat content as data with GROQ

      Localization

      Coherent messaging across territories

    • Use cases

      E-commerce

      Richer shopping experiences

      Marketing sites

      Control your story

      Products & services

      Innovate and automate

      Mobile apps

      Content backend for every OS

      View all

      Integrations

      Shopify
      Mux
      Vercel
      Netlify
      Algolia
      Cloudinary
      BigCommerce
      Commerce Layer
      Smartling
      Transifex
      View all
    • Learn

      Documentation
      Studio API Reference
      API reference
      Guides
      GROQ cheat sheet
      Sanity UI
      Get started

      Build and share

      Templates
      Tools and plugins
      Schemas and snippets
      Project showcase
      Share your work
      Browse Exchange

      Frameworks

      React
      Vue
      Next.js
      Nuxt.js
      Svelte
      Remix
      Gatsby
      Astro
      Angular
      Eleventy
      View all
    • Discover

      Blog
      Resource library
      Agency partners
      Become a partner
      Technical support
      Talk to sales

      Case studies

      Puma

      Source of truth for global markets

      Aether

      Unique digital shopping experience

      Morning Brew

      Omnichannel media distribution

      InVision

      Delivering exceptional customer experiences

      View all

      Popular guides

      Headless CMS
      Structured content
      Content modeling
      Headless SEO
      Static websites
      View all
    • Enterprise
    • Pricing
    • Log in
    • Contact sales
    • Get started
Contact salesGet 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

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

Product

Sanity StudioAPIsContent LakeSecurity & 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

DocumentationBlogResource libraryCase Studies
  • React Blog
  • Gatsby Blog
  • Next.js Landing Pages
  • Making a PWA
  • Single Page Application
  • Svelte & Typescript App
  • Vue & Tailwind Blog
  • Developer Portfolio Templates
  • Form validation with Yup
  • Live Preview with Next.js and Sanity.io
  • Next.js blog
  • Next.js personal website
  • Clean Next.js + Sanity app
  • Clean Remix + Sanity app
  • Clean SvelteKit + Sanity app
  • All Templates
  • Agency partners
  • Technology partners
  • Headless CMS 101
  • Static Sites 101
  • Headless Commerce 101
  • CMS for enterprise
  • Headless SEO
  • Localization
  • Content as a Service
  • What is a DXP?
  • Typescript 101
  • Ecommerce SEO
  • What is a Composable DXP?
  • What is an API?
  • GraphQL vs REST
  • React CMS
  • Next.JS CMS
  • CMS for Shopify
  • API-first CMS
  • 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
  • Nuxt CMS
  • SvelteKit CMS
  • Agile CMS
  • Eleventy CMS

Company

Contact SalesEnterpriseCareersTerms of ServicePrivacy PolicyAccessibility Statement

Stay connected

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