{"id":13660036,"url":"https://github.com/nuxt/vercel-builder","last_synced_at":"2026-02-26T16:30:14.439Z","repository":{"id":37449607,"uuid":"171683420","full_name":"nuxt/vercel-builder","owner":"nuxt","description":"Vercel Builder for Nuxt","archived":false,"fork":false,"pushed_at":"2025-02-11T18:41:17.000Z","size":8590,"stargazers_count":643,"open_issues_count":49,"forks_count":77,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-02-13T15:05:48.413Z","etag":null,"topics":["nuxt","nuxtjs","serverless","vercel"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nuxt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-20T14:00:38.000Z","updated_at":"2025-01-24T18:33:14.000Z","dependencies_parsed_at":"2023-02-18T08:15:39.178Z","dependency_job_id":"fa2f7ef7-7c70-4ca4-9d00-e2ad79034512","html_url":"https://github.com/nuxt/vercel-builder","commit_stats":{"total_commits":745,"total_committers":33,"mean_commits":"22.575757575757574","dds":0.6093959731543623,"last_synced_commit":"1fd500e73c613801437705d521a5b7be684e2cfe"},"previous_names":["nuxt/now-builder"],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt%2Fvercel-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt%2Fvercel-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt%2Fvercel-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt%2Fvercel-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuxt","download_url":"https://codeload.github.com/nuxt/vercel-builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239869214,"owners_count":19710485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nuxt","nuxtjs","serverless","vercel"],"created_at":"2024-08-02T05:01:15.280Z","updated_at":"2026-02-26T16:30:14.384Z","avatar_url":"https://github.com/nuxt.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"![vercel-builder](https://user-images.githubusercontent.com/904724/61308402-7a752d00-a7f0-11e9-9502-23731ccd00fd.png)\n\n# Nuxt Vercel Builder\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![packagephobia][packagephobia-src]][packagephobia-href]\n[![Github actions status][github-ci-src]][github-ci-href]\n[![Codecov][codecov-src]][codecov-href]\n[![Dependencies][david-dm-src]][david-dm-href]\n[![Standard JS][standard-js-src]][standard-js-href]\n\n\u003e ⚠️ This is a _legacy builder_ and only works for Nuxt 2. We'd strongly recommend using [Nuxt Bridge](https://github.com/nuxt/bridge) or [Nuxt 3](https://nuxt.com/docs/getting-started/introduction), which use the latest Vercel features instead.\n\n---\n\n`@nuxtjs/vercel-builder` allows you ship a fast, production-ready [Nuxt 2 application](https://nuxtjs.org) that scales automatically on Vercel when using SSR rendering.\n\n### When to use it\n\n**This package is only made for Nuxt 2 SSR applications - and you probably do not need to use it.**\n\n👉 If you want to deploy a statically generated Nuxt 2 application instead, Vercel is a zero configuration provider. Check [this guide from Vercel](https://vercel.com/guides/deploying-nuxtjs-with-vercel) for more information.\n\n👉 If you want to deploy a Nuxt Bridge or Nuxt 3 app, Vercel deployment will work with zero configuration. Check [this guide](https://nitro.unjs.io/deploy/providers/vercel) for more information.\n\n⚠️ We would advise you migrate your app to Nuxt 3, which features a much superior integration with Vercel using their latest Build API.\n\n### How it works\n\nThis Vercel builder takes a Nuxt application defined by a `nuxt.config.js` (or `.ts`) entrypoint and deploys it as a serverless function in a Vercel environment.\n\nIt features built-in caching of `node_modules` and the global yarn cache (even when dependencies change) and a multi-stage build for fast and small deployments.\n\n## Setup\n\nAll you need is a [Nuxt](https://nuxtjs.org) application and a [Vercel](https://vercel.com) account.\n\nThen, simply create a `vercel.json` file at the root of your project:\n\n```json\n{\n  \"version\": 2,\n  \"builds\": [\n    {\n      \"src\": \"nuxt.config.js\",\n      \"use\": \"@nuxtjs/vercel-builder\"\n    }\n  ]\n}\n```\n\n**NOTE:** When installing your dependencies, Vercel will use the same package manager that is used in the project. Using `yarn` is **highly** recommended due to its [autoclean](https://yarnpkg.com/lang/en/docs/cli/autoclean) functionality, which can decrease lambda size.\n\n## Examples\n\nSee [Basic example](./examples/basic) for a more complete deployable example, including an example of how to set up `vercel dev` support.\n\nSee [Deploying two Nuxt apps side-by-side](./examples/side-by-side/README.md) for details on deploying two Nuxt apps in one monorepo.\n\n## Configuration\n\n### `serverFiles`\n\n- Type: `Array`\n\nIf you need to include files in the server lambda that are not built by webpack (or within `static/`), such as a local module or serverMiddleware, you may specify them with this option. Each item can be a glob pattern.\n\n**Example**\n\n```json\n{\n  \"builds\": [\n    {\n      \"src\": \"nuxt.config.js\",\n      \"use\": \"@nuxtjs/vercel-builder\",\n      \"config\": {\n        \"serverFiles\": [\"server-middleware/**\"]\n      }\n    }\n  ]\n}\n```\n\n### `internalServer`\n\n- Type: `Boolean`\n- Default: `false`\n\nIf you have defined `serverMiddleware` in your `nuxt.config`, this builder will automatically enable an internal server within the lambda so you can access your own endpoints via `http://localhost:3000`. (This does not affect how you call your endpoints from client-side.)\n\nIf you need to enable or disable the internal server manually (for example, if you are adding server middleware via a module), just set `internalServer` within the builder options.\n\n### `generateStaticRoutes`\n\n- Type: `Boolean`\n- Default: `false`\n\nTo pre-render routes during the build using `nuxt generate` set this to true. Routes that are not generated will fallback to the server lambda. You will need to [specify the routes to be generated](https://nuxtjs.org/api/configuration-generate/#routes) in your `nuxt.config`.\n\n**Example**\n\n```json\n{\n  \"builds\": [\n    {\n      \"src\": \"nuxt.config.js\",\n      \"use\": \"@nuxtjs/vercel-builder\",\n      \"config\": {\n        \"generateStaticRoutes\": true\n      }\n    }\n  ]\n}\n```\n\n### `tscOptions`\n\n- Type: `Object`\n\nIf you need to pass TypeScript compiler options to override your `tsconfig.json`, you can pass them here. See [the TypeScript documentation](https://www.typescriptlang.org/docs/handbook/compiler-options.html) for valid options.\n\n**Example**\n\n```json\n{\n  \"src\": \"nuxt.config.ts\",\n  \"use\": \"@nuxtjs/vercel-builder\",\n  \"config\": {\n    \"tscOptions\": {\n      \"sourceMap\": false\n    }\n  }\n}\n```\n\nYou can also include a `tsconfig.vercel.json` file alongside your `tsconfig.json` file. The `compilerOptions` from those files, along with any `tscOptions` passed through vercel.json, will be merged and the resulting options used to compile your `nuxt.config.ts`, local modules and serverMiddleware.\n\n### `memory`\n\n- Type: `Number`\n\nPass this option if you need to customize the default memory limit of the serverless function that renders your pages.\n\n### `maxDuration`\n\n- Type: `Number`\n\nPass this option if you need to customize the max duration of the serverless function that renders your pages.\n\n### Environment variables\n\n#### `env`\n\nIf you are [accessing environment variables via `env`](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-env#process-env-) within your Nuxt build, then they will be **baked in at build time**. This means that if you update the variables in the Vercel dashboard, you will need to trigger a deployment again for the changes to take effect. You must include these variables in `build.env` in your `vercel.json` (see below).\n\n#### `runtimeConfig`\n\nIf you are using Nuxt 2.13+, it is recommended to use the [new runtimeConfig options](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-runtime-config) instead.\n\n#### Exposing variables\n\nThere are two environments where you may need to expose environment variables within `vercel.json`. They are `env` (for _runtime_ variables) and `build.env` (for _build-time_ variables, which may not be required for `runtimeConfig`). See [Vercel documentation](https://vercel.com/docs/cli#project-configuration/env). For example:\n\n```json\n{\n  \"env\": {\n    \"MY_VARIABLE\": true\n  },\n  \"build\": {\n    \"env\": {\n      \"MY_VARIABLE\": true\n    }\n  }\n}\n```\n\nFinally, note that if you want to access Vercel's [system environment variables](https://vercel.com/docs/environment-variables#system-environment-variables), you may want ensure that system environment variables are automatically exposed.\n\n## Usage with Typescript\n\n`vercel-builder` supports TypeScript runtime compilation. It adds in a pre-compilation step as part of building the lambda for files not compiled by Webpack, such as `nuxt.config.ts`, local modules and serverMiddleware.\n\nReferences to original TS files in strings outside of `modules` or `serverMiddleware` may therefore cause unexpected errors.\n\nDon't forget to update your Nuxt config filename in your `vercel.json` file.\n\n## Technical details\n\n### Monorepos\n\nJust enable the \"Include source files outside of the Root Directory in the Build Step\" option in the **Root Directory** section within the project settings.\n\n![Vercel monorepo config](/docs/monorepo-config.png)\n\n### Private npm modules\n\nTo install private npm modules, define `NPM_AUTH_TOKEN` or `NPM_TOKEN` as a [build environment variable](https://vercel.com/docs/configuration#project/build-env) in `vercel.json`.\n\nAlternatively, you can inline your entire `.npmrc` file in a `NPM_RC` environment variable.\n\n### Node.js version\n\nThe newest available Node.js version is automatically selected. If your packages depend on a particular major release Node.js version, you can specify the version in your `package.json` - see [Vercel documentation](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version).\n\n### `vercel-build` script support\n\nThis builder will run a given [custom build step](https://vercel.com/docs/runtimes#advanced-usage/advanced-node-js-usage/custom-build-step-for-node-js) if you have added a `vercel-build` key under `scripts` in `package.json`.\n\n## Deploying additional serverless functions\n\nYou can also deploy additional serverless functions _alongside_ your Nuxt application.\n\n### serverMiddleware\n\nCreate an `api` folder at the root of your project, and then create a file in it, for example `hello.js`:\n\n```js\nimport express from 'express'\nimport bodyParser from 'body-parser'\n\nconst app = express()\napp.use(bodyParser.json())\n\n// It is important that the full path is specified here\napp.post('/api/hello', function(req, res) {\n  const { info } = req.body\n  console.log(info)\n  res\n    .status(200)\n    .json({ info })\n    .end()\n})\n\nexport default app\n```\n\n### Setup the Vercel config\n\nIn your `vercel.json`, add your additional endpoints:\n\n```json\n{\n  \"version\": 2,\n  \"routes\": [\n    {\n      \"src\": \"/api/hello\",\n      \"dest\": \"/api/hello.js\"\n    }\n  ],\n  \"builds\": [\n    {\n      \"src\": \"api/**/*.js\",\n      \"use\": \"@vercel/node\"\n    },\n    {\n      \"src\": \"nuxt.config.ts\",\n      \"use\": \"@nuxtjs/vercel-builder\",\n      \"config\": {\n        \"serverFiles\": [\"api/**\"]\n      }\n    }\n  ]\n}\n```\n\n### Add it to the Nuxt config\n\nIf you want to interact with this API whilst developing your Nuxt app, you can add it to your `serverMiddleware` conditionally.\n\n```js\nexport default {\n  serverMiddleware:\n    process.env.NODE_ENV === 'production' ? [] : ['~/api/hello.js'],\n}\n```\n\nAnd that's it! You can now go to `http://locahost:3000/api/hello` and see the result! In production the endpoint will be handled with Vercel, but locally Nuxt will manage it for you.\n\n# License\n\n[MIT License](./LICENSE)\n\nDocumentation and builder inspired by [Next.js](https://nextjs.org) by [Vercel](https://vercel.com)\n\nCopyright (c) Nuxt Community\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://flat.badgen.net/npm/dt/@nuxtjs/vercel-builder\n[npm-version-href]: https://npmjs.com/package/@nuxtjs/vercel-builder\n[npm-downloads-src]: https://flat.badgen.net/npm/v/@nuxtjs/vercel-builder\n[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/vercel-builder\n[github-ci-src]: https://flat.badgen.net//github/checks/nuxt/vercel-builder\n[github-ci-href]: https://github.com/nuxt/vercel-builder/actions\n[codecov-src]: https://flat.badgen.net/codecov/c/github/nuxt/vercel-builder\n[codecov-href]: https://codecov.io/gh/nuxt/vercel-builder\n[david-dm-src]: https://flat.badgen.net/david/dep/nuxt/vercel-builder\n[david-dm-href]: https://david-dm.org/nuxt/vercel-builder\n[standard-js-src]: https://flat.badgen.net/badge/code%20style/standard/f2a\n[standard-js-href]: https://standardjs.com\n[packagephobia-src]: https://flat.badgen.net/packagephobia/install/@nuxtjs/vercel-builder\n[packagephobia-href]: https://packagephobia.now.sh/result?p=@nuxtjs/vercel-builder\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt%2Fvercel-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuxt%2Fvercel-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt%2Fvercel-builder/lists"}