Katze is a Nuxt module that provides a headless CMS for your Nuxt app. Edit content directly in your Nuxt App, store your content in an Unstorage supported storage and deploy your content to the Edge or host it on your server.
Feel free to contribute to this project by creating a pull request.🐱❤️
- 📝 Edit content in your Nuxt app with /cms
- 🚀 Unstorage KV storage for edge deployment
- 🎨 Customisable content blocks (text, rich text, image)
- 📦 Easy to set up and use, just one configuration file
- Install using one of the following package managers:
- NPM:
npm install @maxlkate/cms
- Yarn:
yarn add @maxlkate/cms
- PNPM:
pnpm add @maxlkate/cms
- Bun:
bun install @maxlkate/cms
- NPM:
- Add
@maxlkatze/cms
to themodules
section ofnuxt.config.js
{
modules: [
'@maxlkatze/cms'
]
}
That's it! You can now use CmsKatze in your Nuxt app ✨
Following Route is now available in your Vue app:
'/cms/dashboard' - The CMS Dashboard
Every route in your Nuxt Router is displayed in the CMS editor
Simple text editing for headlines, paragraphs, and other text elements:
<template>
<KatzeText
id="hero_title"
element="h2"
class="text-4xl font-extrabold text-gray-900"
default-content="The future of content editing is here"
/>
</template>
Rich text editing with HTML support:
<template>
<KatzeRichText
id="example_rich_text"
default-content="<p>This is <strong>rich text</strong> that supports <em>formatting</em>, <u>underlining</u>, and even <a href='#'>links</a>!</p>"
class="prose max-w-none"
/>
</template>
Easy image management with on-the-fly replacements:
<template>
<KatzeImage
id="example_image"
default-src="/test.svg"
default-alt="Example image that can be replaced"
class="max-w-md rounded-lg shadow-md"
/>
</template>
In addition to the component approach, you can define editable items using composables within your Vue component.
The kat-e attribute is used to define the key of the editable element. The CMS editor uses this key to identify the element and display its correct position and type.
<script setup lang="ts">
const buttonText = useKatzeText({ key: 'buttonText', default: 'defaultValue' });
</script>
<template>
<button kat-e="buttonText">{{ buttonText }}</button>
</template>
<script setup lang="ts">
const richText = useKatzeRichText({ key: 'richText', default: 'defaultValue' });
</script>
<template>
<p
class="text-2xl min-size-5"
kat-e="richText"
>
<katze-rich-text :content="richText" />
</p>
</template>
The katze-rich-text component, unlike v-html, allows content to be rendered on the server and client at the same time. This is important for SEO and performance reasons.
<script setup lang="ts">
const image = useKatzeImage({ key: 'image' });
</script>
<template>
<img
kat-e="image"
class="size-52"
:src="image.src"
:alt="image.alt"
/>
</template>
You can configure Katze by adding the katze
key to nuxt.config.js
katze: {
// Configuration
users: [
{
name: 'your secret name', // default: "admin"
password: 'your secret password', // default: "admin"
},
],
secret: 'your secret key for token encryption',
projectLocation: './', // default: "./"
storage: {
type: 'fs', // default: "fs" | Unstorage Types supported
options: {
// UNSTORAGE OPTIONS
}
},
storageKey: 'storageKey', //default: "content.katze.json" | The key to store the content in the storage
deployHookURL: 'https://yourdeployhookurl.com' // default: ""
}
The default user is admin
with the password admin
.
The secret is used to encrypt the Login token for the CMS editor.
The project location is used to store the content.katze.json fileand to locate the public folder.
You can configure storage with unstorage drivers.
The key for the content value inside the storage. Can be left as default, when using storages with a base prefix.
- azure-app-configuration - Documentation
- cloudflare-kv-binding - Documentation
- fs - Documentation
- github - Documentation
- mongodb - Documentation
- netlify-blobs - Documentation
- planetscale - Documentation
- redis - Documentation
- vercel-kv - Documentation
- upstash - Documentation
Storage implementation example:
storage: {
type: 'fs',
options: {
base: './',
}
}
The deploy hook URL is used to trigger a deploy when publishing content. (Simple GET Request to the URL)
You can configure a cron job to run and keep the storage alive.
https://example.com/cms/api/lifecycle
- Clone this repository
- Install dependencies using
bun install
- Generate type stubs using
bun dev:prepare
- Develop with the playground using
bun dev
Local development
# Install dependencies
bun install
# Generate type stubs
bun run dev:prepare
# Develop with the playground
bun run dev
# Build the playground
bun run dev:build
# Run ESLint
bun run lint