---
title: Start with TypeScript
description: 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

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

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

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

Create a development build and connect from a component.

Import from the package for your runtime:

```ts
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

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

Persist identity and shut down cleanly on each runtime.

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

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

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

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

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

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