Nuxt 3 module for integrating Flyo Nitro CMS into a Nuxt application.
- Registers Flyo plugin (
@flyo/nitro-vue3) in your Nuxt app. - Auto-imports Flyo composables.
- Injects Flyo config into
runtimeConfig.public.flyo. - Optionally registers dynamic routes from Flyo config pages.
- Nuxt 3
- Node.js 18.12+ (Nuxt recommendation)
- A valid Flyo API token
npm install @flyo/nitro-nuxtAdd the module in your nuxt.config.ts (or nuxt.config.js):
export default defineNuxtConfig({
modules: [
['@flyo/nitro-nuxt', {
apiToken: process.env.FLYO_API_TOKEN
}]
]
})Set your environment variable:
FLYO_API_TOKEN=your-tokenImportant:
apiTokenis required. The module throws on startup if missing.
By default, registerPageRoutes is enabled and Flyo pages are registered dynamically.
The module currently imports this page component for those routes:
~/pages/cms.vue
Create pages/cms.vue in your Nuxt app if you keep dynamic route registration enabled.
If you do not want this behavior, disable it:
export default defineNuxtConfig({
modules: [
['@flyo/nitro-nuxt', {
apiToken: process.env.FLYO_API_TOKEN,
registerPageRoutes: false
}]
]
})All options are under module config key flyo.
apiToken: stringdefaultprocess.env.FLYO_API_TOKEN || ''apiBasePath: stringdefaultprocess.env.FLYO_API_BASE_PATH || ''liveEdit: boolean | stringdefaultprocess.env.FLYO_LIVE_EDIT || process.env.NODE_ENV !== 'production'liveEditOrigin: stringdefaultprocess.env.FLYO_LIVE_EDIT_ORIGIN || 'https://flyo.cloud'registerPageRoutes: booleandefaulttruedefaultPageRoute: stringdefault'cms'
FLYO_API_TOKENFLYO_API_BASE_PATHFLYO_LIVE_EDITFLYO_LIVE_EDIT_ORIGIN
This module auto-imports these composables:
useFlyoConfig()useFlyoCurrentPage()useFlyoEntity(uniqueId)useFlyoPage(slug)useFlyoSitemap()editable(block)— returnsdata-flyo-uidattribute for live-edit support
Example:
<script setup lang="ts">
const { response: page } = await useFlyoCurrentPage()
</script>
<template>
<pre>{{ page }}</pre>
</template>The module registers a global components directory at:
~/flyo
Place your Flyo block components there. Each component receives a block prop from the CMS.
When liveEdit is enabled (the default in non-production environments), the module automatically activates live-editing features — page reload on content changes, scroll-to-block, and hover-highlight with click-to-edit. No extra setup is needed in your layout or App.vue.
To make individual block components discoverable by the live editor, use the auto-imported editable helper to bind the block's data-flyo-uid attribute:
<script setup>
defineProps({ block: Object })
</script>
<template>
<section v-bind="editable(block)" class="bg-gray-200 p-8 rounded-lg text-center">
<h2 class="text-3xl font-bold mb-4">{{ block?.content?.title }}</h2>
<p class="text-lg mb-6">{{ block?.content?.teaser }}</p>
</section>
</template>editable(block) returns { 'data-flyo-uid': block.uid } when the block has a uid, or an empty object otherwise. This is safe to include unconditionally — it has no effect when live-edit is disabled.
Use these commands:
npm install
npm run test
npm run buildplayground/ is a local Nuxt app for manual module testing.
It depends on the local module via file:...
npm run playground:dev
npm run playground:build- CI runs tests and build checks.
- Publishing is handled by
semantic-releasein GitHub Actions. - Version bump is commit-message driven:
feat: ...-> minorfix: ...-> patchfeat!: ...orBREAKING CHANGE:-> major
If you want the next automated release to be 2.0.0, make sure a 1.0.0 git tag exists in the repository history.
git tag 1.0.0
git push origin 1.0.0Then merge a breaking-change commit, for example:
feat!: migrate module behavior for Nuxt 3.21
BREAKING CHANGE: dynamic cms route registration and runtime entrypoints changed.
Dry-run locally:
npm run release:dry-run