Skip to the solution
MediumFrontend10 min read

What is Nuxt and how does it relate to Vue?

1.2k views

The problem

Question presented to candidate: "We are starting a new content-heavy site and the team knows Vue. Someone suggested Nuxt. What is Nuxt, how does it relate to Vue itself, and what would it give us that a plain Vite + Vue project does not?"

What a strong answer should cover:

  • Nuxt is a framework built on top of Vue: your components are ordinary Vue SFCs, and Nuxt adds conventions, a build pipeline and a server.
  • File-based routing (on Vue Router), layouts, and auto-imports of Vue APIs, composables and components.
  • Rendering modes per route: SSR by default, prerendering, client-only, and caching rules via routeRules.
  • Data fetching with useFetch/useAsyncData, whose server results are serialised so the client does not fetch again.
  • A server layer (Nitro) for API routes and deployment presets (Node, serverless, edge, static).
  • Versions: Nuxt 4 is current (July 2025 onwards); Nuxt 3 reached end of life on 31 July 2026.
  • Trade-offs: more conventions and magic, a server to run for SSR, and a framework release cycle on top of Vue's.

Clarifying questions expected:

  • "Do we need SEO and fast first paint, or is this an app behind a login?"
  • "Where will it be hosted: a Node server, serverless, or static hosting only?"

Code / implementation expected: Optional β€” a page using useFetch and a routeRules entry.

  • vue
  • nuxt
  • ssr
  • framework

Try it yourself

Sketch your approach before you read the solution. That is what the interview tests.

Stuck? Get a hint.

A short nudge toward the approach. It will not give the answer away.

Solution

The solution is hidden so you can try first

10 min read Β· 10 sections

Read the code

VueA Nuxt page: auto-imported useFetch and useHead, file-based route at /
<script setup lang="ts">
// useFetch runs on the server, and its result is serialised into the page payload,
// so the client reuses it during hydration instead of fetching again.
const { data } = await useFetch("/api/time");
useHead({ title: "Nuxt demo" });
</script>
<template>
  <main>
    <h1>Hello from Nuxt</h1>
    <p>Server said: {{ data?.at }}</p>
    <NuxtLink to="/mismatch">mismatch demo</NuxtLink>
  </main>
</template>
nuxt.config.ts with per-route rendering, and a Nitro API route
// ── nuxt.config.ts ──
export default defineNuxtConfig({
  compatibilityDate: "2026-10-01",
  devtools: { enabled: false },
  telemetry: false,
  // Per-route rendering modes, all in one app
  routeRules: {
    "/about": { prerender: true },   // HTML generated once at build time
    "/dashboard": { ssr: false },    // client-only SPA route
  },
});

// ── server/api/time.ts (a Nitro API route, served at /api/time) ──
export default defineEventHandler(() => ({ at: "2026-10-16T12:00:00Z", runtime: "nitro" }));

Discussion

Other approaches, follow-ups and how it went in real interviews.

Sign in to join the discussion.

No comments yet. Share how you would answer it.

Question 19 of 92 in Vue.js

Keep your momentum going.

Mark this question solved to track your progress, then take the next one while it is fresh.

All Vue.js questions
Up nextMedium

What is the difference between watch and watchEffect?

Continue