Skip to content
minip2p
Esc
navigateopen⌘Jpreview
On this page

Start with TypeScript

Choose Node.js or React Native, make the first connection, and continue with the shared TypeScript interface.

minip2p has one TypeScript interface on Node.js and React Native. Setup and endpoint ownership differ by runtime. Connections, streams, events, pubsub, discovery, and NAT traversal work the same way after the endpoint starts.

Choose your runtime

Import from the package for your runtime:

import { Minip2p } from "@minip2p/node";
// or
import { Minip2p } from "@minip2p/react-native";

Both packages expose the same application types and operations.

The shared connection flow

Every endpoint needs a 32-byte Ed25519 secret key. Reuse the same key when the peer needs a stable identity.

To connect:

  1. Pass a complete peer multiaddress to connectAddr.
  2. Wait for waitPeerReady before opening an application stream.
  3. Use ping, openStream, pubsub, or another operation.
  4. Close the endpoint when its owner shuts down.

connectAddr resolves when minip2p has a usable direct or relayed path. waitPeerReady waits for Identify and returns the peer’s supported protocols.

Continue

Last updated on September 7, 2026

Was this page helpful?