Development·

How to Upgrade Nuxt 3 to 4 in Under 10 Minutes – A Clear Guide

Don't let your project fall behind. Learn how to upgrade Nuxt 3 to 4 with this step-by-step migration guide. Optimize your project structure and boost performance today.

Is your Nuxt app feeling a bit outdated? With the release of Nuxt 4, the framework has introduced a significant shift in how projects are structured and managed. While "major version" updates can feel scary, the process to upgrade Nuxt 3 to 4 is surprisingly straightforward.

Nuxt 4 brings better performance, a cleaner directory structure, and a vastly improved developer experience. In this guide, we will show you exactly how to migrate to Nuxt 4 safely and quickly.


Why Should You Migrate to Nuxt 4 Now?

Waiting to modernize your Nuxt app only makes it harder as your codebase grows. By upgrading now, you get:

  • The "app/" Directory: A much cleaner root folder that separates your business logic from your configuration.
  • Improved Type Safety: Better error catching while you write code.
  • Faster Cold Starts: Your development environment will feel snappier.

Step 1: Update Your Dependencies

The first step is to pull in the latest Nuxt package. Open your terminal and run:

# Using npm
npm install nuxt@latest

# Using pnpm
pnpm add nuxt@latest

This ensures you have the latest core binaries ready to handle the transformation.


Step 2: Enable the Nuxt 4 Compatibility Version

Nuxt 4 allows you to transition gradually. In your nuxt.config.ts file, you can set the compatibility version to 4. This prepares your project for the new behaviors.

export default defineNuxtConfig({
    future: {
        compatibilityVersion: 4,
    },
});

Step 3: Shift to the New Directory Structure

The biggest change in Nuxt 4 is the Nuxt 4 directory structure. Instead of having pages/, components/, and composables/ in the root, they now live inside an app/ folder.

  1. Create an app/ folder in your root directory.
  2. Move your pages/, layouts/, components/, composables/, middleware/, and plugins/ folders into it.
  3. Rename app.vue to app/app.vue (if applicable).

This separation keeps your root directory clean and focused on environment configuration.


Step 4: Handle Nuxt 4 Breaking Changes

While the migration tool handles most of the heavy lifting, you should manually check for common Nuxt 4 breaking changes:

  • Scanning Changes: Nuxt 4 is more strict about where it looks for files. If you have custom directories, you may need to register them in your config.
  • Imports: Ensure you aren't using deep imports from internal Nuxt packages that may have moved.
  • Layer Compatibility: If you use Nuxt Layers, ensure they also have the compatibilityVersion: 4 flag.

Step 5: Test and Verify

Now, fire up your development server.

npm run dev

Watch the terminal for any warnings or errors. If everything looks good, run your build command to ensure the production bundle is also generated without issues.


Ready for a Fresh Start?

If your Nuxt 3 project is too messy to upgrade, sometimes a fresh start is the best path forward.

ShipAhead is built from the ground up on Nuxt 4. It includes all the best practices, the new directory structure, and modern auth integrated out of the box. Skip the migration headache and start building with the latest technology today.


Final Thoughts

The jump to Nuxt 4 is a major step forward for the Vue ecosystem. It simplifies your project and prepares you for the next few years of web development. Don't let your tech debt stay high—Upgrade Nuxt 3 to 4 today and enjoy a faster development workflow.

Stop waiting and start shipping

Don't waste another week on setup. Everything is ready for you to launch your idea in days.