No,Category,Guideline,Description,Do,Don't,Code Good,Code Bad,Severity,Docs URL,Applies To,Status,Verified At 1,Routing,Use file-based routing,Create routes under the Nuxt 4 app pages directory,app/pages with index.vue,Configure ordinary routes manually,app/pages/dashboard/index.vue,Custom router setup,Medium,https://nuxt.com/docs/4.x/getting-started/routing,nuxtjs 4.5,active,2026-08-13 2,Routing,Use dynamic route parameters,Create dynamic routes with bracket syntax under app/pages,[id].vue for dynamic params,Hardcode routes for dynamic content,app/pages/posts/[id].vue,app/pages/posts/post1.vue,Medium,https://nuxt.com/docs/4.x/getting-started/routing,nuxtjs 4.5,active,2026-08-13 3,Routing,Use catch-all routes,Handle multiple path segments with [...slug] under app/pages,[...slug].vue for catch-all,Multiply nested dynamic files unnecessarily,app/pages/[...slug].vue,app/pages/[a]/[b]/[c].vue,Low,https://nuxt.com/docs/4.x/getting-started/routing,nuxtjs 4.5,active,2026-08-13 4,Routing,Define page metadata with definePageMeta,Set page-level configuration and middleware,definePageMeta for layout middleware title,Manual route meta configuration,"definePageMeta({ layout: 'admin', middleware: 'auth' })",router.beforeEach for page config,High,https://nuxt.com/docs/4.x/api/utils/define-page-meta,nuxtjs 4.5,active,2026-08-13 5,Routing,Use validate for route params,Validate dynamic route parameters before rendering,validate function in definePageMeta,Manual validation in setup,definePageMeta({ validate: (route) => /^\d+$/.test(route.params.id) }),if (!valid) navigateTo('/404'),Medium,https://nuxt.com/docs/4.x/api/utils/define-page-meta,nuxtjs 4.5,active,2026-08-13 6,Rendering,Use SSR by default,Server-side rendering is enabled by default,Keep ssr: true (default),Disable SSR unnecessarily,ssr: true (default),ssr: false for all pages,High,https://nuxt.com/docs/4.x/guide/concepts/rendering,nuxtjs 4.5,active,2026-08-13 7,Rendering,Use .client suffix for client-only components,Mark components to render only on client,ComponentName.client.vue suffix,v-if with process.client check,Comments.client.vue,"
",Medium,https://nuxt.com/docs/4.x/guide/directory-structure/components,nuxtjs 4.5,active,2026-08-13 8,Rendering,Use .server suffix for server-only components,Mark components to render only on server,ComponentName.server.vue suffix,Manual server check,HeavyMarkdown.server.vue,"v-if=""process.server""",Low,https://nuxt.com/docs/4.x/guide/directory-structure/components,nuxtjs 4.5,active,2026-08-13 9,DataFetching,Use useFetch for simple data fetching,Wrapper around useAsyncData for URL fetching,useFetch for API calls,$fetch in onMounted,const { data } = await useFetch('/api/posts'),onMounted(async () => { data.value = await $fetch('/api/posts') }),High,https://nuxt.com/docs/4.x/api/composables/use-fetch,nuxtjs 4.5,active,2026-08-13 10,DataFetching,Use useAsyncData for complex fetching,Fine-grained control over async data,useAsyncData for CMS or custom fetching,useFetch for non-URL data sources,"const { data } = await useAsyncData('posts', () => cms.getPosts())",const { data } = await useFetch(() => cms.getPosts()),Medium,https://nuxt.com/docs/4.x/api/composables/use-async-data,nuxtjs 4.5,active,2026-08-13 11,DataFetching,Use $fetch for non-reactive requests,$fetch for event handlers and non-component code,$fetch in event handlers or server routes,useFetch in click handlers,"async function submit() { await $fetch('/api/submit', { method: 'POST' }) }",async function submit() { await useFetch('/api/submit') },High,https://nuxt.com/docs/4.x/api/utils/dollarfetch,nuxtjs 4.5,active,2026-08-13 12,DataFetching,Use lazy option for non-blocking fetch,Defer data fetching for better initial load,lazy: true for below-fold content,Blocking fetch for non-critical data,"useFetch('/api/comments', { lazy: true })",await useFetch('/api/comments') for footer,Medium,https://nuxt.com/docs/4.x/api/composables/use-fetch,nuxtjs 4.5,active,2026-08-13 13,DataFetching,Use server option intentionally,Use server:false only when data depends on browser-only state,server:false for localStorage or browser APIs,Disable SSR merely because data is user-specific,"useFetch('/api/preferences', { server: false }) for browser-only input",server:false for any authenticated request,Medium,https://nuxt.com/docs/4.x/api/composables/use-fetch,nuxtjs 4.5,active,2026-08-13 14,DataFetching,Use pick to reduce payload size,Select only needed fields from response,pick option for large responses,Fetching entire objects when few fields needed,"useFetch('/api/user', { pick: ['id', 'name'] })",useFetch('/api/user') then destructure,Low,https://nuxt.com/docs/4.x/api/composables/use-fetch,nuxtjs 4.5,active,2026-08-13 15,DataFetching,Use transform for data manipulation,Transform data before storing in state,transform option for data shaping,Manual transformation after fetch,"useFetch('/api/posts', { transform: (posts) => posts.map(p => p.title) })",const titles = data.value.map(p => p.title),Low,https://nuxt.com/docs/4.x/api/composables/use-fetch,nuxtjs 4.5,active,2026-08-13 16,DataFetching,Handle loading and error states,Always handle pending and error states,Check status pending error refs,Ignoring loading states,"
Loading...
",No loading indicator,High,https://nuxt.com/docs/4.x/getting-started/data-fetching,nuxtjs 4.5,active,2026-08-13 17,Lifecycle,Avoid side effects in script setup root,Move side effects to lifecycle hooks,Side effects in onMounted,setInterval in root script setup,onMounted(() => { interval = setInterval(...) }),,High,https://nuxt.com/docs/4.x/guide/concepts/nuxt-lifecycle,nuxtjs 4.5,active,2026-08-13 18,Lifecycle,Use onMounted for DOM access,Access DOM only after component is mounted,onMounted for DOM manipulation,Direct DOM access in setup,onMounted(() => { document.getElementById('el') }),,High,https://nuxt.com/docs/4.x/api/composables/on-mounted,nuxtjs 4.5,active,2026-08-13 19,Lifecycle,Use nextTick for post-render access,Wait for DOM updates before accessing elements,await nextTick() after state changes,Immediate DOM access after state change,count.value++; await nextTick(); el.value.focus(),count.value++; el.value.focus(),Medium,https://nuxt.com/docs/4.x/api/utils/next-tick,nuxtjs 4.5,active,2026-08-13 20,Lifecycle,Use onPrehydrate for pre-hydration logic,Run code before Nuxt hydrates the page,onPrehydrate for client setup,onMounted for hydration-critical code,onPrehydrate(() => { console.log(window) }),onMounted for pre-hydration needs,Low,https://nuxt.com/docs/4.x/api/composables/on-prehydrate,nuxtjs 4.5,active,2026-08-13 21,Server,Use server/api for API routes,Create API endpoints in server/api directory,server/api/users.ts for /api/users,Manual Express setup,server/api/hello.ts -> /api/hello,app.get('/api/hello'),High,https://nuxt.com/docs/4.x/guide/directory-structure/server,nuxtjs 4.5,active,2026-08-13 22,Server,Use defineEventHandler for handlers,Define server route handlers,defineEventHandler for all handlers,export default function,export default defineEventHandler((event) => { return { hello: 'world' } }),"export default function(req, res) {}",High,https://nuxt.com/docs/4.x/guide/directory-structure/server,nuxtjs 4.5,active,2026-08-13 23,Server,Use server/routes for non-api routes,Routes without /api prefix,server/routes for custom paths,server/api for non-api routes,server/routes/sitemap.xml.ts,server/api/sitemap.xml.ts,Medium,https://nuxt.com/docs/4.x/guide/directory-structure/server,nuxtjs 4.5,active,2026-08-13 24,Server,Use getQuery and readBody for input,Access query params and request body,getQuery(event) readBody(event),Direct event access,const { id } = getQuery(event),event.node.req.query,Medium,https://nuxt.com/docs/4.x/guide/directory-structure/server,nuxtjs 4.5,active,2026-08-13 25,Server,Validate server input,Always validate input in server handlers,Zod or similar for validation,Trust client input,const body = await readBody(event); schema.parse(body),const body = await readBody(event),High,https://nuxt.com/docs/4.x/guide/directory-structure/server,nuxtjs 4.5,active,2026-08-13 26,State,Use useState for serializable shared state,Share SSR-safe values whose contents can be serialized,useState for JSON-serializable cross-component state,Store classes functions or symbols,"const count = useState('count', () => 0)",useState('service' () => new Service()),High,https://nuxt.com/docs/4.x/api/composables/use-state,nuxtjs 4.5,active,2026-08-13 27,State,Use unique keys for useState,Prevent state conflicts with unique keys,Descriptive unique keys for each state,Generic or duplicate keys,"useState('user-preferences', () => ({}))",useState('data') in multiple places,Medium,https://nuxt.com/docs/4.x/api/composables/use-state,nuxtjs 4.5,active,2026-08-13 28,State,Use Pinia for complex state,Pinia for advanced state management,@pinia/nuxt for complex apps,Custom state management,useMainStore() with Pinia,Custom reactive store implementation,Medium,https://nuxt.com/docs/4.x/getting-started/state-management,nuxtjs 4.5,active,2026-08-13 29,State,Use callOnce for one-time async operations,Ensure async operations run only once,callOnce for store initialization,Direct await in component,await callOnce(store.fetch),await store.fetch() on every render,Medium,https://nuxt.com/docs/4.x/api/utils/call-once,nuxtjs 4.5,active,2026-08-13 30,SEO,Use useSeoMeta for SEO tags,Type-safe SEO meta tag management,useSeoMeta for meta tags,useHead for simple meta,"useSeoMeta({ title: 'Home', ogTitle: 'Home', description: '...' })","useHead({ meta: [{ name: 'description', content: '...' }] })",High,https://nuxt.com/docs/4.x/api/composables/use-seo-meta,nuxtjs 4.5,active,2026-08-13 31,SEO,Use reactive values in useSeoMeta,Dynamic SEO tags with refs or getters,Computed getters for dynamic values,Static values for dynamic content,useSeoMeta({ title: () => post.value.title }),useSeoMeta({ title: post.value.title }),Medium,https://nuxt.com/docs/4.x/api/composables/use-seo-meta,nuxtjs 4.5,active,2026-08-13 32,SEO,Use useHead for non-meta head elements,Scripts styles links in head,useHead for scripts and links,useSeoMeta for scripts,useHead({ script: [{ src: '/analytics.js' }] }),useSeoMeta({ script: '...' }),Medium,https://nuxt.com/docs/4.x/api/composables/use-head,nuxtjs 4.5,active,2026-08-13 33,SEO,Include OpenGraph tags,Add OG tags for social sharing,ogTitle ogDescription ogImage,Missing social preview,"useSeoMeta({ ogImage: '/og.png', twitterCard: 'summary_large_image' })",No OG configuration,Medium,https://nuxt.com/docs/4.x/api/composables/use-seo-meta,nuxtjs 4.5,active,2026-08-13 34,Middleware,Use defineNuxtRouteMiddleware,Define route middleware under app/middleware,defineNuxtRouteMiddleware wrapper in app/middleware,Put route middleware in server/middleware,"export default defineNuxtRouteMiddleware((to, from) => {})","export default function(to, from) {}",High,https://nuxt.com/docs/4.x/guide/directory-structure/app/middleware,nuxtjs 4.5,active,2026-08-13 35,Middleware,Use navigateTo for redirects,Redirect in middleware with navigateTo,return navigateTo('/login'),router.push in middleware,if (!auth) return navigateTo('/login'),if (!auth) router.push('/login'),High,https://nuxt.com/docs/4.x/api/utils/navigate-to,nuxtjs 4.5,active,2026-08-13 36,Middleware,Reference middleware in definePageMeta,Apply app/middleware entries to specific pages,middleware array in definePageMeta,Use global middleware for a page-specific concern,definePageMeta({ middleware: ['auth'] }),Global auth check for one page,Medium,https://nuxt.com/docs/4.x/guide/directory-structure/app/middleware,nuxtjs 4.5,active,2026-08-13 37,Middleware,Use .global suffix for global middleware,Apply named route middleware globally with .global and keep it idempotent because initial SSR middleware can run again during hydration,app/middleware/auth.global.ts with repeat-safe logic,Assume it runs exactly once,app/middleware/auth.global.ts,Increment state unconditionally on every middleware run,Medium,https://nuxt.com/docs/4.x/guide/directory-structure/app/middleware,nuxtjs 4.5,active,2026-08-13 38,ErrorHandling,Use createError for errors,Create errors with proper status codes,createError with statusCode,throw new Error,"throw createError({ statusCode: 404, statusMessage: 'Not Found' })",throw new Error('Not Found'),High,https://nuxt.com/docs/4.x/api/utils/create-error,nuxtjs 4.5,active,2026-08-13 39,ErrorHandling,Use NuxtErrorBoundary for local errors,Handle errors within component subtree,NuxtErrorBoundary for component errors,Global error page for local errors,"