Getting Started
Installation
Get started with Nuxt Directus by installing the dependency to your project.
Setup
- Install
nuxt-directus-nextdependency to your project:
pnpm i -D nuxt-directus-next
- Add it to your
modulessection in yournuxt.config:
nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-directus-next']
})
Project Url
The module is now installed, but you need to configure it to work with your Directus instance.
export default defineNuxtConfig({
modules: ['nuxt-directus-next'],
directus: {
url: 'https://directus.example.com',
}
})
DevTools
Before you can activate the Devtools, you have to update the Directus Security Options.
By default, it sets the Content Security Policy directive to frame-ancestors 'self'. Making it impossible to embed the admin on localhost.
To enable the embedding of the Directus Admin Dashboard, set the following environment/config variable:
.env
+ CONTENT_SECURITY_POLICY_DIRECTIVES__FRAME_ANCESTORS=array:http://localhost:*,self
Restart your Directus server and it should be ready to be embedded in the devtools.
Open your nuxt.config.ts and set the devtools option to true:
export default defineNuxtConfig({
modules: ['nuxt-directus-next'],
directus: {
moduleConfig: {
devtools: true
}
}
})
You should now see your Directus Admin Dashboard right into your Nuxt project by opening the devtools ✨