From 5bf393305ca98390c546feae427c58e91efb5cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Thu, 22 Sep 2022 15:45:21 +0200 Subject: [PATCH 01/13] docs: move node deployment to getting started --- .../1.node-server.md => 1.getting-started/10.deployment.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/content/{2.guide/3.deploy/1.node-server.md => 1.getting-started/10.deployment.md} (100%) diff --git a/docs/content/2.guide/3.deploy/1.node-server.md b/docs/content/1.getting-started/10.deployment.md similarity index 100% rename from docs/content/2.guide/3.deploy/1.node-server.md rename to docs/content/1.getting-started/10.deployment.md From 94348c92422e66b6fe6d8f195e6d734c19ed4252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Thu, 22 Sep 2022 16:58:56 +0200 Subject: [PATCH 02/13] docs: merge deployments pages --- .../1.getting-started/10.deployment.md | 127 +++++++++++++++++- .../2.guide/3.deploy/2.static-hosting.md | 38 ------ docs/content/2.guide/3.deploy/3.presets.md | 37 ----- docs/content/2.guide/3.deploy/index.md | 7 - .../content/2.guide/3.deploy/providers/aws.md | 11 -- .../2.guide/3.deploy/providers/azure.md | 18 --- .../2.guide/3.deploy/providers/cloudflare.md | 18 --- .../3.deploy/providers/digitalocean.md | 11 -- .../2.guide/3.deploy/providers/firebase.md | 15 --- .../2.guide/3.deploy/providers/heroku.md | 11 -- .../2.guide/3.deploy/providers/index.md | 3 - .../2.guide/3.deploy/providers/layer0.md | 13 -- .../2.guide/3.deploy/providers/netlify.md | 41 ------ .../2.guide/3.deploy/providers/render.md | 11 -- .../2.guide/3.deploy/providers/stormkit.md | 11 -- .../2.guide/3.deploy/providers/vercel.md | 41 ------ docs/static/_redirects | 15 +++ 17 files changed, 135 insertions(+), 293 deletions(-) delete mode 100644 docs/content/2.guide/3.deploy/2.static-hosting.md delete mode 100644 docs/content/2.guide/3.deploy/3.presets.md delete mode 100644 docs/content/2.guide/3.deploy/index.md delete mode 100644 docs/content/2.guide/3.deploy/providers/aws.md delete mode 100644 docs/content/2.guide/3.deploy/providers/azure.md delete mode 100644 docs/content/2.guide/3.deploy/providers/cloudflare.md delete mode 100644 docs/content/2.guide/3.deploy/providers/digitalocean.md delete mode 100644 docs/content/2.guide/3.deploy/providers/firebase.md delete mode 100644 docs/content/2.guide/3.deploy/providers/heroku.md delete mode 100644 docs/content/2.guide/3.deploy/providers/index.md delete mode 100644 docs/content/2.guide/3.deploy/providers/layer0.md delete mode 100644 docs/content/2.guide/3.deploy/providers/netlify.md delete mode 100644 docs/content/2.guide/3.deploy/providers/render.md delete mode 100644 docs/content/2.guide/3.deploy/providers/stormkit.md delete mode 100644 docs/content/2.guide/3.deploy/providers/vercel.md diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index bfedf7f407f..d82c0c7c87d 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -1,4 +1,8 @@ -# Node.js Server +# Deployment + +A Nuxt application can be deployed on a Node or Deno server, pre-rendered to be hosted in static environments, or deployed to serverless and edge providers. + +## Node.js Server Discover the Node.js server preset with Nitro to deploy on any Node hosting. @@ -9,7 +13,7 @@ Discover the Node.js server preset with Nitro to deploy on any Node hosting. - Useful for deploying Nuxt apps to any Node.js hosting :: -## Entry Point +### Entry Point When running `nuxt build` with the Node server preset, the result will be an entry point that launches a ready-to-run Node server. @@ -17,14 +21,14 @@ When running `nuxt build` with the Node server preset, the result will be an ent node .output/server/index.mjs ``` -## Example +### Example ```bash $ node .output/server/index.mjs Listening on http://localhost:3000 ``` -## Configuring Defaults at Runtime +### Configuring Defaults at Runtime This preset will respect the following runtime environment variables: @@ -32,7 +36,7 @@ This preset will respect the following runtime environment variables: - `NITRO_HOST` or `HOST` (defaults to `'0.0.0.0'`) - `NITRO_SSL_CERT` and `NITRO_SSL_KEY` - if both are present, this will launch the server in HTTPS mode. In the vast majority of cases, this should not be used other than for testing, and the Nitro server should be run behind a reverse proxy like nginx or Cloudflare which terminates SSL. -### Using PM2 +#### Using PM2 To use `pm2`, use an `ecosystem.config.js`: @@ -49,12 +53,121 @@ module.exports = { } ``` -### Using Cluster Mode +#### Using Cluster Mode You can use `NITRO_PRESET=node_cluster` in order to leverage multi-process performance using Node.js [cluster](https://nodejs.org/dist/latest/docs/api/cluster.html) module. By default, the workload gets distributed to the workers with the round robin strategy. -## Learn More +### Learn More :ReadMore{link="https://nitro.unjs.io/deploy/node" title="the Nitro documentation for node-server preset"} + +## Static Hosting + +There are two ways to deploy a Nuxt application to any static hosting services: + +- Static site generation (SSG) prerenders every route of your application at build time. For every page, Nuxt uses a crawler to generate a corresponding HTML and payload files. +- Using `ssr: false` to produce a pure client-side output. + +### Prerendering + +Use the [`nuxi generate` command](/api/commands/generate) to build your application. The HTML files will be generated in the `.output/public` directory. + +```bash +npx nuxi generate +``` + +### Client-side Only Rendering + +If you don't want to prerender your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. + +```ts [nuxt.config.ts|js] +defineNuxtConfig({ + ssr: false +}) +``` + +### Advanced + +You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and prerender during the build. + +```ts [nuxt.config.ts|js] +defineNuxtConfig({ + nitro: { + prerender: { + routes: ['/user/1', '/user/2'] + } + } +}) +``` + +### Prerendering + +Use the [`nuxi generate` command](/api/commands/generate) to build your application. The HTML files will be generated in the `.output/public` directory. + +```bash +npx nuxi generate +``` + +### Client-side Only Rendering + +If you don't want to prerender your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. + +```ts [nuxt.config.ts|js] +defineNuxtConfig({ + ssr: false +}) +``` + +### Advanced + +You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and prerender during the build. + +```ts [nuxt.config.ts|js] +defineNuxtConfig({ + nitro: { + prerender: { + routes: ['/user/1', '/user/2'] + } + } +}) +``` + +## Presets + +In addition to Node.js servers and static hosting services, a Nuxt 3 project can be deployed with several well-tested presets and minimal amount of configuration. + +You can use the [Nuxt config](/guide/directory-structure/nuxt.config) to explicitly set the preset to use: + +```js [nuxt.config.js|ts] +export default { + nitro: { + preset: 'node-server' + } +} +``` + +Or directly use the `NITRO_PRESET` environment variable when running `nuxt build`: + +```bash +NITRO_PRESET=node-server nuxt build +``` + +🔎 Check [the Nitro deployment](https://nitro.unjs.io/deploy) for all possible deployment presets and providers. + +### Supported Hosting Providers + +Nuxt 3 can be deployed to several cloud providers with a minimal amount of configuration: + +- :IconCloud{class="h-5 w-4 inline mb-2"} [AWS](https://nitro.unjs.io/deploy/providers/aws) +- :LogoAzure{class="h-5 w-4 inline mb-2"} [Azure](https://nitro.unjs.io/deploy/providers/azure) +- :LogoCloudFlare{class="h-5 w-4 inline mb-2"} [CloudFlare](https://nitro.unjs.io/deploy/providers/cloudflare) +- :IconCloud{class="h-5 w-4 inline mb-2"} [Digital Ocean](https://nitro.unjs.io/deploy/providers/digitalocean) +- :LogoFirebase{class="h-5 w-4 inline mb-2"} [Firebase](https://nitro.unjs.io/deploy/providers/firebase) +- :IconCloud{class="h-5 w-4 inline mb-2"} [heroku](https://nitro.unjs.io/deploy/providers/heroku) +- :IconCloud{class="h-5 w-4 inline mb-2"} [layer0](https://nitro.unjs.io/deploy/providers/layer0) +- :LogoNetlify{class="h-5 w-4 inline mb-2"} [Netlify](https://nitro.unjs.io/deploy/providers/netlify) +- :IconCloud{class="h-5 w-4 inline mb-2"} [Render](https://nitro.unjs.io/deploy/providers/render) +- :IconCloud{class="h-5 w-4 inline mb-2"} [Stormkit](https://nitro.unjs.io/deploy/providers/stormkit) +- :LogoVercel{class="h-5 w-4 inline mb-2"} [Vercel](https://nitro.unjs.io/deploy/providers/vercel) diff --git a/docs/content/2.guide/3.deploy/2.static-hosting.md b/docs/content/2.guide/3.deploy/2.static-hosting.md deleted file mode 100644 index 9d8fe1d09e0..00000000000 --- a/docs/content/2.guide/3.deploy/2.static-hosting.md +++ /dev/null @@ -1,38 +0,0 @@ -# Static Hosting - -There are two ways to deploy a Nuxt application to any static hosting services: - -- Static site generation (SSG) prerenders every route of your application at build time. For every page, Nuxt uses a crawler to generate a corresponding HTML and payload files. -- Using `ssr: false` to produce a pure client-side output. - -## Prerendering - -Use the [`nuxi generate` command](/api/commands/generate) to build your application. The HTML files will be generated in the `.output/public` directory. - -```bash -npx nuxi generate -``` - -## Client-side Only Rendering - -If you don't want to prerender your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. - -```ts [nuxt.config.ts|js] -defineNuxtConfig({ - ssr: false -}) -``` - -## Advanced - -You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and prerender during the build. - -```ts [nuxt.config.ts|js] -defineNuxtConfig({ - nitro: { - prerender: { - routes: ['/user/1', '/user/2'] - } - } -}) -``` diff --git a/docs/content/2.guide/3.deploy/3.presets.md b/docs/content/2.guide/3.deploy/3.presets.md deleted file mode 100644 index e4a38aa8d71..00000000000 --- a/docs/content/2.guide/3.deploy/3.presets.md +++ /dev/null @@ -1,37 +0,0 @@ -# Deployment Presets - -In addition to Node.js servers and static hosting services, a Nuxt 3 project can be deployed with several well-tested presets and minimal amount of configuration. - -You can use the [Nuxt config](/guide/directory-structure/nuxt.config) to explicitly set the preset to use: - -```js [nuxt.config.js|ts] -export default { - nitro: { - preset: 'node-server' - } -} -``` - -Or directly use the `NITRO_PRESET` environment variable when running `nuxt build`: - -```bash -NITRO_PRESET=node-server nuxt build -``` - -🔎 Check [the Nitro deployment](https://nitro.unjs.io/deploy) for all possible deployment presets and providers. - -## Supported Hosting Providers - -Nuxt 3 can be deployed to several cloud providers with a minimal amount of configuration: - -- :IconCloud{class="h-5 w-4 inline mb-2"} [AWS](/guide/deploy/providers/aws) -- :LogoAzure{class="h-5 w-4 inline mb-2"} [Azure](/guide/deploy/providers/azure) -- :LogoCloudFlare{class="h-5 w-4 inline mb-2"} [CloudFlare](/guide/deploy/providers/cloudflare) -- :IconCloud{class="h-5 w-4 inline mb-2"} [Digital Ocean](/guide/deploy/providers/digitalocean) -- :LogoFirebase{class="h-5 w-4 inline mb-2"} [Firebase](/guide/deploy/providers/firebase) -- :IconCloud{class="h-5 w-4 inline mb-2"} [heroku](/guide/deploy/providers/heroku) -- :IconCloud{class="h-5 w-4 inline mb-2"} [layer0](/guide/deploy/providers/layer0) -- :LogoNetlify{class="h-5 w-4 inline mb-2"} [Netlify](/guide/deploy/providers/netlify) -- :IconCloud{class="h-5 w-4 inline mb-2"} [Render](/guide/deploy/providers/render) -- :IconCloud{class="h-5 w-4 inline mb-2"} [Stormkit](/guide/deploy/providers/stormkit) -- :LogoVercel{class="h-5 w-4 inline mb-2"} [Vercel](/guide/deploy/providers/vercel) diff --git a/docs/content/2.guide/3.deploy/index.md b/docs/content/2.guide/3.deploy/index.md deleted file mode 100644 index b5130f0ce88..00000000000 --- a/docs/content/2.guide/3.deploy/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -layout: - aside: true - asideClass: '' -navigation: - redirect: /guide/deploy/node-server ---- diff --git a/docs/content/2.guide/3.deploy/providers/aws.md b/docs/content/2.guide/3.deploy/providers/aws.md deleted file mode 100644 index b4d63cd1919..00000000000 --- a/docs/content/2.guide/3.deploy/providers/aws.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -icon: IconCloud ---- - -# AWS - -How to deploy Nuxt to [AWS Lambda](https://aws.amazon.com/lambda/) - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/aws" title="the Nitro documentation for AWS deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/azure.md b/docs/content/2.guide/3.deploy/providers/azure.md deleted file mode 100644 index 1de4e4ef72b..00000000000 --- a/docs/content/2.guide/3.deploy/providers/azure.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -icon: LogoAzure ---- - -# Azure - -How to deploy to [Azure Static Web Apps](https://azure.microsoft.com/en-us/services/app-service/static/) or [Azure Functions](https://azure.microsoft.com/en-us/services/functions). - -::list - -- Support for serverless SSR build -- Auto-detected when deploying -- Minimal configuration required -:: - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/azure" title="the Nitro documentation for Azure deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/cloudflare.md b/docs/content/2.guide/3.deploy/providers/cloudflare.md deleted file mode 100644 index 4ae61ed8102..00000000000 --- a/docs/content/2.guide/3.deploy/providers/cloudflare.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -icon: LogoCloudFlare ---- - -# Cloudflare Workers - -How to deploy Nuxt to [Cloudflare Workers](https://workers.cloudflare.com/). - -::list - -- Support for Workers build output -- Zero-millisecond cold start with edge-side rendering -- Minimal configuration required -:: - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/cloudflare" title="the Nitro documentation for Cloudflare deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/digitalocean.md b/docs/content/2.guide/3.deploy/providers/digitalocean.md deleted file mode 100644 index 6dca370b319..00000000000 --- a/docs/content/2.guide/3.deploy/providers/digitalocean.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -icon: IconCloud ---- - -# DigitalOcean - -Nitro supports deploying on the [Digital Ocean App Platform](https://docs.digitalocean.com/products/app-platform/) with minimal configuration. - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/digitalocean" title="the Nitro documentation for DigitalOcean deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/firebase.md b/docs/content/2.guide/3.deploy/providers/firebase.md deleted file mode 100644 index 40a0d83007d..00000000000 --- a/docs/content/2.guide/3.deploy/providers/firebase.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -icon: LogoFirebase ---- - -# Firebase Hosting - -How to deploy Nuxt to [Firebase Hosting](https://firebase.google.com/docs/hosting). - -Nitro supports [Firebase Hosting](https://firebase.google.com/docs/hosting) with Cloud Functions out of the box. - -**Note**: You need to be on the **Blaze plan** to use Nitro with Cloud Functions. - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/firebase" title="the Nitro documentation for Firebase deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/heroku.md b/docs/content/2.guide/3.deploy/providers/heroku.md deleted file mode 100644 index e74b8a9b66e..00000000000 --- a/docs/content/2.guide/3.deploy/providers/heroku.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -icon: IconCloud ---- - -# Heroku - -How to deploy Nuxt to [Heroku](https://www.heroku.com/). - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/heroku" title="the Nitro documentation for Heroku deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/index.md b/docs/content/2.guide/3.deploy/providers/index.md deleted file mode 100644 index dc762ec9a6c..00000000000 --- a/docs/content/2.guide/3.deploy/providers/index.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -navigation: false ---- diff --git a/docs/content/2.guide/3.deploy/providers/layer0.md b/docs/content/2.guide/3.deploy/providers/layer0.md deleted file mode 100644 index 2d9718a001a..00000000000 --- a/docs/content/2.guide/3.deploy/providers/layer0.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -icon: IconCloud ---- - -# Layer0 - -Nitro provides a built-in preset to generate output format compatible with [Layer0](https://www.layer0.co/). - -Layer0 extends the capabilities of a traditional CDN by not only hosting your static content, but also providing server-side rendering for progressive web applications as well as caching both your APIs and HTML at the network edge to provide your users with the fastest browsing experience. - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/layer0" title="the Nitro documentation for Layer0 deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/netlify.md b/docs/content/2.guide/3.deploy/providers/netlify.md deleted file mode 100644 index 1e244add255..00000000000 --- a/docs/content/2.guide/3.deploy/providers/netlify.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -icon: LogoNetlify ---- - -# Netlify - -How to deploy Nuxt to [Netlify](https://www.netlify.com/). - -::list - -- Support for serverless SSR using Netlify Functions and Edge -- Auto-detected when deploying -- No configuration required - -:: - -## Setup - -Normally, the deployment to Netlify does not require any configuration. Nuxt will auto-detect that you are in a [Netlify](https://www.netlify.com) build environment and build the correct version of your Nuxt server. For new sites, Netlify will detect that you are using Nuxt and set the publish directory to `dist` and build command to `npm run build`. If you are upgrading an existing site, you should check these and update them if needed. - -To trigger a deploy, just push to your git repository [as you would normally do for Netlify](https://docs.netlify.com/configure-builds/get-started/). - -By default, Nuxt will server-render each page on server hit using [Netlify Functions](https://docs.netlify.com/functions/overview/). You can optionally configure deployment to use [Netlify Edge Functions](https://docs.netlify.com/netlify-labs/experimental-features/edge-functions/) or [Netlify On-demand Builders](https://docs.netlify.com/configure-builds/on-demand-builders/). - -## Netlify Edge Functions - -[Netlify Edge Functions](https://docs.netlify.com/netlify-labs/experimental-features/edge-functions/) use [Deno](https://deno.land) and the powerful V8 JavaScript runtime to let you run globally distributed functions for the fastest possible response times. Nuxt output can directly run the server at the edge - closer to your users! - -Read more in the [Netlify Edge Functions announcement](https://www.netlify.com/blog/announcing-serverless-compute-with-edge-functions). - -## On-demand Builders - -[Netlify On-demand Builders](https://docs.netlify.com/configure-builds/on-demand-builders/) are serverless functions used to generate web content as needed that’s automatically cached on Netlify’s Edge CDN. They enable you to build pages for your site when a user visits them for the first time and then cache them at the edge for subsequent visits (also known as Incremental Static Regeneration). - -## Custom Redirects - -If you want to add custom redirects, you can do so by adding a [`_redirects`](https://docs.netlify.com/routing/redirects/#syntax-for-the-redirects-file) file in the [`public`](/guide/directory-structure/public) directory. - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/netlify" title="the Nitro documentation for Netlify deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/render.md b/docs/content/2.guide/3.deploy/providers/render.md deleted file mode 100644 index 8ce480e61e3..00000000000 --- a/docs/content/2.guide/3.deploy/providers/render.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -icon: IconCloud ---- - -# Render - -How to deploy Nuxt to [Render](https://render.com/) - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/render" title="the Nitro documentation for Render deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/stormkit.md b/docs/content/2.guide/3.deploy/providers/stormkit.md deleted file mode 100644 index 6ba1b1fadb4..00000000000 --- a/docs/content/2.guide/3.deploy/providers/stormkit.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -icon: IconCloud ---- - -# StormKit - -How to deploy Nuxt to [StormKit](https://app.stormkit.io/?referral=nuxtjs). - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/stormkit" title="the Nitro documentation for StormKit deployment"} diff --git a/docs/content/2.guide/3.deploy/providers/vercel.md b/docs/content/2.guide/3.deploy/providers/vercel.md deleted file mode 100644 index 9d0ae05c838..00000000000 --- a/docs/content/2.guide/3.deploy/providers/vercel.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -icon: LogoVercel ---- - -# Vercel - -Nuxt on Vercel supports server-rendered pages and API routes. - -::list - -- Support for serverless build -- Auto-detected when deploying -- No configuration required -:: - -## Git - -1. Push your code to your git repository (GitHub, GitLab, Bitbucket). -2. [Import your project](https://vercel.com/new) into Vercel. -3. Vercel will detect that you are using Nuxt and will enable the correct settings for your deployment. -4. Your application is deployed! (e.g. [nuxt.vercel.app](https://nuxt.vercel.app/)) - -After your project has been imported and deployed, all subsequent pushes to branches will generate [Preview Deployments](https://vercel.com/docs/concepts/deployments/environments#preview), and all changes made to the Production Branch (commonly “main”) will result in a [Production Deployment](https://vercel.com/docs/concepts/deployments/environments#production). - -Learn more about Vercel’s [Git Integration](https://vercel.com/docs/concepts/git). - -## CLI - -1. Install the [Vercel CLI](https://vercel.com/cli). -2. Vercel will detect that you are using Nuxt and will enable the correct settings for your deployment. -3. Your application is deployed! (e.g. [nuxt.vercel.app](https://nuxt.vercel.app/)) - -```bash -npm i -g vercel -npx nuxi init -t v3-vercel -vercel -``` - -## Learn More - -:ReadMore{link="https://nitro.unjs.io/deploy/providers/vercel" title="the Nitro documentation for Vercel deployment"} diff --git a/docs/static/_redirects b/docs/static/_redirects index 27a1ba68501..d3bd8e5a23d 100644 --- a/docs/static/_redirects +++ b/docs/static/_redirects @@ -48,3 +48,18 @@ /guide/features/app-config /guide/directory-structure/app.config 302! /guide/features/runtime-config /guide/going-further/runtime-config 302! /guide/features/teleports /api/components/teleports 302! + +/guide/deploy/node-server /getting-started/deployment 302! +/guide/deploy/static-hosting /getting-started/deployment 302! +/guide/deploy/presets /getting-started/deployment 302! +/guide/deploy/providers/aws https://nitro.unjs.io/deploy/providers/aws 302! +/guide/deploy/providers/azure https://nitro.unjs.io/deploy/providers/azure 302! +/guide/deploy/providers/cloudflare https://nitro.unjs.io/deploy/providers/cloudflare 302! +/guide/deploy/providers/digitalocean https://nitro.unjs.io/deploy/providers/digitalocean 302! +/guide/deploy/providers/firebase https://nitro.unjs.io/deploy/providers/firebase 302! +/guide/deploy/providers/heroku https://nitro.unjs.io/deploy/providers/heroku 302! +/guide/deploy/providers/layer0 https://nitro.unjs.io/deploy/providers/layer0 302! +/guide/deploy/providers/netlify https://nitro.unjs.io/deploy/providers/netlify 302! +/guide/deploy/providers/render https://nitro.unjs.io/deploy/providers/render 302! +/guide/deploy/providers/stormkit https://nitro.unjs.io/deploy/providers/stormkit 302! +/guide/deploy/providers/vercel https://nitro.unjs.io/deploy/providers/vercel 302! From 2c9d78cb274428e97bafe04925caa771ec8925e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Thu, 22 Sep 2022 17:11:51 +0200 Subject: [PATCH 03/13] docs: lint --- .../1.getting-started/10.deployment.md | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index d82c0c7c87d..569391491ed 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -102,38 +102,6 @@ defineNuxtConfig({ }) ``` -### Prerendering - -Use the [`nuxi generate` command](/api/commands/generate) to build your application. The HTML files will be generated in the `.output/public` directory. - -```bash -npx nuxi generate -``` - -### Client-side Only Rendering - -If you don't want to prerender your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. - -```ts [nuxt.config.ts|js] -defineNuxtConfig({ - ssr: false -}) -``` - -### Advanced - -You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and prerender during the build. - -```ts [nuxt.config.ts|js] -defineNuxtConfig({ - nitro: { - prerender: { - routes: ['/user/1', '/user/2'] - } - } -}) -``` - ## Presets In addition to Node.js servers and static hosting services, a Nuxt 3 project can be deployed with several well-tested presets and minimal amount of configuration. From 173609fd7687fdf1fc9f30d7203c0a246f46e74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 07:57:50 +0200 Subject: [PATCH 04/13] Update docs/content/1.getting-started/10.deployment.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com> --- docs/content/1.getting-started/10.deployment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 569391491ed..286276632c7 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -67,10 +67,10 @@ By default, the workload gets distributed to the workers with the round robin st There are two ways to deploy a Nuxt application to any static hosting services: -- Static site generation (SSG) prerenders every route of your application at build time. For every page, Nuxt uses a crawler to generate a corresponding HTML and payload files. +- Static site generation (SSG) pre-renders every route of your application at build time. For every page, Nuxt uses a crawler to generate a corresponding HTML and payload files. - Using `ssr: false` to produce a pure client-side output. -### Prerendering +### Pre-rendering Use the [`nuxi generate` command](/api/commands/generate) to build your application. The HTML files will be generated in the `.output/public` directory. From a2616bfddbb65650c07a91a2f1a66842be45bf2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 07:57:57 +0200 Subject: [PATCH 05/13] Update docs/content/1.getting-started/10.deployment.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com> --- docs/content/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 286276632c7..0f55cf5a8f7 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -80,7 +80,7 @@ npx nuxi generate ### Client-side Only Rendering -If you don't want to prerender your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. +If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. ```ts [nuxt.config.ts|js] defineNuxtConfig({ From 9cdc32c631307d212f22fb139dbb56b4732c3ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 07:58:04 +0200 Subject: [PATCH 06/13] Update docs/content/1.getting-started/10.deployment.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com> --- docs/content/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 0f55cf5a8f7..3deecf4a92e 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -90,7 +90,7 @@ defineNuxtConfig({ ### Advanced -You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and prerender during the build. +You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and pre-render during the build. ```ts [nuxt.config.ts|js] defineNuxtConfig({ From dd496b22060d3337be095ad12250d10bda86ab32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 07:58:18 +0200 Subject: [PATCH 07/13] Update docs/content/1.getting-started/10.deployment.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com> --- docs/content/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 3deecf4a92e..29bb6daef2f 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -106,7 +106,7 @@ defineNuxtConfig({ In addition to Node.js servers and static hosting services, a Nuxt 3 project can be deployed with several well-tested presets and minimal amount of configuration. -You can use the [Nuxt config](/guide/directory-structure/nuxt.config) to explicitly set the preset to use: +You can explicitly set the desired preset in the [`nuxt.config`](/guide/directory-structure/nuxt.config) file: ```js [nuxt.config.js|ts] export default { From 1873b2c0fa62b17c4e060aaa5733a2b14f44efc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 07:58:30 +0200 Subject: [PATCH 08/13] Update docs/content/1.getting-started/10.deployment.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com> --- docs/content/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 29bb6daef2f..e23f46e36b5 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -116,7 +116,7 @@ export default { } ``` -Or directly use the `NITRO_PRESET` environment variable when running `nuxt build`: +... or use the `NITRO_PRESET` environment variable when running `nuxt build`: ```bash NITRO_PRESET=node-server nuxt build From 84cb4702e3411275a064b914db5f6b8a22f0283c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 09:42:00 +0200 Subject: [PATCH 09/13] docs(deployment): add short link to cloud hosting section --- docs/content/1.getting-started/10.deployment.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 569391491ed..a150e90740d 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -2,6 +2,10 @@ A Nuxt application can be deployed on a Node or Deno server, pre-rendered to be hosted in static environments, or deployed to serverless and edge providers. +::alert{type=info} +If you are looking for a list of cloud providers that support Nuxt 3, see the [list below](#supported-hosting-providers). +:: + ## Node.js Server Discover the Node.js server preset with Nitro to deploy on any Node hosting. From db5cccb163abd4249cccd163af898cd4f7da914d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 09:47:39 +0200 Subject: [PATCH 10/13] docs(deployment): restructure pre-rendering section --- .../1.getting-started/10.deployment.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 7d078cbff73..e45287393dc 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -71,38 +71,38 @@ By default, the workload gets distributed to the workers with the round robin st There are two ways to deploy a Nuxt application to any static hosting services: -- Static site generation (SSG) pre-renders every route of your application at build time. For every page, Nuxt uses a crawler to generate a corresponding HTML and payload files. +- Static site generation (SSG) pre-renders routes of your application at build time. - Using `ssr: false` to produce a pure client-side output. -### Pre-rendering +### Crawl-based Pre-rendering -Use the [`nuxi generate` command](/api/commands/generate) to build your application. The HTML files will be generated in the `.output/public` directory. +Use the [`nuxi generate` command](/api/commands/generate) to build your application. For every page, Nuxt uses a crawler to generate a corresponding HTML and payload files. The built files will be generated in the `.output/public` directory. ```bash npx nuxi generate ``` -### Client-side Only Rendering +### Manual Pre-rendering -If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. +You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and pre-render during the build. ```ts [nuxt.config.ts|js] defineNuxtConfig({ - ssr: false + nitro: { + prerender: { + routes: ['/user/1', '/user/2'] + } + } }) ``` -### Advanced +### Client-side Only Rendering -You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and pre-render during the build. +If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. ```ts [nuxt.config.ts|js] defineNuxtConfig({ - nitro: { - prerender: { - routes: ['/user/1', '/user/2'] - } - } + ssr: false }) ``` From f91e99f14f938da1b4dc6ab7adc2cf8200915eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Mon, 26 Sep 2022 09:50:56 +0200 Subject: [PATCH 11/13] docs(deployment): add details to client-side rendering --- docs/content/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index e45287393dc..59d1d40d5b6 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -98,7 +98,7 @@ defineNuxtConfig({ ### Client-side Only Rendering -If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `index.html` entrypoint like a classic client-side Vue.js application. +If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `.output/public/index.html` entrypoint and JavaScript bundles like a classic client-side Vue.js application. ```ts [nuxt.config.ts|js] defineNuxtConfig({ From 458664b0d2d30bc9a9c0709561d2d6ed684ad3e1 Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Mon, 26 Sep 2022 11:47:14 +0200 Subject: [PATCH 12/13] Update docs/content/1.getting-started/10.deployment.md --- docs/content/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 59d1d40d5b6..858d0a4c61f 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -1,6 +1,6 @@ # Deployment -A Nuxt application can be deployed on a Node or Deno server, pre-rendered to be hosted in static environments, or deployed to serverless and edge providers. +A Nuxt application can be deployed on a Node.js server, pre-rendered to be hosted in static environments, or deployed to serverless and edge providers in CDN. ::alert{type=info} If you are looking for a list of cloud providers that support Nuxt 3, see the [list below](#supported-hosting-providers). From 14547a83a97a07cd0d1defa74e7d7dfa13f1d46d Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 26 Sep 2022 13:21:40 +0100 Subject: [PATCH 13/13] docs: reword intro --- docs/content/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/1.getting-started/10.deployment.md b/docs/content/1.getting-started/10.deployment.md index 858d0a4c61f..6ef4a6a4a87 100644 --- a/docs/content/1.getting-started/10.deployment.md +++ b/docs/content/1.getting-started/10.deployment.md @@ -1,6 +1,6 @@ # Deployment -A Nuxt application can be deployed on a Node.js server, pre-rendered to be hosted in static environments, or deployed to serverless and edge providers in CDN. +A Nuxt application can be deployed on a Node.js server, pre-rendered for static hosting, or deployed to serverless or edge (CDN) environments. ::alert{type=info} If you are looking for a list of cloud providers that support Nuxt 3, see the [list below](#supported-hosting-providers).