Module Config
The module is highly flexible, and allows you to use the battery-included experience or to manage yourself the integration between nuxt and the directus SDK.
export default defineNuxtConfig({
modules: ['nuxt-directus-next'],
directus: {
url: 'https://directus.example.com',
}
})
Config in details
URL
FQDN of your directus instance.
Remember to specify the protocol: https:// or http://
Type: String
staticToken
Static token to be used for authentication with Directus.
Type: String
staticTokenServer
Static token to be used for authentication with Directus, but only available on Nuxt server side.
Type: String
authConfig
Configuration options for authentication.
This configurations are completly optional, and is adviced to keep the default settings.
authConfig.authStateName
The name for the Nuxt useState that handles authentication data such as access_token.
Type: String
Default: directus.auth
userStateName
The name for the Nuxt useState that handles user data once authenticated.
Type: String
Default: directus.user
useNuxtCookies
Handle auth cookies using Nuxt instead of Directus.
It's highly advised to keep the default option for safe SSR support and compatibility with any runtime.
Type: Boolean
Default: true
refreshTokenCookieName
Name of the refresh token cookie.
Type: String
Default: directus_refresh_token
cookieHttpOnly
Whether the cookie is HTTP-only.
Type: boolean | undefined
Default: false
cookieSameSite
The SameSite attribute for auth cookies.
Type: true | false | 'lax' | 'strict' | 'none' | undefined
Default: lax
cookieSecure
The Secure attribute for auth cookies.
Type: Boolean
Default: false
moduleConfig
Configuration options for the Nuxt-Directus module.
This configurations are completly optional, and is adviced to keep the default settings.
moduleConfig.devtools
Whether to enable devtools for the module.
This require extra setting on directus enviroment variable.
➡️ How to setup Directus devtools
Type: Boolean
Default: false
moduleConfig.autoRefresh
Whether to automatically refresh the Directus SDK.
Type: Boolean
Default: true
moduleConfig.autoImport
Whether to automatically import the Directus SDK.
By default, you will be able to access the module using the composable exposed by the module.
Type: Boolean
Default: false
moduleConfig.autoImportPrefix
Prefix for auto imported components from the Directus SDK.
Type: String
Default: sdk
moduleConfig.autoImportSuffix
Suffix for auto imported components from the Directus SDK.
Type: String