Skip to content

What is Nuxt Kirby?

Nuxt Kirby is a comprehensive Nuxt module that provides seamless integration with Kirby CMS. It offers multiple ways to fetch your content: use KQL (Kirby Query Language) for complex queries, or access the Kirby API directly for simpler data fetching. Your authentication credentials stay protected, and everything works on both server and client.

Two Ways to Fetch Data

Nuxt Kirby offers flexibility in how you access your Kirby content:

1. KQL (Kirby Query Language)

Perfect for complex content queries with relationships and filtering:

ts
const { data, error } = await useKql({
  query: 'site',
  select: ['title', 'children']
})

2. Direct Kirby API Access

Ideal for simple data fetching, file downloads, and custom endpoints:

ts
const { data, error } = await useKirbyData('api/pages/blog')

Both methods provide caching, error handling, and credential protection out of the box.

Kirby Headless Plugin

Setting up Kirby to support headless mode is a bit of a hassle. To make your life easier, you can use the Kirby Headless plugin. It provides a custom KQL endpoint with token-based authentication and other useful features. You do not have to use it, but it is the best way to use Kirby as a headless CMS and avoids common pitfalls like CORS issues. This Nuxt module is designed to work perfectly with it.

With the Kirby Headless plugin you are ready to go:

Next Steps

Released under the MIT License.