Complete guide to using Dyrected in a Nuxt 3 application with SSR and composables.
The @dyrected/nuxt module provides first-class Nuxt 3 support: automatic server handler registration, SSR-aware composables, and live preview support.
Easiest path: paste the Dyrected setup prompt into an AI coding tool with access to your repo — it runs the CLI, models your content as collections and globals, and mounts the admin for you.
Setting up manually? The CLI is still the safest way to install — it detects your project layout, installs dependencies, writes the admin page, and patches nuxt.config.ts for you.
npx dyrected init
The steps below cover manual setup and all available options.
Use this if you are using Dyrected Cloud to host your backend.
// nuxt.config.tsexport default defineNuxtConfig({ modules: ["@dyrected/nuxt"], dyrected: { // These are optional if you have NUXT_PUBLIC_DYRECTED_* env vars defined! // apiKey: 'sk_live_...', // siteId: 'site_...', // baseUrl: 'https://api.dyrected.cloud', },});
Use this if you want to run the Dyrected engine directly inside your Nuxt app. We recommend defining your schema in a separate dyrected.config.ts file.
Every non-Nuxt-specific export (including <DyrectedImage>) is also available from @dyrected/vue — see the Vue integration for the full component reference.
useDyPath and <DyrectedBlocks> are auto-imported. Annotate fields so clicking them in the preview focuses the field in the Admin — <DyrectedBlocks> supplies each block's base path, so components only reference their own field names:
The Admin UI is a React-based dashboard. The @dyrected/nuxt module provides a <DyrectedAdmin /> component that handles all the React-to-Vue bridging, mounting, and routing isolation for you.
If you used npx dyrected init, this file is already created in the right place. The CLI detects whether your project uses an app/ directory (Nuxt's srcDir) and writes to the admin path you chose, defaulting to app/pages/admin/index.vue or pages/admin/index.vue.
For manual setup, create the file at pages/admin/index.vue (or app/pages/admin/index.vue if using srcDir):
No additional build.transpile or vite.optimizeDeps config is needed — the module handles all of that automatically.
If you are using Cloud mode and want to connect directly to the Cloud API from the browser (bypassing the proxy), you
can pass baseUrl, apiKey, and siteId props to <AdminUI /> .
The module automatically registers a server handler at /dyrected/[...route]. This proxies requests from your Nuxt frontend to your Dyrected backend, injecting the API key server-side so it is never exposed to the browser.
If you see errors like Unexpected "!" or Transform failed for files in @dyrected/admin, it usually means Vite is trying to parse the TypeScript code as plain JavaScript.
Solution: Ensure you have added @dyrected/admin to build.transpile in your nuxt.config.ts. If problems persist, you may need to force the tsx loader in your Vite config:
For self-hosted deployments embedded in Nuxt, we recommend using Hash Routing. This ensures that the Admin dashboard's internal navigation doesn't interfere with your Nuxt application's URL paths.
The <DyrectedAdmin /> component uses hash routing by default for internal navigation to ensure maximum compatibility.