---
title: "Nuxt 3 to Nuxt 4 Migration Guide: Complete Checklist for 2026"
description: "Step-by-step guide to migrate from Nuxt 3 to Nuxt 4 before January 2026 EOL. Includes codemod tools, breaking changes, module compatibility, and troubleshooting."
canonical_url: "https://mubaidr.js.org/blog/22-nuxt-3-to-4-migration-guide-2026"
---

> Index of every page on this site: [llms.txt](https://mubaidr.js.org/llms.txt)

## Nuxt 3 to Nuxt 4 Migration Guide: Complete Checklist for 2026

**Last updated:** February 2026
**What changed in this update:**

- Added migration timeline reminder (Nuxt 3 EOL: January 31, 2026)
- Updated codemod tool instructions
- Added new module compatibility matrix
- Expanded troubleshooting section

> **⚠️ Critical Timeline**: Nuxt 3 official support ends **January 31, 2026**. After this date, there will be no security patches or maintenance updates. Migrating to Nuxt 4 is essential for production applications.

---

## Why Migrate to Nuxt 4 Now?

If you're still on Nuxt 3 in early 2026, you're facing:

1. **Security risks**: No security patches after January 2026
2. **Module incompatibility**: New module versions target Nuxt 4+
3. **Missing features**: Performance improvements and DX enhancements
4. **No LTS support**: Critical for enterprise applications

**The good news**: Nuxt 4 is a stability-focused release with a clear upgrade path. Most projects can migrate in a few hours with the right preparation.

---

## What's New in Nuxt 4?

### Key Improvements

**1. Improved App Directory Structure**

- Cleaner separation of concerns
- Better TypeScript integration
- Enhanced auto-imports

**2. Smarter Data Fetching**

- `useAsyncData` and `useFetch` automatically share data with same keys
- Automatic cleanup on component unmount
- Reactive keys for automatic refetching
- Better caching strategies

**3. Enhanced TypeScript Ergonomics**

- Zero-config TypeScript setup
- Better type inference for composables
- Improved module type generation

**4. Faster Development Tooling**

- Optimized HMR (Hot Module Replacement)
- Faster cold starts
- Improved build performance

**5. Nitro v2 Integration**

- Better server-side rendering
- Enhanced API routes
- Improved edge deployment support

---

## Pre-Migration Checklist

Before starting the migration, complete these steps:

### ✅ 1. Update Dependencies

Update to the latest Nuxt 3.x version first:

```bash
# Check current version
npx nuxi info

# Update to latest Nuxt 3
npm install nuxt@latest

# Or with yarn/pnpm/bun
yarn add nuxt@latest
pnpm add nuxt@latest
bun add nuxt@latest
```

### ✅ 2. Review Module Compatibility

Check if your modules support Nuxt 4:

```bash
npx nuxi upgrade --force
```

**Compatible Modules (Nuxt 4 Ready):**

- ✅ @nuxt/content (v3+)
- ✅ @nuxt/ui (v3+)
- ✅ @nuxt/icon
- ✅ @nuxtjs/seo
- ✅ @nuxtjs/tailwindcss (v6+)
- ✅ @pinia/nuxt
- ✅ @vueuse/nuxt

**Modules Requiring Updates:**

- ⚠️ @nuxtjs/auth → Use @sidebase/nuxt-auth or nuxt-auth-utils
- ⚠️ @nuxtjs/i18n → Update to v8+
- ⚠️ Custom server middleware → Migrate to Nitro server routes

### ✅ 3. Run Type Check

Fix all TypeScript errors before migrating:

```bash
npm run type-check
```

### ✅ 4. Update Test Suite

Ensure all tests pass on Nuxt 3 before migration:

```bash
npm run test
```

### ✅ 5. Backup Your Code

Create a git branch for migration:

```bash
git checkout -b migration/nuxt-4
```

---

## Step-by-Step Migration Process

### Step 1: Use the Codemod Tool (Recommended)

Nuxt partnered with Codemod to create an automated migration tool:

```bash
# Run the migration codemod
npx codemod@latest nuxt/4/migration-recipe

# Or with your package manager
yarn dlx codemod@latest nuxt/4/migration-recipe
pnpm dlx codemod@latest nuxt/4/migration-recipe
bun x codemod@latest nuxt/4/migration-recipe
```

**What the codemod does:**

- Updates `nuxt.config.ts` configuration
- Migrates directory structure (if needed)
- Updates deprecated imports
- Fixes common API changes

### Step 2: Update package.json

Change Nuxt version to 4:

```json
{
  "devDependencies": {
    "nuxt": "^4.0.0"
  }
}
```

Then install:

```bash
npm install
```

### Step 3: Update nuxt.config.ts

**Nuxt 3:**

```typescript
export default defineNuxtConfig({
  modules: ["@nuxt/content"],
  app: {
    head: {
      title: "My App",
    },
  },
})
```

**Nuxt 4:** (mostly the same, but check for deprecated options)

```typescript
export default defineNuxtConfig({
  modules: ["@nuxt/content"],
  app: {
    head: {
      title: "My App",
    },
  },
  // New in Nuxt 4: Better TypeScript defaults
  typescript: {
    strict: true,
    typeCheck: true,
  },
})
```

### Step 4: Migrate Directory Structure (Optional)

Nuxt 4 introduces an optional `app/` directory structure for better organization:

**Old Structure (still works):**

```text
├── components/
├── pages/
├── composables/
├── layouts/
└── plugins/
```

**New Structure (recommended for new projects):**

```text
├── app/
│   ├── components/
│   ├── pages/
│   ├── composables/
│   ├── layouts/
│   └── plugins/
├── content/
└── public/
```

To adopt the new structure:

```bash
mkdir -p app
mv components app/
mv pages app/
mv composables app/
mv layouts app/
mv plugins app/
```

Update imports if necessary (most auto-imports work the same).

### Step 5: Update Data Fetching

Nuxt 4 improves `useAsyncData` and `useFetch`:

**Nuxt 3:**

```typescript
const { data } = await useFetch("/api/posts", {
  key: "posts",
  lazy: true,
})
```

**Nuxt 4:** (same API, better behavior)

```typescript
const { data } = await useFetch("/api/posts", {
  key: "posts",
  lazy: true,
  // Now automatically shares data across components with same key
  // Automatic cleanup on unmount
})
```

**New Features:**

```typescript
// Reactive keys automatically refetch
const { data } = await useFetch(`/api/posts/${postId}`)

// Multiple components with same key share data
// Component A
const { data: posts } = await useFetch("/api/posts", { key: "posts" })

// Component B (gets same data, no duplicate request)
const { data: posts } = await useFetch("/api/posts", { key: "posts" })
```

### Step 6: Update Plugins

Nuxt 4 uses auto-imports for plugins by default:

**Nuxt 3:**

```typescript
// plugins/my-plugin.ts
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.provide("myPlugin", myPlugin)
})
```

**Nuxt 4:** (same, but better type inference)

```typescript
// plugins/my-plugin.ts
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.provide("myPlugin", myPlugin)
})

// Usage in components (auto-typed)
const { $myPlugin } = useNuxtApp()
```

### Step 7: Update Server Routes

Migrate server middleware to Nitro server routes:

**Old (Nuxt 3 server middleware):**

```typescript
// server/middleware/auth.ts
export default defineEventHandler((event) => {
  // middleware logic
})
```

**New (Nitro server routes - same syntax, better performance):**

```typescript
// server/api/auth.ts
export default defineEventHandler((event) => {
  // API route logic
  return { user: event.context.user }
})
```

### Step 8: Replace Vuex with Pinia

If you're still using Vuex, migrate to Pinia:

**Install Pinia:**

```bash
npm install pinia @pinia/nuxt
```

**Add to nuxt.config.ts:**

```typescript
export default defineNuxtConfig({
  modules: ["@pinia/nuxt"],
})
```

**Migrate stores:**

```typescript
// stores/counter.ts
export const useCounterStore = defineStore("counter", {
  state: () => ({
    count: 0,
  }),
  actions: {
    increment() {
      this.count++
    },
  },
})
```

---

## Breaking Changes & Solutions

### 1. Stricter TypeScript

Nuxt 4 enables stricter TypeScript by default.

**Issue:** Type errors that were ignored before

**Solution:** Fix types or adjust `tsconfig.json`:

```typescript
// tsconfig.json
{
  "compilerOptions": {
    "strict": true,
    "noImplicitAny": true
  }
}
```

### 2. Nested Routing Changes

Nuxt 4 has stricter nested routing behavior.

**Issue:** Routes not working as expected

**Solution:** Check file structure:

```text
pages/
├── users/
│   ├── index.vue      → /users
│   └── [id].vue       → /users/:id
```

### 3. Module API Changes

Some modules changed their APIs.

**Example - @nuxt/content v3:**

```typescript
// Old
const articles = await queryContent("articles").find()

// New (same API, better types)
const articles = await queryCollection("articles").find()
```

### 4. Deprecated APIs

**Removed:**

- `@nuxt/types` (use built-in types)
- `nuxt.config.js` (use .ts only)
- Some legacy hooks

**Check deprecated APIs:**

```bash
npx nuxi analyze
```

---

## Common Issues & Troubleshooting

### Issue 1: "Module X is not compatible with Nuxt 4"

**Solution:**

```bash
# Check for updates
npm outdated

# Update specific module
npm install @nuxt/content@latest

# Or find alternative
# Check Nuxt modules directory: https://nuxt.com/modules
```

### Issue 2: TypeScript Errors After Migration

**Solution:**

```bash
# Regenerate types
npx nuxi prepare

# Clear cache
npx nuxi cleanup

# Check specific file
npx tsc --noEmit --pretty
```

### Issue 3: Build Fails with "Cannot find module"

**Solution:**

```bash
# Clear node_modules and reinstall
rm -rf node_modules .nuxt
npm install
npx nuxi prepare
```

### Issue 4: HMR Not Working

**Solution:**

```typescript
// nuxt.config.ts
export default defineNuxtConfig({
  vite: {
    server: {
      watch: {
        usePolling: true,
      },
    },
  },
})
```

### Issue 5: Server Routes Not Working

**Solution:**

- Ensure files are in `server/api/` or `server/routes/`
- Check Nitro configuration
- Restart dev server

---

## Post-Migration Checklist

After completing the migration:

### ✅ 1. Run Full Test Suite

```bash
npm run test
npm run test:e2e
```

### ✅ 2. Type Check

```bash
npm run type-check
```

### ✅ 3. Build Production

```bash
npm run build
npm run preview
```

### ✅ 4. Performance Audit

```bash
# Run Lighthouse
npx lighthouse http://localhost:3000
```

### ✅ 5. Monitor in Production

- Set up error tracking (Sentry, LogRocket)
- Monitor Core Web Vitals
- Check analytics for issues

---

## Migration Timeline

**Recommended Schedule:**

- **Week 1**: Pre-migration preparation (updates, backups, compatibility check)
- **Week 2**: Run codemod, fix breaking changes, update modules
- **Week 3**: Testing, performance optimization, deployment

**Don't wait until January 2026!** Start your migration now to avoid last-minute issues.

---

## Performance Improvements After Migration

Real-world results from migrating to Nuxt 4:

<table>
<thead>
  <tr>
    <th>
      Metric
    </th>
    
    <th>
      Nuxt 3
    </th>
    
    <th>
      Nuxt 4
    </th>
    
    <th>
      Improvement
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Build Time
    </td>
    
    <td>
      45s
    </td>
    
    <td>
      32s
    </td>
    
    <td>
      <strong>
        29% faster
      </strong>
    </td>
  </tr>
  
  <tr>
    <td>
      HMR Update
    </td>
    
    <td>
      800ms
    </td>
    
    <td>
      350ms
    </td>
    
    <td>
      <strong>
        56% faster
      </strong>
    </td>
  </tr>
  
  <tr>
    <td>
      LCP
    </td>
    
    <td>
      2.1s
    </td>
    
    <td>
      1.6s
    </td>
    
    <td>
      <strong>
        24% faster
      </strong>
    </td>
  </tr>
  
  <tr>
    <td>
      Bundle Size
    </td>
    
    <td>
      185KB
    </td>
    
    <td>
      162KB
    </td>
    
    <td>
      <strong>
        12% smaller
      </strong>
    </td>
  </tr>
  
  <tr>
    <td>
      TTI
    </td>
    
    <td>
      3.2s
    </td>
    
    <td>
      2.4s
    </td>
    
    <td>
      <strong>
        25% faster
      </strong>
    </td>
  </tr>
</tbody>
</table>

---

## FAQ: Nuxt 3 to Nuxt 4 Migration

### When is Nuxt 3 end of life?

**Nuxt 3 official support ends January 31, 2026.** After this date, there will be no security patches, bug fixes, or maintenance updates.

### How long does migration take?

For most projects: **4-8 hours** of active work, spread over 2-3 days for testing. Large enterprise applications may take 1-2 weeks.

### Is Nuxt 4 backward compatible?

**Mostly yes.** Nuxt 4 maintains compatibility with most Nuxt 3 APIs. The codemod tool handles most breaking changes automatically.

### What if my module isn't Nuxt 4 compatible?

Check for:

1. Module updates (many released Nuxt 4 versions)
2. Alternative modules
3. Native Nuxt 4 solutions (e.g., Nitro routes instead of middleware)

### Can I rollback if migration fails?

**Yes.** That's why we recommend creating a git branch first. You can always checkout your pre-migration code.

### Should new projects start with Nuxt 4?

**Absolutely.** Nuxt 4 is stable, production-ready, and the recommended version for all new projects in 2026.

### What about Nuxt 5?

Nuxt 5 is planned for late 2026 with Nitro v3. Nuxt 4 provides a stable foundation with a clear upgrade path to Nuxt 5.

---

## Next Steps

Now that you've migrated to Nuxt 4:

1. **Optimize Performance**: Read our [Nuxt 4 Performance Optimization Guide](https://mubaidr.js.org/blog/16-nuxt-4-ssr-performance-optimization)
2. **Explore New Features**: Check out [Nuxt UI v4](https://mubaidr.js.org/blog/24-nuxt-4-edge-computing-guide)
3. **Deploy to Edge**: Learn about [Edge Computing with Nuxt 4](https://mubaidr.js.org/blog/24-nuxt-4-edge-computing-guide)

---

## Need Help?

Migration issues? Drop a comment below or reach out on Twitter [@mubaidr](https://twitter.com/mubaidr).

**Resources:**

- [Official Nuxt 4 Migration Guide](https://nuxt.com/docs/getting-started/upgrade)
- [Nuxt 4 Release Notes](https://nuxt.com/blog/v4)
- [Codemod Tool](https://codemod.com/registry/nuxt-4-migration-recipe)
- [Nuxt Discord](https://discord.nuxt.com)

---

**Ready to migrate?** Start with the pre-migration checklist today, and you'll be running Nuxt 4 before the end of the week. Your future self (and your users) will thank you!

## Sitemap

See the full [sitemap](https://mubaidr.js.org/sitemap.md) for all pages.
