Vue to NuxtJS

Free Vue to NuxtJS Code Converter

No email required. 100% free. Done in 30 seconds.

Transform your code from Vue to NuxtJS with our free AI-based code convertion tool. If you like what you see, we also create documentation for your code! We don't ever store your code or any representation of it in our databases, but it will be shared with the LLM of our choice for processing.

Other tools






Ionic + Angular










React Native


Ruby on Rails






How to convert from Vue to NuxtJS

Converting a Vue application to NuxtJS can be a fruitful endeavor, especially if you are looking to exploit the additional features and optimizations that NuxtJS brings to the table. Transitioning from a standard Vue project to NuxtJS might seem daunting at first. However, with this step-by-step guide, you’ll be able to smoothly transition your project while understanding the benefits and changes involved.

Reasons to Convert from Vue to NuxtJS

Before diving into the conversion process, it is essential to understand why you might want to move from Vue to NuxtJS. Some of the key reasons include:

  • Server-Side Rendering (SSR): NuxtJS offers built-in SSR support which enhances the SEO performance of your application.
  • Better Routing: NuxtJS provides an automatic routing feature, alleviating the need to manually configure routes.
  • Static Site Generation (SSG): Create static sites with enhanced loading speed and performance.
  • Modular Architecture: NuxtJS uses a modular approach that can help improve code maintainability and scalability.

Setting Up NuxtJS

Initial Setup

The first step in converting your Vue project to NuxtJS is setting up a new NuxtJS project. You can initialize a NuxtJS project using the following command:

npx create-nuxt-app <project-name>

Follow the interactive CLI to set up your new NuxtJS project. Once the setup is complete, navigate to the newly created directory.

cd <project-name>

Project Structure Adjustment

NuxtJS has a different project structure compared to a traditional Vue application. Here are some major points to consider:

  • Pages Directory: Move your Vue components intended to act as views or pages into the pages directory. NuxtJS uses the pages directory to create automatically generated routes.

  • Layouts Directory: NuxtJS introduces the layouts directory to define layout components for different sections of your application.

  • Store Directory: If your Vue application uses Vuex for state management, migrate your Vuex store modules to the store directory.

Example - Migrating a Vue Component to NuxtJS Page

If you have a Vue component named Home.vue in your Vue project, you will need to move it to the pages directory in your NuxtJS project and rename it according to the route you want it to serve as, for example as index.vue.

// Vue (Home.vue)
    <h1>Welcome to our Home Page</h1>

export default {
  name: 'Home'

// NuxtJS (pages/index.vue)
    <h1>Welcome to our Home Page</h1>

export default {
  name: 'Home'

Handling Routes in NuxtJS

One of the standout features of NuxtJS is its automatic routing mechanism. In Vue, you would typically define your routes manually in a separate file, often router.js. In NuxtJS, routes are automatically generated based on the files within the pages directory.

Dynamic Routes

For dynamic routes in Vue, you might use a route configuration like this:

// Vue (router.js)
  path: '/user/:id',
  component: User

In NuxtJS, simply create a Vue file with a dynamic parameter:

// NuxtJS (pages/user/_id.vue)
    <h1>User ID: {{ $ }}</h1>

Plugins and Middleware


NuxtJS maintains a plugins directory meant for including JavaScript plugins that need to be run before mounting the root Vue application:

// Vue (main.js)
import Vue from 'vue'
import Plugin from './plugin'

// NuxtJS (plugins/plugin.js)
import Vue from 'vue'
import Plugin from '~/plugin'

Ensure you configure the plugin in nuxt.config.js:

// nuxt.config.js
export default {
  plugins: [


In Vue, you would use navigation guards for route protection:

// Vue (router.js)
router.beforeEach((to, from, next) => {
  // Your guard logic

In NuxtJS, you can use middleware:

// NuxtJS (middleware/auth.js)
export default function (context) {
  // Your guard logic

// In nuxt.config.js
export default {
  router: {
    middleware: 'auth'


Transitioning from Vue to NuxtJS requires a good understanding of how NuxtJS enhances typical Vue functionalities and organizes its project structure. This guide has detailed the main aspects to focus on: the setup, project structure, automatic routing, and handling plugins and middleware. By following these steps, your migration from Vue to NuxtJS should be efficient, enabling you to leverage the power of NuxtJS in your next project!

Document your code using AI

Sign up now
& free your developers' time

Start for free

Join thousands of companies documenting their code using AI.

Frequently Asked Questions

This free AI tool does its best to generate professional documentation. However, it's missing some context from other related files. The paid version takes into account different files to generate documentation for each use case, apart from the documentation of every file. You have also the possibility of add custom concepts to improve the knowledge of your codebase.

No. You don't have to enter any personal information to use Codex's free code documentation tool — it's 100% free.

No. An encrypted version of your code is stored only while its being processed and it's deleted immediately.

If you can work with a custom Azure model in your own account, let us know. If not, Codex also works with open source models that can run on-premises, on your own servers, so your data is always yours. Feel free to get in touch with us!