Skip to content

MKlblangenois/react-next-starter-storyblok

Repository files navigation

Next.js Storyblok Boilerplate

This repository is a Next Storyblok starter template used in following tutorial.

Requirements

To use this project you have to have a Storyblok account. If you don't have one yet you can register at Storyblok, it's free.

How to get started?

Read the Next.js tutorial about Storyblok's concept.

1. Get the source code.

  $ git clone https://github.com/storyblok/gatsby-storyblok-boilerplate.git

2. Install all dependecies

$  yarn # or npm install

3. Adding the Access token

Create a new empty Space and exchange the preview token with your own in utils/StoryblokService.js (not required if you have downloaded the project via app.storyblok.com).

// in utils/StoryblokService.js
class StoryblokService {
  constructor() {
    this.devMode = false // If true it always loads draft
    this.token = 'Your_Preview_Token_Here'
    this.client = new StoryblokClient({
      accessToken: this.token,
      cache: {
        clear: 'auto',
        type: 'memory'
      }
    })

4. Run your project

Set the preview domain in Storyblok to http://localhost:3000

# to run in developer mode
$ yarn dev # or npm run dev
# to build your project
$ yarn build # or npm run build

For detailed explanation on how things work, checkout the Next.js docs.


Powered by Storyblok