Skip to main content

Overview

This integration guide shows you how to how to update your existing project to:
  1. install the ButterCMS package
  2. instantiate ButterCMS
  3. create components to fetch and display each of the three ButterCMS content types: Pages, Collections, and Blog Posts.
In order for the snippets to work, you’ll need to setup your dashboard content schemas inside of ButterCMS first.

Starter project

Or, you can jump directly to the starter project below, which will allow you to clone, install, run, and deploy a fully working starter project that’s integrated with content already inside of your ButterCMS account.

Node.js Starter Project

Hit the ground running with a pre-configured Node.js + ButterCMS setup.

Installation

Set your API token as an environment variable:

Initialize the client

For complete SDK documentation including all available methods and configuration options, see the JavaScript SDK Reference.

Pages

Collections

Dynamic components

Component Renderer

Example Component

Using in Pages

This example fetches a component_page whose body is a Page Builder field (an array of components). A WYSIWYG page type like landing_page would return a body string instead, which the component renderer can’t iterate over.

Blog

Preview Mode

Caching

Webhook cache invalidation

SEO

HTTP server example

Resources

Node.js Starter

Pre-configured starter project

JavaScript SDK

Complete SDK reference

Express.js Guide

Express.js integration

Webhooks

Set up content webhooks