Nuxe eliminates manual router configuration by scanning yourDocumentation 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/pages/ directory at build and dev time. Every .vue file inside that directory becomes a route — the file’s path relative to app/pages/ maps directly to a URL segment. Add a file, get a route. Delete a file, the route is gone. No router file to maintain.
File-to-route mapping
The scanner converts each file path into a Vue Router route using simple rules: directory separators become/ segments, index.vue files strip the trailing /index from their path, square-bracket filenames become dynamic segments, and [...name].vue produces a catch-all.
| File | Route path |
|---|---|
pages/index.vue | / |
pages/about.vue | /about |
pages/admin/users.vue | /admin/users |
pages/[id].vue | /:id |
pages/[...slug].vue | /:slug(.*)* |
An
index.vue inside a subdirectory strips the /index suffix from the final route path. For example, pages/blog/index.vue produces /blog, not /blog/index.Declaring page metadata with definePage
Inside any page component you can call definePage to attach metadata — a layout name, route middleware, or custom meta fields. The macro is a no-op at runtime; Nuxe transforms it away at build time and hoists the options into the generated router config. definePage is auto-imported, so no import statement is needed in <script setup>.
pages/admin.vue
PageMeta type accepted by definePage is:
Route rules
routeRules inside definePage lets you control how the server handles each route without touching any server config. The options come from the RouteRules interface in the scanner:
Disable SSR for a single page
Setssr: false to render the page entirely in the browser (SPA mode for that route). The server still delivers a minimal HTML shell so the client JavaScript can boot.
pages/spa.vue
Prerender a page at build time
Setprerender: true and Nuxe will render the page during nuxe build and write the result to .output/public/ as a static HTML file.
pages/static.vue
Redirect from a route
redirect makes the server respond with a 302 to the given path whenever the route is requested.
pages/old.vue
Skipping a file with the _ prefix
Any .vue file whose name starts with _ is silently ignored by the scanner. Use this for shared fragments, page partials, or any component you store inside pages/ that should not become a route.
_ is not scanned.
Typed navigation
Nuxe generates atyped-router.d.ts file inside .nuxe/ at startup. This file teaches vue-router’s TypesConfig about every route name and its required params. Two composables are generated into .nuxe/composables/ and auto-imported so you can use them without any explicit import:
navigateTo(to, options?)— typed wrapper around the framework’snavigateTothat accepts either a route path literal or a named-location object with the correct params type.useNuxeRoute(name?)— typed wrapper arounduseRoute()that narrowsroute.paramsto the params of the named route.
pages/index.vue
navigateTo accepts an options bag as its second argument:
Aborting navigation in middleware
Inside a route middleware you can callabortNavigation to cancel the current navigation. It is auto-imported and accepts an optional error descriptor:
RouteNamedMap, RoutePaths, and NuxeRouteLocationRaw types are exported from .nuxe/typed-router.d.ts and are automatically available throughout your project via the .nuxe/auto-imports.d.ts ambient declarations.