[!TIP]
If internationalization is not a requirement for your project, you can check out the 🧱 branch without Nuxt i18n.
If this is your first time building an application with Nuxt, I recommend taking a look at the 💚 Kirby Nuxt Starterkit first to get a basic understanding of this tech stack. It is a Nuxt and KQL port of the Kirby starter kit.
This repository is a minimal but feature-rich Nuxt starter kit. It is the evolved version of the Kirby Nuxt Starterkit and my best practice solution to build a Nuxt based frontend on top of a headless Kirby CMS. The 🍫 Cacao Kit backend is the counterpart to this frontend.
Key Features
[!NOTE]
If i18n is not a requirement for your project, you can check out the 🧱 branch without i18n.
A block-first approach is one of the core design decisions for this Nuxt template. This means that you can use Kirby’s page structure as the source of truth, without having to replicate it in Nuxt. All pages are rendered by the catch-all route. However, you are not obliged to stick with the block-first architecture.
If you find it unsuitable or if you require custom Kirby page blueprints with custom fields, you can always create Nuxt pages and query the content using KQL. See the pages/about.vue page for an example.
# Base URL of the Kirby backend
KIRBY_BASE_URL=
# Token for bearer authentication
# See https://github.com/johannschopplich/cacao-kit-backend#bearer-token
KIRBY_API_TOKEN=
The kit includes full i18n support with @nuxtjs/i18n.
Custom Styling
This kit uses semantic HTML with minimal styling via new.css for demonstration. To implement your own styling, remove the import in app.vue and add your custom styles.
Deployment
Static Site Generation
For maximum performance and CDN compatibility, generate a static site:
pnpm run generate
This creates a fully static version in the dist/ directory that can be hosted on any static hosting service.
Server-Side Rendering
Deploy with full SSR capabilities:
pnpm run build
Environment Configuration
Ensure these environment variables are set in production:
# Required: Your Kirby backend URL
KIRBY_BASE_URL=https://your-kirby-backend.com
# Required: Authentication token for KQL queries
KIRBY_API_TOKEN=your-secret-token
# Optional: Public site URL for SEO and social sharing
NUXT_PUBLIC_SITE_URL=https://your-frontend.com
Cacao Kit (Frontend)
This repository is a minimal but feature-rich Nuxt starter kit. It is the evolved version of the Kirby Nuxt Starterkit and my best practice solution to build a Nuxt based frontend on top of a headless Kirby CMS. The 🍫 Cacao Kit backend is the counterpart to this frontend.
Key Features
@nuxtjs/i18nnuxt-kirby$siteA block-first approach is one of the core design decisions for this Nuxt template. This means that you can use Kirby’s page structure as the source of truth, without having to replicate it in Nuxt. All pages are rendered by the catch-all route. However, you are not obliged to stick with the block-first architecture.
If you find it unsuitable or if you require custom Kirby page blueprints with custom fields, you can always create Nuxt pages and query the content using KQL. See the
pages/about.vuepage for an example.Usage
Prerequisites
corepack enablepnpm installDevelopment
pnpm run devProduction
Build the application for production with
pnpm run build.Check out the deployment documentation.
Architecture & Development
Project Structure
The Cacao Kit follows a clear architectural pattern designed around its block-first approach:
Block-First Architecture
Every page is rendered through the catch-all route
[...slug].vue, which dynamically renders either:KirbyLayoutsKirbyBlocksAdding New Blocks
app/components/Kirby/Block/:app/components/Kirby/Blocks.vue:Working with KQL Queries
Define reusable queries in the
queries/directory:Use them in components:
Internationalization
The kit includes full i18n support with
@nuxtjs/i18n.Custom Styling
This kit uses semantic HTML with minimal styling via new.css for demonstration. To implement your own styling, remove the import in
app.vueand add your custom styles.Deployment
Static Site Generation
For maximum performance and CDN compatibility, generate a static site:
This creates a fully static version in the
dist/directory that can be hosted on any static hosting service.Server-Side Rendering
Deploy with full SSR capabilities:
Environment Configuration
Ensure these environment variables are set in production:
Preview
What’s Kirby?
License
MIT License © 2023-PRESENT Johann Schopplich