Skip to main content

Nuxt.js

Nuxt is a Vue-based framework for building modern web applications. It provides server-side rendering, static site generation, and a powerful module ecosystem that makes Vue development more productive.

Key Features

  • Universal rendering: SSR, SSG, SPA, and hybrid
  • File-based routing: Automatic route generation
  • Auto-imports: Components and composables just work
  • Nitro server: Powerful, universal server engine
  • Module ecosystem: Rich collection of integrations

Project Structure (Nuxt 3)

nuxt-app/
├── app.vue # Root component
├── pages/
│ ├── index.vue # Home (/)
│ ├── about.vue # About (/about)
│ └── blog/
│ └── [slug].vue # Dynamic route (/blog/my-post)
├── components/ # Auto-imported components
├── composables/ # Auto-imported composables
├── server/
│ └── api/ # API endpoints
├── public/ # Static assets
└── nuxt.config.ts # Configuration

Rendering Modes

// nuxt.config.ts
export default defineNuxtConfig({
// Universal (SSR + client hydration) - default
ssr: true,

// Static site generation
// Run: nuxt generate

// Per-route rules
routeRules: {
'/': { prerender: true },
'/admin/**': { ssr: false },
'/api/**': { cors: true },
'/blog/**': { swr: 3600 },
},
});

Example Page with Data Fetching

<template>
<div>
<h1>{{ post.title }}</h1>
<div v-html="post.content" />
</div>
</template>

<script setup>
const route = useRoute();

const { data: post } = await useFetch(`/api/posts/${route.params.slug}`);
</script>
ModulePurpose
@nuxt/contentMarkdown/MDX content management
@nuxtjs/tailwindcssTailwind CSS integration
@pinia/nuxtState management
@nuxt/imageImage optimisation
@sidebase/nuxt-authAuthentication

What We Like

  • Developer experience: Auto-imports, TypeScript, hot reload
  • Vue ecosystem: All Vue libraries work seamlessly
  • Nitro: Deploy anywhere - Node, Cloudflare, Vercel, AWS
  • Content module: Excellent for documentation and blogs
  • Configuration: Sensible defaults with easy overrides

What We Don't Like

  • Smaller community: Less resources than React/Next.js
  • Module compatibility: Some modules lag behind Nuxt 3
  • SSR complexity: Hydration mismatches can be tricky
  • Build times: Can be slow for large applications

Nuxt vs Next.js

AspectNuxtNext.js
FrameworkVueReact
ServerNitro (universal)Node/Edge
Auto-importsBuilt-inNot native
Content@nuxt/contentMDX
Learning curveGentlerSteeper

When to Use Nuxt

  • Vue.js applications needing SSR/SSG
  • Content-heavy sites (documentation, blogs)
  • Teams preferring Vue over React
  • Projects wanting flexible deployment options