Nuxt 05 ๐ Layouts, Middleware & Plugins โ Structuring shared UIs with app/layouts/, guarding routes, and extending the app lifecycle
As a Nuxt application grows, three concerns appear almost immediately: the same navigation shell needs to wrap multiple pages without repeating markup, certain routes must be gated behind authentication or feature flags, and the framework needs to be extended with behavior that runs once at startup rather than per-component. Nuxt answers these three concerns with three distinct, purpose-built systemsโlayouts, middleware, and pluginsโeach living in its own directory under app/ and each running at a different point in the application lifecycle.
Layouts solve the “repeated shell” problem. Instead of copying a header and sidebar into every page, a layout defines them once and wraps the page content with the <slot /> component. The page itself only declares which layout it wants. Nuxt ships with a default layout and lets you define as many named layouts as you need, switching per-page or even per-route with <NuxtLayout>.
Middleware solves the “guard” problem. Route middleware runs before a navigation resolves, which is the only place where you can inspect the destination, check authentication state, and redirect before the guarded page ever renders. Nuxt supports three flavorsโanonymous inline middleware, named file-based middleware, and global middlewareโeach with distinct scoping rules that determine whether they run on every route or only on routes that opt in.
Plugins solve the “one-time setup” problem. Most third-party libraries need their configuration, prototype augmentation, or provider tree built once, before any page mounts. Plugins run during the application’s boot phase, can be restricted to the client or the server, and can inject dependencies into the entire app through provide. They are the canonical way to wire libraries like an analytics SDK, an i18n engine, or a Vue plugin into a Nuxt application.
This chapter walks through all three systems. It examines the file layout that drives each, the lifecycle order in which they execute, the security boundaries that separate the server from the client, and the patterns that keep each system maintainable. By the end, you will be able to build a full navigation shell with named layouts, gate a dashboard behind authentication middleware, and extend the app with a plugin that injects a typed helper into every component.
Key point: Layouts wrap pages with a reusable <slot /> shell, middleware runs before navigation resolves to guard or transform routes, and plugins execute once during app boot to wire global libraries into the appโeach system lives in its own app/ subdirectory and fires at a different point in the Nuxt lifecycle.
Why exists
The “Repeated Shell” problem.
Most applications share a header, a footer, a sidebar, or an auth-aware navigation bar across dozens of pages. Copying that markup into every page is a maintenance nightmareโchange one nav item and you must touch every file. Layouts exist to hoist the shell into a single component, wrap page content via <slot />, and let pages declare which layout they belong to with one line. The layout becomes the only place the shell is maintained.
The “Premature Render” problem.
An unauthenticated user who navigates to /dashboard should never see the dashboard flash before being redirected to login. Guarding inside the page’s onMounted hook is too lateโthe page has already started rendering on the client. Route middleware exists specifically because it runs before the navigation resolves, giving you a place to inspect the destination and issue a redirect before the protected component is ever instantiated.
The “Global Singleton” problem.
Libraries like analytics SDKs, Stripe, Sentry, or an i18n engine need to be initialized exactly once for the lifetime of the app, not once per component. Instantiating them in each page is wasteful and can cause duplicate connections, duplicate error reports, or conflicting global state. Plugins run during app bootโbefore any page mountsโso they are the correct place to build that singleton and expose it to the whole app.
The “Environment Split” problem.
Some plugins only make sense in the browser (a canvas renderer, a localStorage reader, an IntersectionObserver wrapper), and some only make sense on the server (a database client, a server-only task queue). A single “plugin” file that runs in both environments would fail in one of them. Nuxt exists to lexically distinguish these cases with .client and .server file suffixes, ensuring client-only code never reaches the server bundle and server-only code never reaches the browser bundle.
The “Dependency Injection” problem.
Once a plugin has built its singleton (say, an $echo WebSocket client or a $db Prisma client), every component that needs it must be able to reach it without a manual import. Nuxt provides provide inside a plugin and useNuxtApp() inside a component, forming a typed dependency-injection channel that survives SSR hydration and keeps imports clean.
The “Execution Order” problem.
Middleware, plugins, layouts, and pages all run during a single navigation, and the order in which they fire determines what state is available to them. Getting the order wrongโreading a plugin-provided value in middleware before the plugin has run, for exampleโproduces confusing runtime errors. Nuxt’s lifecycle exists because it formalizes that exact order so that state is available precisely when it is needed.
a. Layouts โ Shared UI Shells with <slot />
A layout is a Vue component that wraps page content through the <slot /> element. Every Nuxt project can have any number of layouts inside app/layouts/, and the framework exposes one special layout called default.vue that is used when no layout is otherwise specified. A page selects a layout either by declaring it with definePageMeta({ layout: 'name' }) or by rendering <NuxtLayout name="name"> in its template.
<!-- app/layouts/default.vue -->
<template>
<div class="app-shell">
<header>
<h1>My App</h1>
<nav>
<NuxtLink to="/">Home</NuxtLink>
<NuxtLink to="/dashboard">Dashboard</NuxtLink>
</nav>
</header>
<main>
<!-- Each page's content renders here -->
<slot />
</main>
<footer>ยฉ 2025</footer>
</div>
</template>
The <slot /> is the injection point: whatever a page renders goes there, and everything else in the layout (the <header>, <main> wrapper, the <footer>) wraps it. Because the layout is a full Vue component, it can hold its own reactive state, computed properties, and lifecycle hooksโuseful for shell behavior like a mobile drawer that closes on route change.
Named layouts live alongside default.vue in the same directory and are selected with definePageMeta. A common pattern is an admin.vue layout with a distinct sidebar that is only used by admin-scoped pages.
<!-- app/layouts/admin.vue -->
<script setup>
const route = useRoute();
const navItems = ['Users', 'Roles', 'Billing'];
</script>
<template>
<div class="admin-shell">
<aside>
<NuxtLink v-for="item in navItems" :key="item" :to="`/admin/${item.toLowerCase()}`">
{{ item }}
</NuxtLink>
</aside>
<section class="admin-content">
<slot />
</section>
</div>
</template>
Choosing a layout is done per page with definePageMeta. The layout name must match the filename without the .vue extension, and Nuxt validates it at build time when typed routing is enabled.
<!-- app/pages/admin/users.vue -->
<script setup>
// Selects app/layouts/admin.vue for this page
definePageMeta({
layout: 'admin',
});
</script>
<template>
<h2>Users</h2>
<p>Admin user management.</p>
</template>
For dynamic layout switchingโsuch as when a user navigates from a marketing page into the dashboard without a full reloadโyou can bind the layout imperatively with <NuxtLayout :name="dynamicLayout">. Because layouts are not re-rendered on navigation by default, use the name bind if the layout depends on route state, or set the layout on the layout component itself with a computed value.
b. Middleware โ Guarding Routes Before They Render
Middleware is a function that runs before a route is resolved. Its purpose is to inspect the incoming route (to) and, if necessary, redirect or abort the navigation. Nuxt supports three flavors: anonymous middleware defined inline within definePageMeta, named middleware stored in app/middleware/, and global middleware suffixed with .global.ts that runs on every route.
// app/middleware/auth.ts
export default defineNuxtRouteMiddleware((to, from) => {
// Runs only on pages that opt in via definePageMeta
const user = useAuthUser();
if (!user.value) {
// Redirect to login, preserving the intended destination
return navigateTo(`/login?redirect=${to.fullPath}`);
}
});
The callback receives to and from as route objects with full path, params, query, and matched records. Because it is a middleware function, navigateTo and abortNavigation are available without importโthey are auto-imported alongside the composables that must be available at this stage. A redirect is expressed by returning navigateTo(...); a hard stop with an error is expressed by returning abortNavigation(...).
Wiring middleware to a page is done through definePageMeta. The same page can declare multiple middleware, which run in array order.
<!-- app/pages/dashboard.vue -->
<script setup>
definePageMeta({
middleware: ['auth'], // Named middleware from app/middleware/
});
// Inline anonymous middleware is also allowed:
// definePageMeta({ middleware: ['auth', (to) => { /* ... */ }] })
</script>
<template>
<h2>Dashboard</h2>
</template>
Global middleware, by contrast, runs on every navigation regardless of page. It is reserved for concerns that truly apply everywhereโlogging, locale detection, feature flags, or a theme guard. Naming the file with the .global.ts suffix is not optional; without it, the middleware behaves as named only.
// app/middleware/locale.global.ts
export default defineNuxtRouteMiddleware((to) => {
// Runs on every route because of the .global suffix
const locale = useCookie('locale', { default: () => 'en' });
if (!to.path.startsWith(`/${locale.value}`) && to.path !== '/') {
return navigateTo(`/${locale.value}${to.path}`);
}
});
Two important details on middleware behavior. On the server, middleware runs on the initial SSR request and has access to useCookie, useRequestHeaders, and other server-only composablesโmaking it the correct place to check auth tokens before rendering. On the client, middleware runs on every subsequent navigation. Use import.meta.server or import.meta.client if a branch must run only in one environment. Also, useState is the shared-state mechanism that persists across middleware and page components during SSR, so any value you compute in middleware should be stored in useState if the page needs it.
c. Plugins โ Extending the App at Boot
A plugin is a module that runs once when the Nuxt app is created, before the first page renders. Plugins live in app/plugins/ and are auto-registeredโno manual import is required. The .client.ts and .server.ts suffixes restrict a plugin to a single environment, while a plain .ts file runs in both.
// app/plugins/hello.ts
export default defineNuxtPlugin((nuxtApp) => {
// Runs once during app boot, in both environments
console.log('Plugin executed');
// nuxtApp is the shared context available to every hook
});
The nuxtApp object is the plugin’s interface to the framework. It exposes provide, hook, vueApp, and the shared state. The canonical way to expose functionality to components is via provide, which becomes available through useNuxtApp().
// app/plugins/api.ts
export default defineNuxtPlugin(() => {
// Build a singleton client that lives for the app's lifetime
const apiClient = {
get: (url: string) => $fetch(url),
post: (url: string, body: unknown) => $fetch(url, { method: 'POST', body }),
};
return {
// Injected as $api on useNuxtApp() and useNuxtApp().$api
provide: { api: apiClient },
};
});
The keys returned from provide are exposed as $-prefixed properties on the Nuxt app. In a component, useNuxtApp().$api returns the client, and <template> can access it as $api if it is also exposed via app config or globally. Because plugins run before pages, the injected value is guaranteed to exist by the time any component mounts.
<!-- app/pages/index.vue -->
<script setup>
const { $api } = useNuxtApp();
const data = ref(null);
onMounted(async () => {
data.value = await $api.get('/api/posts');
});
</script>
Environment-restricted plugins are separated by suffix. A .client.ts plugin runs only in the browserโthe correct home for wrapping localStorage, IntersectionObserver, or a canvas renderer. A .server.ts plugin runs only on the Nitro sideโthe correct home for a server-only database client, an encryption helper, or a server-side logger.
// app/plugins/analytics.client.ts
export default defineNuxtPlugin(() => {
// Safe to touch `window` here; runs only in the browser
const track = (event: string, payload: Record<string, unknown>) => {
(window as any).dataLayer?.push({ event, ...payload });
};
return { provide: { track } };
});
Plugins can also hook into the Nuxt lifecycle. The nuxtApp.hook() API exposes hooks like app:created, app:beforeMount, app:mounted, and page:finish, which are all the extension points a global concern like a router analytics integration needs.
// app/plugins/router-tracker.ts
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('page:finish', () => {
// Fires after every page navigation completes
console.log('Navigated to:', useRoute().fullPath);
});
});
Plugin ordering is controlled by the file-name prefix. 01.foo.ts runs before 02.bar.ts, which is how you ensure an analytics plugin that depends on a session plugin runs after the session is built. The prefixes are numerical, not alphabetic, and stable.
Complete Example Session
<!-- ============================================ -->
<!-- PART 1: THE DEFAULT LAYOUT -->
<!-- ============================================ -->
<!-- app/layouts/default.vue -->
<template>
<div class="shell">
<header>
<NuxtLink to="/">Home</NuxtLink>
<NuxtLink to="/dashboard">Dashboard</NuxtLink>
</header>
<main><slot /></main>
</div>
</template>
<!-- ============================================ -->
<!-- PART 2: A NAMED ADMIN LAYOUT -->
<!-- ============================================ -->
<!-- app/layouts/admin.vue -->
<script setup>
// Layout-local reactive state for the sidebar collapse
const collapsed = ref(false);
</script>
<template>
<div class="admin-grid" :data-collapsed="collapsed">
<aside>
<button @click="collapsed = !collapsed">โฐ</button>
<NuxtLink to="/admin/users">Users</NuxtLink>
</aside>
<section><slot /></section>
</div>
</template>
<!-- ============================================ -->
<!-- PART 3: CHOOSING A LAYOUT -->
<!-- ============================================ -->
<!-- app/pages/admin/users.vue -->
<script setup>
definePageMeta({ layout: 'admin', middleware: ['auth'] });
</script>
<template><h2>Users</h2></template>
// ============================================
// PART 4: A NAMED AUTH MIDDLEWARE
// ============================================
// app/middleware/auth.ts
export default defineNuxtRouteMiddleware((to) => {
const user = useState<{ id: string } | null>('user', () => null);
if (!user.value) {
return navigateTo(`/login?redirect=${to.fullPath}`);
}
});
// ============================================
// PART 5: A GLOBAL MIDDLEWARE
// ============================================
// app/middleware/feature-flag.global.ts
export default defineNuxtRouteMiddleware((to) => {
const flags = useState('flags', () => ({ beta: false }));
if (to.path.startsWith('/beta') && !flags.value.beta) {
return abortNavigation('Feature disabled');
}
});
// ============================================
// PART 6: A UNIVSERSAL PLUGIN
// ============================================
// app/plugins/session.ts
export default defineNuxtPlugin((nuxtApp) => {
const session = { user: null as { id: string } | null };
nuxtApp.provide('session', session);
});
// ============================================
// PART 7: A CLIENT-ONLY PLUGIN
// ============================================
// app/plugins/tracker.client.ts
export default defineNuxtPlugin(() => {
const track = (evt: string) => {
(window as any).gtag?.('event', evt);
};
return { provide: { track } };
});
// ============================================
// PART 8: A SERVER-ONLY PLUGIN
// ============================================
// app/plugins/logger.server.ts
export default defineNuxtPlugin(() => {
const log = (msg: string) => console.info(`[server] ${msg}`);
return { provide: { log } };
});
<!-- ============================================
<!-- PART 9: CONSUMING INJECTED PLUGIN VALUES
<!-- ============================================ -->
<!-- app/pages/dashboard.vue -->
<script setup>
const { $session } = useNuxtApp();
// $track is only defined on the client
// $log is only defined on the server
</script>
<template>
<section v-if="$session.user">Welcome {{ $session.user.id }}</section>
</template>
// ============================================
// PART 10: HOOKING THE LIFECYCLE
// ============================================
// app/plugins/hooks.ts
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('app:mounted', () => console.log('App booted'));
nuxtApp.hook('page:finish', () => console.log('Page rendered'));
});
The ten parts covered the default and named layouts, layout selection per page, named and global middleware, universal, client-only, and server-only plugins, consuming injected values in a component, and hooking the app lifecycle.
Quick Reference
Layout Selection Forms
| Form | Syntax | Scope |
|---|---|---|
| Static default | omit definePageMeta | app/layouts/default.vue |
| Static named | definePageMeta({ layout: 'admin' }) | Matching file |
| Dynamic | <NuxtLayout :name="layout" /> | Reactive in template |
| Inline | <NuxtLayout><slot /></NuxtLayout> | Local shell |
Middleware Flavor Matrix
| Flavor | Location | Suffix | Runs |
|---|---|---|---|
| Named | app/middleware/*.ts | โ | Opted-in pages |
| Anonymous | inline in definePageMeta | โ | That page only |
| Global | app/middleware/*.global.ts | .global | Every route |
| Route-only | definePageMeta({ middleware: [...] }) | โ | That page |
Plugin Environment Suffixes
| Suffix | Runs In | Use Case |
|---|---|---|
*.client.ts | Browser only | window, localStorage, canvas |
*.server.ts | Nitro only | DB client, fs, secrets |
*.ts (no suffix) | Both | Universal SDKs, hooks |
NN.name.ts | Ordered | After 00.*, 01.* |
Lifecycle Order
| Order | Stage | Can Use |
|---|---|---|
| 1 | Plugins boot | nuxtApp, provide |
| 2 | Global middleware | useState, useCookie |
| 3 | Named middleware | Same as global |
| 4 | Layout render | useNuxtApp().$api |
| 5 | Page render | All app context |
Best Practices
โ Do This:
<!-- Keep the shell in a layout, not duplicated per page -->
<!-- app/layouts/default.vue with <slot /> --> <!-- โ
-->
<!-- Use definePageMeta for opt-in middleware -->
<script setup>definePageMeta({ middleware: ['auth'] });</script> <!-- โ
-->
<!-- Restrict browser-only plugin code -->
// app/plugins/storage.client.ts // โ
<!-- Inject singletons through provide -->
return { provide: { api: apiClient } }; // โ
<!-- Order dependent plugins numerically -->
// 01.session.ts, 02.analytics.ts // โ
โ Don’t Do This:
<!-- Don't duplicate the header in every page -->
<!-- <header>...</header> in every route file --> <!-- โ -->
<!-- Don't guard auth inside onMounted -->
<script setup>onMounted(() => { if (!user) navigateTo(...) });</script> <!-- โ -->
<!-- Don't touch window in a universal plugin -->
(window as any).foo = 1; // โ
<!-- Don't call $api from middleware that boots after the plugin -->
// Use useState or provide from a plugin that runs first // โ
<!-- Don't register plugins manually -->
// Auto-registration is the Nuxt convention // โ
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| Layout not applied | Layout file missing or name mismatch | Name matches file without .vue |
$api undefined in middleware | Middleware runs before plugin boot | Use useState to pass state forward |
| Global middleware runs too often | Used .global when .ts was enough | Rename to auth.ts and opt in per page |
window errors on SSR | Universal plugin touched browser API | Rename to *.client.ts |
| Redirect loop | Login route itself is guarded | Skip guard when to.path === '/login' |
| Stale injected state | Values stored in a plain object | Use useState on SSR-shared state |
Real-World Examples
1. Default layout with slot
<!-- app/layouts/default.vue -->
<template><div class="shell"><slot /></div></template>
2. Selecting a named layout
<script setup>
definePageMeta({ layout: 'admin' });
</script>
3. Named auth middleware
// app/middleware/auth.ts
export default defineNuxtRouteMiddleware((to) => {
if (!useState('user').value) return navigateTo('/login');
});
4. Global middleware suffix
// app/middleware/log.global.ts
export default defineNuxtRouteMiddleware((to) => console.log(to.path));
5. Universal plugin
export default defineNuxtPlugin(() => ({ provide: { hello: 'hi' } }));
6. Client-only plugin
// app/plugins/ga.client.ts
export default defineNuxtPlugin(() => { (window as any).gtag = () => {}; });
7. Server-only plugin
// app/plugins/db.server.ts
export default defineNuxtPlugin(() => ({ provide: { db: connectDb() } }));
8. Consuming provide
const { $hello } = useNuxtApp();
9. Lifecycle hook
nuxtApp.hook('page:finish', () => { /* analytics */ });
10. Abort navigation
return abortNavigation('Feature disabled');
Visual
Layout Composition
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ app/layouts/default.vue โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ <header> ... </header> โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ <slot /> โ โ โ
โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ
โ โ โ โ app/pages/dashboard.vue โ โ โ โ
โ โ โ โ Rendered inside the slot โ โ โ โ
โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ <footer> ... </footer> โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Middleware Execution Order
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ NAVIGATION EVENT โ
โ โ
โ user clicks a <NuxtLink> โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Global middleware (*.global) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ (continue or redirect) โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Named middleware (auth) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ (continue or redirect) โ
โ โผ โ
โ Page component renders โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Plugin Environment Split
โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ
โ BROWSER BUNDLE โ โ SERVER BUNDLE โ
โ โ โ โ
โ *.client.ts โ
โ โ *.server.ts โ
โ
โ *.server.ts โ โ โ *.client.ts โ โ
โ *.ts โ
โ โ *.ts โ
โ
โ โ โ โ
โ window, localStorage โ โ fs, secrets, DB โ
โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ
Plugin โ Middleware โ Layout Lifecycle
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. PLUGINS BOOT โ
โ provide({ session, api, tracker }) โ
โ โ โ
โ โผ โ
โ 2. GLOBAL MIDDLEWARE โ
โ uses useState + useCookie โ
โ โ โ
โ โผ โ
โ 3. NAMED MIDDLEWARE โ
โ guards the route (redirect or continue) โ
โ โ โ
โ โผ โ
โ 4. LAYOUT RENDER โ
โ <slot /> injects the page โ
โ โ โ
โ โผ โ
โ 5. PAGE RENDER โ
โ useNuxtApp().$api is now available โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Item | Value |
|---|---|
| Layouts directory | app/layouts/ |
| Default layout | default.vue |
| Slot element | <slot /> |
| Layout selector | definePageMeta({ layout }) |
| Named middleware | app/middleware/*.ts |
| Global middleware | app/middleware/*.global.ts |
| Plugin directory | app/plugins/ |
| Client-only plugin | *.client.ts |
| Server-only plugin | *.server.ts |
| Plugin ordering | Numeric file prefix |
Key takeaways:
- Layouts are reuse without duplication. A
default.vuelayout with a<slot />becomes the single home for the navigation shell, and named layouts switch the shell per page with one line ofdefinePageMeta. - Middleware is pre-render, which is what makes it secure. It runs before the route resolves, so auth checks and feature-flag guards happen before any page code executes, on the server during SSR and on the client during navigation.
- Global middleware runs on every route. The
.global.tssuffix is the switch; without it, the same file behaves as named only and requires per-page opt-in. Reserve global for concerns that truly apply everywhere. - Plugins build the singletons and inject them. Returning
{ provide: { api } }from a plugin exposes$apitouseNuxtApp()in every component, running exactly once during app boot and never per-component. - The
.clientand.serversuffixes are a lexical firewall. A plugin that toucheswindowbecomes.client.ts; a plugin that touches the database becomes.server.ts; a universal plugin stays unsuffixed and must remain environment-safe. - Order matters across the entire lifecycle. Plugins boot first, then global middleware, then named middleware, then layouts, then pages. Any state a later stage needs must be published from an earlier stage via
provideoruseState.
Remember: Layouts wrap the page, middleware gates the page, and plugins extend the app. Put the shared shell in a layout, put every guard in middleware so it runs before render, and put every one-time integration in a plugin so it initializes exactly once. When these three systems are combined, a Nuxt application gains a navigation shell that never repeats markup, route guards that never flash protected content, and integrations that never double-initializeโall while maintaining the strict server/client boundary that makes the framework safe for full-stack deployment.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!