We have put together this starter kit for future project developments using the following stack:
create-next-app
.You will need to have Node, NPM/Yarn, and Homebrew set up on your machine for local development. You will also need to have a Storyblok account and space set up to follow this instructions. These instructions are meant for Mac OS.
After cloning this repo into your project directory, run npm i
to install the required project dependencies
Make a copy of the .env.local.example
file as .env.local
and update the values in there.
Setup HTTPS for your localhost through local SSL proxy:
$ brew install mkcert
$ brew install nss
$ mkcert -install
$ mkcert localhost
$ npm install -g local-ssl-proxy
Start your local development server and SSL proxy in separate terminals
$ npm run dev
$ npm run local-ssl-proxy
Set up your preview URL by going to your Settings > Visual Editor
.
https://localhost:3010
Draft mode
, Location: https://localhost:3010/api/preview?secret=MY_SECRET_TOKEN&slug=
Replace
MY_SECRET_TOKEN
with the value you set forSTORYBLOK_PREVIEW_TOKEN
inside of your .env.local file.
Exit draft mode
, Location: https://localhost:3010/api/exit-preview?slug=
Your Storyblok space comes with a default homepage. To view the starter kit's homepage inside of the default home path, go to the homepage content and change the real path field to /
.
You have to look for the adjustment icon in the middle of the secondary navigation of the visual editor.
To view the sample data-fetching page that is included with this starter kit and the draft mode in action:
Storyblok sample page
. The slug must be storyblok-sample-page
. This matches the slug value inside of the code's getStaticProps
function.Draft mode
URL you have created earlier. This will set your editor in draft mode.Exit draft mode
from the Preview URLWord of Caution: If you were originally in draft mode and you choose any other preview URL aside from
Exit draft mode
you will still be in draft mode.
Styling in this starter project is done through CSS modules, and Tailwind utility classes.
We are solely relying on Tailwind as our preprocessor so can we get a fast compilation of our CSS without unused CSS using Tailwind's Just-In-Time engine. Also, we can't properly leverage Tailwind's functions in other preprocessors (e.g. theme()) if we use Tailwind as our source-of-truth when declaring theme values such as spacing, due to different compilation times.
For typography, fluid typography is set up and the Inter variable font is also loaded through @next/font package.
Portions of this starter project is based on Storyblok's excellent tutorial
As mentioned in the intro, this starter project was bootstrapped using Create Next App. To learn more about Next.js, take a look at the following resources: