---
title: "nuxt generate"
description: "Pre-renders every route of the application and stores the result in plain HTML files."
canonical_url: "https://nuxt.com/docs/4.x/api/commands/generate"
---
# nuxt generate

> Pre-renders every route of the application and stores the result in plain HTML files.

<!--generate-cmd-->

```bash [Terminal]
npx nuxt generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--target=<target>] [--dotenv=<path>...] [--envName=<environment>] [-e, --extends=<layer-name>...] [--profile=<verbose>]
```

<!--/generate-cmd-->

The `generate` command pre-renders every route of your application and stores the result in plain HTML files that you can deploy on any static hosting services. The command triggers the `nuxt build` command with the `prerender` argument set to `true`

## Arguments

<!--generate-args-->

| Argument  | Description                                          |
| --------- | ---------------------------------------------------- |
| `ROOTDIR` | The root directory of your Nuxt project (default: .) |

<!--/generate-args-->

## Options

<!--generate-opts-->

| Option                               | Default | Description                                                                                                                                          |
| ------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--cwd=<directory>`                  |         | Specify the root directory of your Nuxt project                                                                                                      |
| `--logLevel=<silent\|info\|verbose>` |         | Specify build-time log level                                                                                                                         |
| `--target=<target>`                  |         | Deploy target for the configured server builder (e.g. `node-server`, `vercel`, `netlify`)                                                            |
| `--dotenv=<path>...`                 |         | Path to `.env` file to load, relative to the root directory. Can be repeated, with later files taking precedence.                                    |
| `--envName=<environment>`            |         | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
| `-e, --extends=<layer-name>...`      |         | Extend from a Nuxt layer                                                                                                                             |
| `--profile=<verbose>`                |         | Profile performance, writing a V8 CPU profile and a JSON report on exit. Use `--profile=verbose` for a full console report.                          |

<!--/generate-opts-->

::read-more{to="https://nuxt.com/docs/4.x/getting-started/deployment#static-hosting"}
Read more about pre-rendering and static hosting.
::

---

- [Source](https://github.com/nuxt/cli/blob/main/packages/nuxt-cli/src/commands/generate.ts)


## Sitemap

See the full [sitemap](https://nuxt.com/sitemap.md) for all pages.
