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.
- New Storyblok space, set up with vercel deployments
- 10+ ready to use components with different presets(styles)
- New Vercel project, deployed and configured with your new Storyblok space
- Multiple ready pages in different styles
-
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,
node sb.mjs
- Follow the interactive prompts in the CLI tool to:
- Enter your Storyblok Personal Access Token
- Enter your Vercel Personal Auth Token
- Select your Vercel team
- Choose a project name
- Complete the space creation and configuration process
soon
- Monorepo using Turborepo
- Multiple CMS support
- New
/app
dir - Routing, layouts, nested layouts
- Data fetching, caching and revalidation
- Server and client components
- Reusable UI components built using Radix UI
- Styled using tailwind CSS
- Written in TypeScript
- Types and components generation
- CLI to create new set up project
- Themes using CSS variables
- Predefined structure
apps/storyblok
: CMS appapps/sanity
: CMS apppackages/ui
: UI components library, shared between both CMS appspackages/eslint-config
: sharedeslint
configurationspackages/ts-config
: sharedts-config
configurationpackages/tailwind-config
: sharedtailwind
configuration
- UI component - universal and sharable component between multiple CMSs
- Controller component - takes data from CMS, convert it to UI component format, and use UI component with converted props. Each CMS has it's own controller component for each UI component.
- All controller components have common propertiers to change style, such as margin, background, alignment etc.
The website structure follows a clear hierarchical composition:
-
Pages
- Top-level components that represent entire web pages
- Each page contains multiple sections, SEO properties and theme
-
Sections
- Container components that organize content into distinct areas
- Can be configured with settings like margin, background, width, alignment etc.
- Hold and arrange other components
-
Base Components
- Components like link, image, and rich text
- Combination of multiple functional components like card
- Can be combined and reused across different sections
RichText component has additional functionality. It allows to add sections inside, which gives ability to combine sections with text.
- Create new component using generators
pnpm gen
- Select type of component to create
- UI: Create a new UI component
- Storyblok: Create a new content section
- Sanity: Create a new content section
- Enter name of the component
- For Storyblok, add section component to the CMS
- Update properties and design
- Go to CMS folder
cd apps/storyblok
or
cd apps/sanity
- Generate types for added section
# For Storyblok you will additionally
# need to log into CLI
pnpm sb-login
pnpm gen:types
- Updata design
- Update fields
- Go to CMS folder
cd apps/storyblok
or
cd apps/sanity
- Generate types for updated section
pnpm gen:types
- Clone repository
git clone https://github.com/focusreactive/cms-kit
- Go to project directory
cd cms-kit
- Install dependencies
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
- Create a new repo based on cms-kit template
- Pull repo locally
- Install packages
pnpm install
- Go to CLI folder
cd apps/storyblok/cli
- Execute command
node sb.mjs
- Follow steps
Happy hacking 👾