An endeavor accumulating the experience and best practices collected at Focus Reactive. The project serves the idea of making Headless CMS-based development accessible, comfortable, and fast.
Since application will be deployed to Vercel, make sure your Github account is linked to Vercel. You can do it here.
Create a new repository using this template by clicking the "Use this template" button at the top of the repository page.
Await the initial workflow to be finished
Clone your new repository:
git clone <your-repository-url>
Navigate to the project directory:
cd <repository-name>
Install dependencies using pnpm:
pnpm install
Navigate to the Storyblok CLI directory:
cd apps/storyblok/CLI
Run the setup script,
⚠️ command should be executed from apps/storyblok/CLI (previous step), to consume correct environment variables:
node sb.mjs
soon
/app
dirapps/storyblok
: CMS appapps/sanity
: CMS apppackages/ui
: UI components library, shared between both CMS appspackages/eslint-config
: shared eslint
configurationspackages/ts-config
: shared ts-config
configurationpackages/tailwind-config
: shared tailwind
configurationThe website structure follows a clear hierarchical composition:
Pages
Sections
Base Components
RichText component has additional functionality. It allows to add sections inside, which gives ability to combine sections with text.
pnpm gen
- UI: Create a new UI component
- Storyblok: Create a new content section
- Sanity: Create a new content section
cd apps/storyblok
or
cd apps/sanity
# For Storyblok you will additionally
# need to log into CLI
pnpm sb-login
pnpm gen:types
⚠️If you generating types for Storyblok, make sure you logged into CLI⚠️
cd apps/storyblok
or
cd apps/sanity
pnpm gen:types
git clone https://github.com/focusreactive/cms-kit
cd cms-kit
pnpm install
Create .env
and .env.local
files in the root of your project and add the following variables:
.env
REPO_PROD_BRANCH="main"
REPO_TYPE="github"
REPO_ID="[repo id]"
REPO_NAME="[nickname]/[repo name]"
.env.local
# Created by Vercel CLI
NEXT_PUBLIC_API_GATE="https://api.storyblok.com/v2/cdn"
NEXT_PUBLIC_DOMAIN="https://localhost:4050"
NEXT_PUBLIC_IS_PREVIEW="true"
NEXT_PUBLIC_SB_REGION="EU"
NEXT_PUBLIC_URL="https://localhost:4050"
SB_PREVIEW_TOKEN="[storyblok space preview token]"
SB_WEBHOOK_REVALIDATE_SECRET="[storyblok webhook revalidate key]"
.env
REPO_PROD_BRANCH="main"
REPO_TYPE="github"
REPO_ID="[repo id]"
REPO_NAME="[nickname]/[repo name]"
.env.local tbd
pnpm install
cd apps/storyblok/cli
node sb.mjs
Happy hacking 👾