---
title: Add a dependency
slug: optimizely-connect-platform/docs/add-a-dependency-ocp2
docTags: 
createdAt: 2026-07-23T12:37:05.104Z
---

Optimizely Connect Platform (OCP) apps have a set of pre-defined dependencies in the `package.json` file. You can add your own dependencies by using the `npm install` or `yarn add` command, or by manually editing the `package.json` file.

## Add a dependency

OCP apps on the `node22` runtime use the built-in `fetch` API for HTTP calls — no extra library required. If you prefer to use the [`axios library`](https://www.npmjs.com/package/axios) instead, you can add it to your app by running the following command:

```shell
npm install axios
```

## Add a `dev` dependency

If a dependency is only required at build and test time, for example, a testing library like [`mocha`](https://www.npmjs.com/package/mocha), you can add it as a `dev` dependency:

```shell
npm install --save-dev mocha
```

:::hint{type="info"}
**📘 Note**
All OCP apps come with the [`vitest library`](https://www.npmjs.com/package/vitest) by default (for testing).
:::

For dependencies without types, you should add TypeScript type definitions to your `dev` dependencies. Alternatively, you can manually add production or `dev` dependencies by manually editing the `package.json` file.

:::hint{type="info"}
**📘 Note**
You can add any dependency available in the [public NPM repository](https://www.npmjs.com). OCP does not support dependencies in private repositories. They can work locally, but the build fails when you push your app to OCP.
:::
