|
| 1 | +--- |
| 2 | +date: 2025-07-25 |
| 3 | +permalink: /2025-js-libp2p-helia-devtools/ |
| 4 | +title: 'Debugging superpowers with the new js-libp2p developer tools' |
| 5 | +description: 'Discover the new js-libp2p developer tools from Shipyard that provide real-time debugging capabilities for js-libp2p and Helia nodes in both browsers and Node.js.' |
| 6 | +author: Daniel Norman |
| 7 | +header_image: /dev-tools.jpg |
| 8 | +tags: |
| 9 | + - ipfs |
| 10 | + - devtools |
| 11 | + - js-libp2p |
| 12 | + - browsers |
| 13 | + - node.js |
| 14 | + - extension |
| 15 | + - Interplanetary Shipyard |
| 16 | +--- |
| 17 | + |
| 18 | +[Interplanetary Shipyard](https://ipshipyard.com/) is thrilled to share [js-libp2p inspector](https://github.com/ipshipyard/js-libp2p-inspector/), the new developer tools for debugging and inspecting js-libp2p and Helia, for use both in browsers and Node.js. |
| 19 | + |
| 20 | +Debugging is an essential part of software development, and having the right tools can make all the difference. The new developer tools provide a user-friendly interface to inspect your libp2p nodes in real-time, tightening the feedback loop and making it easier to diagnose issues. |
| 21 | + |
| 22 | +## Inspecting and monitoring throughout the development cycle |
| 23 | + |
| 24 | +These new developer tools expand the existing set of metrics implementations for js-libp2p, which include [metrics-prometheus](https://github.com/libp2p/js-libp2p/tree/main/packages/metrics-prometheus) and [metrics-opentelemetry](https://github.com/libp2p/js-libp2p/tree/main/packages/metrics-opentelemetry). |
| 25 | + |
| 26 | +While Prometheus and OpenTelemetry are for monitoring and tracing in production (though not exclusively), the inspector is intended for use during development. Together, these tools provide a comprehensive solution for monitoring and debugging js-libp2p and Helia nodes throughout the development cycle. |
| 27 | + |
| 28 | +## Getting started |
| 29 | + |
| 30 | +To inspect a js-libp2p or Helia node, you need to pass the metrics implementation from the [`@ipshipyard/libp2p-inspector-metrics`](https://www.npmjs.com/package/@ipshipyard/libp2p-inspector-metrics) package to your js-libp2p or Helia factory: |
| 31 | + |
| 32 | +### js-libp2p example |
| 33 | + |
| 34 | +```js |
| 35 | +import { createLibp2p } from 'libp2p' |
| 36 | +import { inspectorMetrics } from '@ipshipyard/libp2p-inspector-metrics' |
| 37 | + |
| 38 | +const node = await createLibp2p({ |
| 39 | + metrics: inspectorMetrics() |
| 40 | +}) |
| 41 | +``` |
| 42 | + |
| 43 | +### Helia example |
| 44 | + |
| 45 | +```js |
| 46 | +import { createHelia } from 'helia' |
| 47 | +import { inspectorMetrics } from '@ipshipyard/libp2p-inspector-metrics' |
| 48 | + |
| 49 | +const node = await createHelia({ |
| 50 | + libp2p: { |
| 51 | + metrics: inspectorMetrics() |
| 52 | + }, |
| 53 | +}) |
| 54 | +``` |
| 55 | + |
| 56 | +Once you have your node running with the inspector metrics enabled, you can start inspecting it using the browser extension or the Electron app. |
| 57 | + |
| 58 | +The following video walks through setup and usage with both Node.js and browser environments: |
| 59 | + |
| 60 | +@[youtube](AKNGtn7EZxI) |
| 61 | + |
| 62 | +## Try the new developer tools |
| 63 | + |
| 64 | +The new developer tools consist of several npm packages that work together: |
| 65 | + |
| 66 | +- [`@ipshipyard/libp2p-devtools`:](https://github.com/ipshipyard/js-libp2p-inspector/tree/main/packages/libp2p-devtools) Browser DevTools extension to inspect a libp2p node running in a web page. |
| 67 | +- [`@ipshipyard/libp2p-inspector`:](https://github.com/ipshipyard/js-libp2p-inspector/tree/main/packages/libp2p-inspector) Electron based app to inspect a running libp2p node in Node.js. |
| 68 | +- [`@ipshipyard/libp2p-inspector-metrics`:](https://github.com/ipshipyard/js-libp2p-inspector/tree/main/packages/libp2p-inspector-metrics) Metrics implementation that instruments the libp2p node such that it can be inspected by the inspector or the browser extension. This package needs to be imported in your js-libp2p based application to enable inspection. |
| 69 | +- [`@ipshipyard/libp2p-inspector-ui`:](https://github.com/ipshipyard/js-libp2p-inspector/tree/main/packages/libp2p-inspector-ui) The user interface shared by both the Electron inspector and the browser extension. |
| 70 | + |
| 71 | +We encourage you to try out the new developer tools and provide feedback. You can find the source code on [GitHub](https://github.com/ipshipyard/js-libp2p-inspector). |
0 commit comments