JavaScript starter with Contentful

The Contentful JavaScript SDK offers a starting point for integrating Contentful with your website. It’s universal, simple to configure, and boasts an easy-to-use API. This means that they’re designed to work with a Node environment and in the web browsers.
JavaScript logo
What is JavaScript?
In the web development, HTML and CSS are used to structure and style web pages. JavaScript is the programming language that makes pages interactive on the client-side and server-side — it allows developers to build the front and back ends of a website.
1
Source the code and dependencies

JavaScript is a scripting language that allows you to add interactivity and handle DOM manipulation for your web applications.

Clone the repository.

Install node dependencies.

or

2
Set up the content model

This project comes with a Contentful set up command that imports the required content model and adds sample content to your space.

The command requires a Space ID, Content Management API access token, and Content Delivery API access token.

Run the following command to set up the content model.


3
Run the development server

Navigate to localhost:3000 to view the Cookbook app.

4
Push to GitHub

Create a new repository on GitHub, GitLab, or Bitbucket.

Commit the changes and push the code to the new repository.

Replace <REPO URL> with the git repository URL.


5
Create a Heroku account

Create an account on Heroku and install the Heroku CLI.

In the terminal, run the following command to login into your Heroku account:


6
Deploy to Heroku

To deploy to Heroku, click the “Deploy to Heroku” button in the README file or use the Heroku CLI.

If using the Heroku CLI to create a new project, execute the following command from the project directory "Heroku create."

To configure your Contentful Space ID and the Access Token, run the following command:

Once the environment variables are configured successfully, push the code to Heroku to start the deployment.


Get started with Contentful and JavaScript

JavaScript Logo and Contentful Logo within curly brackets

How to build a lightweight blog with vanilla HTML, CSS and JavaScript

An illustration of an emoji on a computer screen sending the viewer a kiss

Additional JavaScript example apps

Logo icons for JavaScript and Node.js inside curly brackets

Choose your technology path with our language and framework agnostic CMS

Bundle of technologies that can be used with Contentful.
Partner with us
Contact us
Structured Content
add-circle arrow-right remove style-two-pin-marker subtract-circle remove