Skip to content
Tutorials Center
My learning

Topics

Nuxt.js Tutorial

Learn Nuxt.js step by step: 32 lessons in 11 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

First steps

  1. 1 What Nuxt is and why use it Learn what Nuxt adds to Vue: file-based routing, server rendering, auto-imports and a built-in server. See when Nuxt fits and when plain Vue is enough.
  2. 2 Project structure and conventions Tour the Nuxt folder layout: app, pages, components, composables, server, public, nuxt.config.ts and the generated .nuxt folder, and what each one does.
  3. 3 Auto-imports How Nuxt imports components, composables, utils and Vue APIs for you, the naming rules for nested components, the Lazy prefix, explicit imports and pitfalls.

Pages and routing

  1. 4 File-based routing Create routes in Nuxt by adding files to pages/. Learn index files, nested folders, NuxtPage in app.vue, NuxtLink and how link prefetching works.
  2. 5 Dynamic routes and params Use square brackets in file names for dynamic Nuxt routes: [id].vue, optional [[slug]], catch-all [...slug], useRoute params, validate and match order.
  3. 6 Nested routes and layouts Build parent and child routes with NuxtPage, share page frames with the layouts folder, switch layouts with definePageMeta, and handle errors with error.vue.
  4. 7 Navigation and route middleware Move between pages with NuxtLink, navigateTo and useRouter, then guard routes with named, inline and global middleware, auth redirects and abortNavigation.

Data and state

  1. 8 Data fetching with useFetch and useAsyncData Load data in Nuxt without fetching twice: useFetch, useAsyncData and $fetch compared, keys, status and refresh, lazy and server options, transform, and payload reuse.
  2. 9 State with useState and Pinia Share state safely in a server-rendered Nuxt app: useState, why module-level refs leak data between visitors, Pinia stores and useCookie for small persistent values.

Components and styling

  1. 10 Components and composables in Nuxt How Nuxt finds your components and composables, the component naming rules, lazy components, .client and .server files, the ClientOnly wrapper and islands.
  2. 11 Head, SEO and assets Control the page title, meta tags and Open Graph data with useHead and useSeoMeta, add canonical links, sitemaps and robots rules, and place files in public or assets.
  3. 12 Styling in Nuxt Style a Nuxt app: global CSS in nuxt.config, scoped styles and CSS modules, Tailwind with the Vite plugin, fonts, and dark mode with the color mode module.

Server and API

  1. 13 Server routes and the Nitro engine Build backend endpoints inside a Nuxt app with server/api and server/routes: defineEventHandler, query, body, params, status codes and createError.
  2. 14 Server middleware, plugins and utils Share code and behavior across Nuxt server routes with server/middleware, server/utils, Nitro plugins and hooks, CORS, cached handlers and the storage layer.
  3. 15 Runtime config and environment variables Configure a Nuxt app safely: runtimeConfig vs app.config, public keys, NUXT_ environment overrides, build time vs runtime, and how to avoid leaking secrets.
  4. 16 Databases and ORMs Connect Nuxt server routes to a database: the Nitro database layer, Drizzle and Prisma overview, SQLite for development, migrations and avoiding N+1 queries.

Rendering modes

  1. 17 Rendering modes: SSR, SPA, SSG, hybrid Understand Nuxt universal rendering and hydration, then choose SSR, SPA (ssr: false), static generation or hybrid routeRules like swr and prerender per route.
  2. 18 Hydration and SSR pitfalls Learn why Nuxt hydration mismatches happen (Date, Math.random, window, bad HTML) and fix them with useState, onMounted, ClientOnly, useId and debugging steps.

Plugins, modules and layers

  1. 19 Plugins and Nuxt Modules Learn how Nuxt plugins run before your app, how provide creates $helpers, what modules add to a project, and how to write a tiny module with hooks.
  2. 20 Layers and Code Organization Learn how Nuxt layers let projects extend each other, how configuration and app.config merge, how to share code in a monorepo and how to organize a large app.

Quality

  1. 21 Forms, Validation and Auth Flows Build Nuxt forms that submit to server routes, validate input on both client and server, show field errors, and protect pages and APIs with session cookies.
  2. 22 Testing Nuxt Apps Learn how to test a Nuxt app: unit tests with Vitest, components with @nuxt/test-utils, mocking fetch and composables, server routes, and end-to-end tests with Playwright.
  3. 23 Performance and Core Web Vitals Make a Nuxt app fast: lazy components and hydration, smaller payloads, image and font optimization, route rule caching and bundle analysis, with runnable models.
  4. 24 Security and Common Mistakes Avoid the common Nuxt security mistakes: XSS with v-html, CSRF, secrets in public config, missing rate limits, client-only auth checks and double fetching.

Deployment

  1. 25 Building and deploying Nuxt Build a Nuxt app, understand the .output folder, pick a Nitro preset (Node, static, Vercel, Cloudflare, Docker), set env at runtime and add a health check.

Projects

  1. 26 Project: a blog with Nuxt Content style Markdown Build a fast, SEO-friendly Nuxt blog from Markdown files: slug routes, useSeoMeta, a tags page and prerendering, with runnable Node stand-ins.
  2. 27 Project: a product catalog with cart Build a small Nuxt store: a server API for products, listing and detail pages with useFetch, a shared cart with useState and a safe checkout route.
  3. 28 Project: a dashboard with auth Build a Nuxt dashboard with a login endpoint, session cookie, route middleware guard, protected API and a chart data endpoint, with Node stand-ins.
  4. 29 Project: a notes app with a server API Build a Nuxt notes app: CRUD server routes, input validation, SQLite storage and an optimistic UI that rolls back on failure, with Node stand-ins.

Practice and review

  1. 30 Practice exercises with solutions Ten hands-on Nuxt exercises on routing, data fetching, server routes, route rules and middleware, each with a runnable solution you can edit and test.
  2. 31 Nuxt Interview Questions and Answers 30 Nuxt interview questions with short, accurate answers on rendering, hydration, data fetching, Nitro, middleware and SSR state, plus runnable stand-ins for the tricky ones.
  3. 32 Nuxt Cheat Sheet A one-page Nuxt 4 cheat sheet: folder-to-feature map, key composables, nuxt.config keys, routeRules, CLI commands and server helpers, with runnable stand-ins for routes and rules.