Nuxt is a higher-level Node.js web development framework for creating Vue apps that can be developed and deployed in two different modes: universal (SSR) or single-page application (SPA). Furthermore, you can deploy SSR and SPA in Nuxt as static-generated apps. Even though you can choose the SPA mode, the full power of Nuxt lies in its universal mode or server-side rendering (SSR) for building universal apps. A universal app is used to describe JavaScript code that can execute both on the client and the server-side. But if you wish to develop a classic (or standard/traditional) SPA, which executes on the client-side only, you may want to consider using vanilla Vue.
Nuxt is created on top of Vue, supercharged with some extra features such as asynchronous data, middleware, layouts, modules, and plugins that execute your app on the server-side first, and then on the client-side. This means the app generally renders quicker than the traditional server-side (or multiple-page) apps.
Nuxt is pre-installed with the following packages so that you don't have to install them, which you would do in a standard Vue app:
- Vue (https://vuejs.org/)
- Vue Router (https://router.vuejs.org/)
- Vuex (https://vuex.vuejs.org/)
- Vue Server Renderer (https://ssr.vuejs.org/)
- Vue Meta (https://vue-meta.nuxtjs.org/)
On top of that, Nuxt uses webpack and Babel to compile and bundle your code with the following webpack loaders:
- Vue Loader (https://vue-loader.vuejs.org/)
- Babel Loader (https://webpack.js.org/loaders/babel-loader/)
In a nutshell, webpack is a module bundler that bundles all the scripts, styles, assets, and images in your JavaScript app, while Babel is a JavaScript compiler that compiles or transpiles the next-generation JavaScript (ES2015+) to browser-compatible JavaScript (ES5) so that you can run your code on current browsers.
webpack uses what they call loaders to preprocess your files when you import them via the JavaScript import statement or require method. You can write your loaders but you don't have to do so when compiling your code in Vue files since they have been created for you by the Babel community and Vue team. We'll discover the great features that come with Nuxt and those contributed by these loaders in the next section.