Nuxt

The full-stack framework for Vue: file-based routing, SSR and SSG, auto-imports, data fetching and server routes.

Intermediate · about 10 hours · difficulty 3/5

Learn first: CSR, SSR, SSG, ISR and Streaming, Vue

Nuxt is to Vue what Next.js is to React: a framework that adds routing, rendering strategies, data fetching and a server layer, with strong conventions and a smooth developer experience.

Core features

  • File-based routing from the pages/ directory, with dynamic routes ([id].vue), nested routes and layouts.
  • Auto-imports for components, composables and Vue APIs, so files stay short.
  • Data fetching with useFetch and useAsyncData, which run on the server during SSR and transfer the result to the client so it is not fetched twice.
  • Rendering modes: universal SSR by default, plus static generation, SPA mode and route rules that mix strategies per path (for example prerender marketing pages, cache product pages, CSR the admin area).
  • Server routes in server/api powered by Nitro, deployable to Node, serverless and edge platforms.
  • useState for SSR-safe shared state, and Pinia for larger stores.
  • Modules ecosystem for images, content, i18n, auth and more.
  • SEO helpers such as useHead and useSeoMeta.

Pitfalls

Fetching with plain $fetch in components during SSR (it runs twice; use useFetch), accessing window on the server, and over-relying on auto-imports so that code becomes hard to trace.

Good enough to move on

You can build a Nuxt app with layouts, dynamic pages, useFetch data loading, a server API route and route rules that prerender some pages and server-render others.

Key concepts

  • File-based routing and layouts
  • Auto-imports
  • useFetch and useAsyncData
  • Rendering modes and route rules
  • Server routes with Nitro
  • Nuxt modules
  • SEO with useSeoMeta

Other options for this step

  • Next.js: The leading React framework: App Router, layouts, Server Components, data fetching and caching, Server Actions and middleware.
  • React Router Framework Mode (Remix): Web-standards-first full-stack React with loaders, actions and nested routes; the evolution of Remix.
  • Astro: A content-first framework that ships zero JavaScript by default and hydrates interactive islands built with any UI library.
  • SvelteKit: The official Svelte application framework with file-based routing, load functions, form actions and flexible rendering.

Mini project

Build a recipe site in Nuxt: prerendered home and category pages, server-rendered recipe pages loaded with useFetch from a server API route, and per-page SEO metadata.

Check yourself

Why does useFetch avoid fetching the same data twice during SSR and hydration?

Free resources