A New Stackbit Project

Welcome to your new project created with Stackbit!

Here are a few useful tips & links:

Set up

  1. If you haven't yet transferred this project to your GitHub account, click on the Gear icon in the visual editor to open Project Settings and start the transfer. Learn More.
  2. Once the repository is in your account, the Project Settings window will show you the commands to run for setting up your local environment. Learn More.

Develop with Stackbit Locally

To spin up local dev, run:

  1. In terminal 1:\

    1. git clone
    2. npm install
    3. Add the Contentful tokens to the .env file (see .env.example for reference)
    4. npm run dev
  2. In terminal 2:
    sudo npm i -g @stackbit/cli@latest

stackbit dev \
    -c contentful \
    --contentful-space-id <space_id> \
    --contentful-preview-token <preview_token> \
    --contentful-access-token <access_token>

Learn the basics

  1. It's a good idea to go through our Getting Started tutorial. It will give you a small taste of component development as well, and links for further reading.
  2. To go deeper into how things work, head to the Conceptual Guides.
  3. For more concise, practical information see the How-to Guides.

Get answers

Join us on Discord for community support.

Building for production 🏗

To build a static site for production, run the following command

npm run build

The generated site will be written to the out folder. The contents of this folder can be deployed by a serverless deployment platform such as Netlify. You can start a local server serving the static files from the out folder, for example, by installing and running http-server:

npm install http-server -g
http-server out

Contributing 🙏

To contribute to this theme, please follow the following steps:

  1. Clone this repository locally

  2. Create a new Space in Contentful

  3. Create new Contentful Personal Access Tokens here

  4. Install dependencies

    npm install
  5. Import the Contentful data stored in the contentful/export.json file to the new space by running the following command. Replace the <management_token> with your Personal Access Token and the <space_id> with the new space ID.

    ./contentful/import.js <management_token> <space_id>
  6. Create "Content Preview API - Access Token" for the new space via Contentful app "Settings" => "API Keys" => "Content delivery / preview tokens" => "Add API Key".

  7. Define the following environment variables to allow Next.js to fetch the content from Contentful when developing or building the site. Replace the {SPACE_ID} with your Space ID and the {CPA} with the new Content Preview API - Access Token.

    export CONTENTFUL_SPACE_ID={SPACE_ID}
    export CONTENTFUL_PREVIEW_TOKEN={CPA}
  8. Lastly, run the Next.js development server:

    npm run dev

    Navigate to http://localhost:3000 to see the site.

  9. Now you can update site code, and the content in Contentful. The browser will automatically live-update your changes.

  10. Once you finish updating the code and contents, export the contents back to the contentful/export.json file by running the following command. Replace the <management_token> with your Personal Access Token and the <space_id> with the new space ID.

    ./contentful/export.js <management_token> <space_id>
  11. Commit, push and submit a pull-request 🎉

Learn More 📚

To learn more about Stackbit, take a look at the following resources:

To learn more about Next.js, take a look at the following resources:

To learn more about Contentful, take a look at the following resources:

To learn more about Netlify, take a look at the following resources: