This is a sample project showing how to modify content that is stored within Storyblok
The project is built with Node.js which serves the backend environments. And Storyblok space is used for storing the stories. In this project, I used Storyblok's API to create a webapp that searches and replaces a string in all stories and publishes the changes in a Storyblok space.
You can search and replace strings in a story by adding the strings in an input field and submitting with the submit button, the changes will be published on Storyblok space and on the frontend for the user.
- Create a Storyblok space (here) ensure that the space has content loaded on it.
- Node.js installed on your machine
- Storyblok Account
git clone https://github.com/iamfortune/storyblok-search-and-replace-app.git
The dependencies are in the package.json
file. After cloning, run the following command to install the dependencies:
cd storyblok-search-and-replace-app
npm install
In the .env.local.example
, you can find the environment variables needed for the project. They are:
AUTH_TOKEN=
PREVIEW_TOKEN=
Copy all of these environment variables to .env
and replace the values with your own.
- You can get the
AUTH_TOKEN
andPREVIEW_TOKEN
from the Storyblok User Account Dashboard
npm start
The src/client
directory contains the user interface which can be accessed on localhost:5001/
The src/server
directory contains the API endpoints which can also be accessed on localhost:5001/api
.
And the application can be run on localhost:5001
.
When you open your Storyblok space to view the stories, the space will have your Home
and About
pages. You can click on either page and populate the page with data. You can also go ahead and populate the other pages with more data.
You can deploy the application to Heroku. For your Storyblok stories, you can create a space on Storyblok. From Storyblok, you can get your auth tokens and use that in your environment variable.
This project is licensed under the MIT License - see the LICENSE.md file for more information.