# @libp2p/http

> Accept HTTP requests over libp2p streams or use libp2p protocols over HTTP

Latest version **2.0.6** (published 2026-07-03) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install @libp2p/http
pnpm add @libp2p/http
yarn add @libp2p/http
bun add @libp2p/http
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2026-07-03 |
| First published | 2025-05-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 9 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 13 |
| Maintainers | daviddias, alanshaw, achingbrain, vascosantos, npm-service-account-libp2p, jacobheun |

## Links

- npm: https://www.npmjs.com/package/@libp2p/http
- Repository: https://github.com/libp2p/js-libp2p-http
- Homepage: https://github.com/libp2p/js-libp2p-http/tree/main/packages/http#readme
- Issues: https://github.com/libp2p/js-libp2p-http/issues
- npm.io page: https://npm.io/package/@libp2p/http

## Dependencies (9)

- [cookie](https://npm.io/package/cookie.md) ^1.1.1
- [undici](https://npm.io/package/undici.md) ^8.0.3
- [@libp2p/interface](https://npm.io/package/@libp2p/interface.md) ^3.2.0
- [@libp2p/http-fetch](https://npm.io/package/@libp2p/http-fetch.md) ^4.0.0
- [@libp2p/http-utils](https://npm.io/package/@libp2p/http-utils.md) ^2.0.0
- [@libp2p/http-websocket](https://npm.io/package/@libp2p/http-websocket.md) ^2.0.0
- [@multiformats/multiaddr](https://npm.io/package/@multiformats/multiaddr.md) ^13.0.3
- [@libp2p/http-peer-id-auth](https://npm.io/package/@libp2p/http-peer-id-auth.md) ^2.0.0
- [@libp2p/interface-internal](https://npm.io/package/@libp2p/interface-internal.md) ^3.1.0

## Recent versions

- 2.0.6 (latest) — 2026-07-03
- 2.0.5 — 2026-07-03
- 2.0.4 — 2026-06-15
- 2.0.3 — 2026-06-14
- 2.0.2 — 2026-04-28
- 2.0.1 — 2025-10-13
- 2.0.0 — 2025-10-02
- 1.0.5 — 2025-08-05
- 1.0.4 — 2025-06-30
- 1.0.3 — 2025-06-27
- 1.0.2 — 2025-06-27
- 1.0.1 — 2025-05-28
- 1.0.0 — 2025-05-28
- 0.0.0 — 2025-05-28

## README

# @libp2p/http

[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-http.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-http)
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-http/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/libp2p/js-libp2p-http/actions/workflows/js-test-and-release.yml?query=branch%3Amain)

> Accept HTTP requests over libp2p streams or use libp2p protocols over HTTP

# About

<!--

!IMPORTANT!

Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.

To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts

To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.

-->

This module allows you to use HTTP requests as a transport for libp2p
protocols (libp2p over HTTP), and also libp2p streams as a transport for HTTP
requests (HTTP over libp2p).

It integrates with existing Node.js friendly HTTP frameworks such as
[express](https://expressjs.com/) and [Fastify](https://fastify.dev) as well
as [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request)/
[Response](https://developer.mozilla.org/en-US/docs/Web/API/Response)-based
frameworks like [Hono](https://hono.dev/).

It even allows creating Node.js-style [http.Server](https://nodejs.org/api/http.html#class-httpserver)s
and [WebSocketServer](https://github.com/websockets/ws/blob/HEAD/doc/ws.md#class-websocketserver)s
in browsers to truly realize the power of the distributed web.

In addition to URL-based addressing, it can use a libp2p PeerId and/or
multiaddr(s) and lets libp2p take care of the routing, thus taking advantage
of features like multi-routes, NAT traversal and stream multiplexing over a
single connection.

Check out the [examples](https://github.com/libp2p/js-libp2p-http/tree/main/examples)
for how you can use this in your applications!

# Install

```console
$ npm i @libp2p/http
```

## Browser `<script>` tag

Loading this module through a script tag will make its exports available as `Libp2pHttp` in the global namespace.

```html
<script src="https://unpkg.com/@libp2p/http/dist/index.min.js"></script>
```

# API Docs

- <https://libp2p.github.io/js-libp2p-http/modules/_libp2p_http.html>

# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](https://github.com/libp2p/js-libp2p-http/blob/main/packages/http/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/libp2p/js-libp2p-http/blob/main/packages/http/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

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