Skip to content
👀 See Sanity in action: Watch product demo now →
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
  • Enterprise SSO
EnterprisePricing
Contact salesLog inGet started
Published July 15th 2021

Announcing the Sanity Content Lake integration for Vercel

Now available on the Vercel Marketplace

Knut Melvær

Head of Developer Relations at Sanity.io

The Sanity Content Lake can be used as a real-time data backend for any application. Our new integration on the Vercel marketplace easily lets you connect your project to a new Sanity.io dataset to start storing, synchronizing, and querying data over our APIs. Find out later you needed a fully-fledged, yet friendly editing interface with version control and collaboration? Sure, just configure schemas and set up a Sanity Studio for your content team.

Not all projects start by defining an editing environment and elaborate content models. Sometimes you need some “JSON in the cloud”. Since Sanity.io offers a fully decoupled NoSQL document backend, you can use this integration to quickly get up and running and have an endpoint where you can store and retrieve content to your app. No need to set up schemas or anything else, just give your object a _type and add it to your Content Lake with an authenticated POST request to the mutation API, or by using one of Sanity's SDKs.

As your project evolves, and whenever the time is right, you can create a Studio and configure it to display the content types and fields that you want to be editable within it.

If you use Next.js deployed on Vercel, you can use API routes to handle form submissions or the like. This is what a minimal implementation can look like using the environment variables that are set up by the integration:

const sanityClient = require('@sanity/client');

const config = {
  projectId: process.env.SANITY_API_PROJECT_ID,
  dataset: process.env.SANITY_API_DATASET,
  token: process.env.SANITY_API_WRITE_TOKEN,
  useCdn: false,
  apiVersion: '2021-03-25'
};
/*
 * Shape of body:
 * { 
 *   "_type": "submission", 
 *	 "_id": "form.657cf48a-e824-4c8a-b474-6b63368a330f”, 
 *   "name": "Andy Bernard",
 *   "message": "This musical rocks!"
 *  }
 */
async function handleForm(req, res) {
  const payload = JSON.parse(req.body);
  try {
    const result = await sanityClient(config).create(payload);
    return res.status(200).send('ok');
  } catch (error) {
    return res.status(500)send('error');
  }
}

export default handleForm;

We hope that our integration can be useful and improve the developer experience for projects that combine Vercel and Sanity.io. As always, if you build with this stack, we'd love to learn all about it on sanity.io/projects and in our community on slack.sanity.io.

Platform

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

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
  • 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
  • Mobile apps CMS

Company

Contact SalesEnterpriseCareersTerms of ServiceAccessibility Statement

Stay connected

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