docs(introduction): first batch of improvements

This commit is contained in:
Sébastien Chopin 2023-03-15 13:06:43 +01:00 committed by GitHub
parent 451b55ddbd
commit 98b9afa6d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,138 +1,51 @@
---
navigation.icon: uil:info-circle
description: Nuxt's goal is to make web development intuitive and performant with a great DX in mind.
description: Nuxt's goal is to make web development intuitive and performant with a great Developer Experience in mind.
---
<!-- markdownlint-disable -->
<!-- @case-police-disable -->
::docs-hero
---
image:
path: '/assets/docs/getting-started/views/hero'
width: '129'
height: '143'
format: 'png'
---
#title
Introduction
#description
Nuxt provides both frontend and backend functionality so you can focus on what matters: Creating your web application.
::
## What is Nuxt?
# Introduction
To understand what Nuxt is, we need to understand what we need in order to create a modern application:
::card-list
---
cardListClass: 'grid grid-cols-1 gap-y-2'
---
::card-item
---
gradientBorder: false
contentClass: 'gap-y-2'
bodyClass: 'p-4'
roundedClass: 'rounded-sm'
titleClass: 'text-base font-semibold u-text-gray-900'
---
#title
JavaScript framework
#description
A JavaScript framework to bring reactivity and web components, we chose Vue.js.
::
Nuxt is a free and [open-source framework](https://github.com/nuxt/nuxt) with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with [Vue.js](https://vuejs.org).
::card-item
---
gradientBorder: false
contentClass: 'gap-y-2'
bodyClass: 'p-4'
roundedClass: 'rounded-sm'
titleClass: 'text-base font-semibold u-text-gray-900'
---
#title
Webpack and Vite
#description
A bundler to support hot module replacement in development and bundle your code for production, we support both [webpack 5](https://webpack.js.org/) and [Vite](https://vitejs.dev/).
::
We made everything so you can start writing `.vue` files from the beggining while enjoying hot module replacement in development and a performant application in production with server-side rendering by default.
::card-item
---
gradientBorder: false
contentClass: 'gap-y-2'
bodyClass: 'p-4'
roundedClass: 'rounded-sm'
titleClass: 'text-base font-semibold u-text-gray-900'
---
#title
Latest JavaScript syntax
#description
A transpiler to write the latest JavaScript syntax while supporting legacy browsers, we use [esbuild](https://esbuild.github.io) for that.
::
Nuxt has no vendor lock-in, allowing you to deploy your application [**anywhere, even to the edge**](/docs/getting-started/deployment).
::card-item
---
gradientBorder: false
contentClass: 'gap-y-2'
bodyClass: 'p-4'
roundedClass: 'rounded-sm'
titleClass: 'text-base font-semibold u-text-gray-900'
---
#title
Server side
#description
A server for serving your application in development, but also to support [server-side rendering](https://vuejs.org/api/ssr.html#server-side-rendering-api) or API routes, Nuxt uses [h3](https://github.com/unjs/h3) for deployment versatility such as serverless, workers, Node.js and unmatched performance.
::
::card-item
---
gradientBorder: false
contentClass: 'gap-y-2'
bodyClass: 'p-4'
roundedClass: 'rounded-sm'
titleClass: 'text-base font-semibold u-text-gray-900'
---
#title
Routing library
#description
A routing library to handle client-side navigation, we chose [vue-router](https://router.vuejs.org/).
::
::
This is only the tip of the iceberg, imagine having to set up all of this for your project, make it work, and then, maintain it over time. We have been doing this since October 2016, tuning all the configurations to provide the best optimization and performance for any Vue application.
Nuxt takes care of this and provides both frontend and backend functionality so you can focus on what matters: **creating your web application**.
### View engine
Nuxt uses Vue.js as a view engine. All Vue 3 capabilities are available in Nuxt. You can read about the details of the Vue integration with Nuxt in the [Key Concepts section](/docs/guide/concepts/vuejs-development).
### Automation and conventions
## Automation and Conventions
Nuxt uses conventions and an opinionated directory structure to automate repetitive tasks and allow developers to focus on pushing features. The configuration file can still customize and override its default behaviors.
::list{type=success}
- Auto-imports
- File-system routing and API layer
- Data-fetching utilities
- Zero-config TypeScript support
- Configured build tools
- **File-based routing:** define routes based on the structure of your [`pages/` directory](/docs/guide/directory-structure/pages). This can make it easier to organize your application and avoid the need for manual route configuration.
- **Code splitting:** Nuxt automatically splits your code into smaller chunks, which can help reduce the initial load time of your application.
- **Server-side rendering out of the box:** Nuxt comes with built-in SSR capabilities, so you don't have to set up a separate server yourself.
- **Auto-imports:** write Vue composables and components in their respectives directories and use them without having to import them with the benefits of tree-shaking and optimised JS bundles.
- **Data-fetching utilities:** Nuxt provides composables to handle SSR-compatible data fetching as well as different strategies.
- **Zero-config TypeScript support:** write type-safe code without having to learn TypeScript with our auto-generated types and `tsconfig.json`
- **Configured build tools:** we use [Vite](https://vitejs.dev) by default to support hot module replacement (HMR) in development and bundling your code for production with best-practices baked-in.
::
::alert{type="info"}
Discover more in the [Key concepts section](/docs/guide/concepts/auto-imports).
::
Nuxt takes care of this and provides both frontend and backend functionality so you can focus on what matters: **creating your web application**.
### Rendering modes
## Server-Side Rendering
Nuxt offers different rendering modes to accommodate various use-cases:
Nuxt comes with built-in server-side rendering (SSR) capabilities by default, without having to configure a server yourself, which has many benefits for web applications:
::list{type=success}
- Universal rendering (Server-side rendering and hydration)
- Client-side only rendering
- Full Static site generation
- Hybrid rendering (per-routes caching strategy)
- **Faster initial page load time:** Nuxt sends a fully rendered HTML page to the browser, which can be displayed immediately. This can provide a faster perceived page load time and a better user experience (UX), especially on slower networks or devices.
- **Improved SEO:** search engines can better index SSR pages because the HTML content is available immediately, rather than requiring JavaScript to render the content on the client-side.
- **Better performance on low-powered devices:** it reduces the amount of JavaScript that needs to be downloaded and executed on the client-side, which can be beneficial for low-powered devices that may struggle with processing heavy JavaScript applications.
- **Better accessibility:** the content is immediately available on the initial page load, improving accessibility for users who rely on screen readers or other assistive technologies.
- **Easier caching:** pages can be cached on the server-side, which can further improve performance by reducing the amount of time it takes to generate and send the content to the client.
::
Overall, server-side rendering can provide a faster and more efficient user experience, as well as improve search engine optimization and accessibility.
As Nuxt is a versatile framework, it gives you the possibility to statically render your whole application to a static hosting with `nuxt generate`,
disable SSR globally with the `ssr: false` option or leverage hybrid rendering by setting up the `routeRules` option.
::alert{type="info"}
Read more about [Nuxt rendering modes](/docs/guide/concepts/rendering).
Read more about the [Nuxt rendering modes](/docs/guide/concepts/rendering).
::
### Server engine