# @api3/commons

> > Common utilities, modules and configurations used in API3 projects.

Latest version **2.0.0** (published 2026-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @api3/commons
pnpm add @api3/commons
yarn add @api3/commons
bun add @api3/commons
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-08-31 |
| First published | 2023-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.20.8 |
| Dependencies | 9 |
| Unpacked size | 416.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Maintainers | bbenligiray, siegrift |

## Links

- npm: https://www.npmjs.com/package/@api3/commons
- Repository: https://github.com/api3dao/commons
- Homepage: https://github.com/api3dao/commons#readme
- Issues: https://github.com/api3dao/commons/issues
- npm.io page: https://npm.io/package/@api3/commons

## Dependencies (9)

- [zod](https://npm.io/package/zod.md) ^4.4.3
- [axios](https://npm.io/package/axios.md) ^1.18.1
- [dotenv](https://npm.io/package/dotenv.md) ^17.4.2
- [ethers](https://npm.io/package/ethers.md) ^5.8.0
- [lodash](https://npm.io/package/lodash.md) ^4.18.1
- [winston](https://npm.io/package/winston.md) ^3.19.0
- [@api3/ois](https://npm.io/package/@api3/ois.md) ^3.0.0
- [@octokit/rest](https://npm.io/package/@octokit/rest.md) ^20.1.1
- [winston-console-format](https://npm.io/package/winston-console-format.md) ^1.0.8

## Recent versions

- 2.0.0 (latest) — 2026-08-31
- 1.3.0 — 2026-08-07
- 1.2.0 — 2026-02-20
- 1.1.2 — 2026-01-01
- 1.0.1 — 2025-07-31
- 1.0.0 — 2025-07-31
- 0.13.4 — 2024-11-18
- 0.13.3 — 2024-10-08
- 0.13.2 — 2024-09-13
- 0.13.1 — 2024-09-12
- 0.13.0 — 2024-09-10
- 0.12.0 — 2024-08-08
- 0.11.0 — 2024-08-02
- 0.10.0 — 2024-06-29
- 0.9.1 — 2024-05-21
- … 13 more at https://npm.io/package/@api3/commons/versions

## README

# commons

> Common utilities, modules and configurations used in API3 projects.

The commons library is meant to stop "reinventing the wheel". It holds the canonical implementations that can be
imported in other packages. This way we ensure that all package use the same logic, simplify bug fixes and avoid code
duplication. The package is cross platform and can be used in Node.js and browser.

The commons library is a collection of multiple modules, with each module having its own README that you can refer to.

## Getting started

```sh
# Feel free to use your favorite package manager
pnpm i @api3/commons
```

Read the documentation and sources of each module how to use it in the project.

## Modules

- [blockchain-utilities](./src/blockchain-utilities/README.md)
- [config-hash](./src/config-hash/README.md)
- [config-parsing](./src/config-parsing/README.md)
- [http](./src/http/README.md)
- [logger](./src/logger/README.md)
- [processing](./src/processing/README.md)
- [promise-utils](./src/promise-utils/README.md)
- [release-scripts](./src/release-scripts/README.md)
- [run-in-loop](./src/run-in-loop/README.md)
- [utils](./src/utils/README.md)

## Using the package in universal context

Some modules may be used only in both browser and Node.js context and some are Node.js only. To support this
requirement, we use different entrypoints for each context. Note, there is no support for browser-only modules.

The bundler or Node.js picks up the right entrypoint automatically, but bear in mind that only a subset of modules is
available when using universal modules. If you use TypeScript, it may not pick up the correct types. You can set these
manually, by adding the following to your `tsconfig.json`:

```json
"compilerOptions": {
  "paths": {
    "@api3/commons": ["./node_modules/@api3/commons/dist/esm/universal-index.d.ts"]
  }
}
```

## ESM and CommonJS

The package ships both module systems. `dist/esm` holds the ES modules and `dist/cjs` holds the CommonJS modules. Both
come with type declarations. The bundler or Node.js picks the right one through the `exports` field, so `import` and
`require` both work without any configuration on your side.

## Related repositories

- [chains](https://github.com/api3dao/chains)
- [contracts](https://github.com/api3dao/contracts)
- [eslint-plugin-commons](https://github.com/api3dao/eslint-plugin-commons)
- [ois](https://github.com/api3dao/ois)

## For developers

Please refer to the [developer instructions](./dev-README.md) for details.

---
_Source: https://npm.io/package/@api3/commons · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
