MCPcopy Index your code
hub / github.com/vercel/vercel

github.com/vercel/vercel @vercel@54.20.0 sqlite

repository ↗ · DeepWiki ↗ · release vercel@54.20.0 ↗ · compare 2 versions
16,501 symbols 61,140 edges 6,198 files 1,581 documented · 10%
README

Vercel

Develop. Preview. Ship.

Documentation · Changelog · Templates · CLI

Vercel

Vercel’s AI Cloud is a unified platform for building modern applications, giving teams the tools to be flexible, move fast, and stay secure while focusing on their products instead of infrastructure.

Deploy

Get started by importing a project, choosing a template, or using the Vercel CLI. Then, git push to deploy.

Native CLI binaries

The standard npm installation remains unchanged:

npm i -g vercel

Native CLI binaries are distributed separately and do not affect the vercel npm package. To opt into the native binary and replace existing global vercel and vc commands, install the native package explicitly:

npm i -g @vercel/vc-native --force

The --force flag allows npm to replace existing global vercel and vc bin links. Users who do not install @vercel/vc-native continue using the regular Node.js-based CLI from npm i -g vercel.

Platform-specific packages are also available for direct installation when a specific binary is needed:

npm i -g @vercel/vc-native-darwin-x64 --force

Documentation

For details on how to use Vercel, check out our documentation.

Contributing

This project uses pnpm to install dependencies and run scripts.

You can use the vercel script to run local changes as if you were invoking Vercel CLI. For example, vercel deploy --cwd=/path/to/project could be run with local changes with pnpm vercel deploy --cwd=/path/to/project.

When contributing to this repository, please first discuss the change you wish to make via Vercel Community with the owners of this repository before submitting a Pull Request.

Please read our Code of Conduct and follow it in all your interactions with the project.

Local development

This project is configured in a monorepo, where one repository contains multiple npm packages. Dependencies are installed and managed with pnpm, not npm CLI.

To get started, execute the following:

git clone https://github.com/vercel/vercel
cd vercel
corepack enable
pnpm install
pnpm build
pnpm lint
pnpm test-unit

Make sure all the tests pass before making changes.

Running Vercel CLI Changes

You can use pnpm vercel from the cli package to invoke Vercel CLI with local changes:

cd ./packages/cli
pnpm vercel <cli-commands...>

See CLI Local Development for more details.

Verifying your change

Once you are done with your changes (we even suggest doing it along the way), make sure all the tests still pass by running:

pnpm test-unit

from the root of the project.

If any test fails, make sure to fix it along with your changes. See Interpreting test errors for more information about how the tests are executed, especially the integration tests.

Pull Request Process

Once you are confident that your changes work properly, open a pull request on the main repository.

The pull request will be reviewed by the maintainers and the tests will be checked by our continuous integration platform.

Interpreting test errors

There are 2 kinds of tests in this repository – Unit tests and Integration tests.

Unit tests are run locally with jest and execute quickly because they are testing the smallest units of code.

Integration tests

Integration tests create deployments to your Vercel account using the test project name. After each test is deployed, the probes key is used to check if the response is the expected value. If the value doesn't match, you'll see a message explaining the difference. If the deployment failed to build, you'll see a more generic message like the following:

[Error: Fetched page https://test-8ashcdlew.vercel.app/root.js does not contain hello Root!. Instead it contains An error occurred with this application.

    NO_STATUS_CODE_FRO Response headers:
       cache-control=s-maxage=0
      connection=close
      content-type=text/plain; charset=utf-8
      date=Wed, 19 Jun 2019 18:01:37 GMT
      server=now
      strict-transport-security=max-age=63072000
      transfer-encoding=chunked
      x-now-id=iad1:hgtzj-1560967297876-44ae12559f95
      x-now-trace=iad1]

In such cases, you can visit the URL of the failed deployment and append /_logs to see the build error. In the case above, that would be https://test-8ashcdlew.vercel.app/_logs

The logs of this deployment will contain the actual error which may help you to understand what went wrong.

Running integration tests locally

While running the full integration suite locally is not recommended, it's sometimes useful to isolate a failing test by running it on your machine. To do so, you'll need to ensure you have the appropriate credentials sourced in your shell:

  1. Create an access token. Follow the instructions here https://vercel.com/docs/rest-api#creating-an-access-token. Ensure the token scope is for your personal account.
  2. Grab the team ID from the Vercel dashboard at https://vercel.com/<MY-TEAM>/~/settings.
  3. Source these into your shell rc file: echo 'export VERCEL_TOKEN=<MY-TOKEN> VERCEL_TEAM_ID=<MY-TEAM-ID>' >> ~/.zshrc

From there, you should be able to trigger an integration test. Choose one that's already isolated to check that things work:

cd packages/next

Run the test:

pnpm test test/fixtures/00-server-build/index.test.js

[!NOTE] If you receive a 401 status code while fetching the deployment, you need to disable Deployment Protection on the project.

@vercel/nft

Some of the Builders use @vercel/nft to tree-shake files before deployment. If you suspect an error with this tree-shaking mechanism, you can create the following script in your project:

const { nodeFileTrace } = require('@vercel/nft');
nodeFileTrace(['path/to/entrypoint.js'], {
  ts: true,
  mixedModules: true,
})
  .then(o => console.log(o.fileList))
  .then(e => console.error(e));

When you run this script, you'll see all the imported files. If files are missing, the bug is in @vercel/nft and not the Builder.

Deploy a Builder with existing project

Sometimes you want to test changes to a Builder against an existing project, maybe with vercel dev or actual deployment. You can avoid publishing every Builder change to npm by uploading the Builder as a tarball.

  1. Change directory to the desired Builder cd ./packages/node
  2. Run pnpm build to compile typescript and other build steps
  3. Run npm pack to create a tarball file. It is imporant to not use pnpm pack because it will not preserve the file permissions
  4. Move the resulting tarball to a directory
  5. Run vercel <directory> to upload the tarball file and get a URL. Remember to append /<tarball name> to then end of your URL
  6. Edit any existing vercel.json project and replace use with the URL
  7. Run vercel or vercel dev to deploy with the experimental Builder

Note: You will need to turn off vercel authentication in settings -> deployment protection so the builder can be downloaded

Reference

Extension points exported contracts — how you extend this code

Quirk (Interface)
(no doc) [10 implementers]
packages/python/src/quirks/index.ts
Headers (Interface)
(no doc) [16 implementers]
packages/functions/src/headers.ts
HeadersLike (Interface)
(no doc) [16 implementers]
packages/passport/src/index.ts
Response (Interface)
(no doc) [3 implementers]
packages/cli/src/util/fetch.ts
FileBase (Interface)
(no doc) [3 implementers]
packages/build-utils/src/types.ts
DevOutput (Interface)
* Sink for all dev output. `vercel dev` runs many services in parallel and * prefixes each service's logs (e.g. `[api]`
packages/container/src/dev.ts
Env (Interface)
* Declare expected Env parameter in fetch handler.
packages/remix/test/fixtures-legacy/10-hydrogen-2/remix.env.d.ts
ResolvedCommand (Interface)
* Resolved executable path and source before conversion to invocation args.
packages/cli-exec/src/lookup.ts

Core symbols most depended-on inside this repo

setArgv
called by 3096
packages/cli/test/mocks/client.ts
join
called by 2489
python/vercel-workers/src/vercel/workers/dramatiq/broker.py
get
called by 2326
packages/functions/src/headers.ts
json
called by 1610
packages/cli/src/util/fetch.ts
push
called by 1592
packages/container/src/engines/types.ts
error
called by 1536
packages/cli/src/util/get-latest-version/get-latest-worker.cjs
log
called by 1344
python/vercel-runtime/src/vercel_runtime/_vendor/werkzeug/serving.py
parse
called by 953
python/vercel-runtime/src/vercel_runtime/_vendor/werkzeug/formparser.py

Shape

Function 9,536
Method 4,133
Class 1,522
Interface 1,111
Route 159
Struct 29
Enum 11

Languages

TypeScript76%
Python23%
Go1%

Modules by API surface

packages/cli/test/fixtures/unit/pnpm-pnp-symlink/.pnp.cjs566 symbols
packages/cli/src/util/errors-ts.ts218 symbols
python/vercel-runtime/src/vercel_runtime/_vendor/click/core.py133 symbols
python/vercel-runtime/src/vercel_runtime/_vendor/werkzeug/datastructures/structures.py118 symbols
packages/cli/src/util/telemetry/root.ts95 symbols
python/vercel-workers/tests/test_dramatiq_adapter.py94 symbols
python/vercel-runtime/tests/test_runtime.py92 symbols
python/vercel-workers/tests/test_client_and_callback.py85 symbols
python/vercel-runtime/src/vercel_runtime/_vendor/click/types.py84 symbols
packages/next/src/utils.ts77 symbols
packages/cli/src/util/telemetry/commands/routes/index.ts72 symbols
packages/cli/src/util/dev/server.ts68 symbols

Dependencies from manifests, versioned

example.com/greetingv0.0.0 · 1×
github.com/cloudwego/base64xv0.1.4 · 1×
github.com/cloudwego/iasmv0.2.0 · 1×
github.com/dhruvbird/go-cowsayv0.0.0-2013101922515 · 1×
github.com/gin-contrib/ssev0.1.0 · 1×
github.com/go-playground/localesv0.14.1 · 1×
github.com/go-playground/universal-translatorv0.18.1 · 1×

For agents

$ claude mcp add vercel \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact