---
title: Start with TypeScript
description: Choose Node.js, React Native or the browser, make the first connection, and continue with the shared TypeScript interface.
---

minip2p has one TypeScript interface on Node.js, React Native and the browser. Setup and endpoint ownership differ by runtime. Connections, streams, events, pubsub, discovery, and NAT traversal work the same way after the endpoint starts; the browser runs a subset (it dials over WebTransport and cannot listen).

## Choose your runtime

**[Node.js quickstart](/docs/typescript/setup-node)**

Install the package, connect to a peer, and measure a Ping RTT.

**[React Native quickstart](/docs/typescript/setup-react-native)**

Create a development build and connect from a component.

**[Browser quickstart](/docs/typescript/setup-web)**

Dial a native node over WebTransport from a page.

Import from the package for your runtime:

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

The 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 `connect`.
2. Open application streams once the path is usable. Call `waitPeerReady` when you need Identify's advertised protocols.
3. Use `ping`, `openStream`, pubsub, or another operation.
4. Close the endpoint when its owner shuts down.

`connect` resolves when minip2p has a usable direct or relayed path. `waitPeerReady` waits for Identify and returns the peer's supported protocols. It is not required before `openStream` for a protocol you already know the remote speaks.

## Continue

**[Endpoint lifecycle](/docs/typescript/lifecycle)**

Persist identity and shut down cleanly on each runtime.

**[Connections and streams](/docs/typescript/connections-and-streams)**

Connect, cancel work, and exchange bytes over custom protocols.

**[Networking and events](/docs/typescript/networking-and-events)**

Consume events and enable pubsub, discovery, mDNS, or NAT traversal.

**[TypeScript reference](/docs/reference/typescript-api)**

Look up configuration, methods, events, streams, and errors.
