Nuxe discovers your app’s pages, layouts, components, composables, middleware, and plugins by convention — it scans specific directories and wires everything together automatically. You do not need to configure entry points, import paths, or router files by hand. The directory tree below shows the full layout that Nuxe understands; every directory and file has a precise role, and onlyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dvlkit/nuxe/llms.txt
Use this file to discover all available pages before exploring further.
app/app.vue is strictly required to get a working app.
Directory tree
The
.nuxe/ directory is created automatically at build and dev time. It contains generated virtual modules, type declarations, and internal scaffolding. You should never edit files inside .nuxe/ — it is fully managed by the framework and is excluded from version control by the scaffolded .gitignore.Files and directories
app/app.vue
The root component of your application. It is the single entry point Nuxe renders on every request. At minimum it must include <RouterView /> so that the active page is displayed. In most apps it also contains site-wide navigation and wraps the view in <NuxeLayout> to enable layout switching:
app/app.vue
app/pages/
Every .vue file placed here becomes a route. The file path relative to app/pages/ maps directly to the URL:
| File | Route |
|---|---|
pages/index.vue | / |
pages/about.vue | /about |
pages/admin/users.vue | /admin/users |
app/layouts/
Layout components are shells that wrap page content. Each layout file must expose a <slot /> where the page will be rendered. Nuxe resolves the active layout at runtime based on the page’s meta.layout value:
app/layouts/default.vue
layouts/default.vue. The meta.layout name is case-insensitive — admin and Admin both resolve to layouts/admin.vue. Adding a new layout is as simple as creating a new file in this directory.
app/components/
Vue components in this directory are auto-imported across all templates and <script setup> blocks — no import statements required. Nuxe derives the component name from the file path relative to app/components/, joining folder segments with PascalCase:
| File | Auto-import name |
|---|---|
components/hello.vue | <Hello /> |
components/forms/input.vue | <FormsInput /> |
app/composables/
TypeScript or JavaScript files in this directory are auto-imported into every <script setup> block. A file that exports a default function named useCounter is available as useCounter() without any import. Named exports are also scanned and made available by their export name.
app/middleware/
Route middleware files export a handler created with defineNuxeRouteMiddleware (auto-imported). The filename controls when the middleware runs:
| Filename pattern | Behavior |
|---|---|
name.ts | Named middleware — must be opted into per page via definePage |
name.global.ts | Runs automatically on every navigation (client and server) |
name.server.global.ts | Runs automatically on every navigation during SSR only |
app/middleware/admin.ts
app/plugins/
Plugin files export a handler created with defineNuxePlugin (auto-imported). Plugins run before the Vue app is mounted and receive the NuxeApp instance, which exposes config (the resolved runtime config) and lifecycle hooks such as app:mounted.
The filename suffix controls the execution environment:
| Filename pattern | Runs on |
|---|---|
name.ts | Client and server |
name.client.ts | Client only |
name.server.ts | Server only |
app/plugins/hello.ts
app/error.vue
An optional custom error page rendered whenever Nuxe catches an unhandled error or a route throws a NuxeError. It receives an error prop typed as NuxeError (containing statusCode and statusMessage):
app/error.vue
server/api/
Files in this directory are compiled into server-side API route handlers. The filename encodes the HTTP method and the URL path:
| File | Endpoint |
|---|---|
server/api/ping.get.ts | GET /api/ping |
server/api/whoami.get.ts | GET /api/whoami |
h3 primitives imported from @dvlkit/nuxe/server:
server/api/ping.get.ts
/api and can be changed via server.apiPrefix in nuxe.config.ts.
nuxe.config.ts
The optional framework configuration file. Create it only when you need to deviate from defaults. It must use defineConfig imported from @dvlkit/nuxe (or @dvlkit/nuxe/config) to get full TypeScript type checking:
nuxe.config.ts
defineConfig({}) is perfectly valid and results in all defaults being applied.