Install the XMTP SDK
Install the SDK for your platform. All SDKs use a backend URL. See Create a client for client options and Run the backend if you operate the backend.
Install a package
Section titled “Install a package”Choose your package manager. These commands install the Browser package. Replace
@xmtp/browser-sdk with @xmtp/node-sdk for a Node application.
npm install @xmtp/browser-sdkpnpm add @xmtp/browser-sdkyarn add @xmtp/browser-sdkbun add @xmtp/browser-sdkUse the package for your platform:
| Platform | Package or dependency |
|---|---|
| Browser | @xmtp/browser-sdk |
| Node | @xmtp/node-sdk |
| Kotlin | org.xmtp:android |
| Swift | Swift package product XMTPiOS |
The Browser and Node package commands above are the JavaScript package examples. For Android, add the XMTP Maven artifact to your app module:
dependencies { implementation("org.xmtp:android:<version>")}Replace <version> with the version you built or a released version that supports
ClientOptions.Api.backendUrl. Do not assume that an older hosted-network SDK
can connect to this backend.
For Swift, the package manifest is at the root of
libxmtp. Add the XMTPiOS product to your app.
When using the self-hosted source branch, build its matching native bindings
before adding the local package in Xcode:
git clone --branch self-hosted https://github.com/xmtp/libxmtp.gitcd libxmtpjust ios buildThese repository commands require the Nix development environment. In a Swift package next to that checkout, add these dependency and target entries:
// In Package.dependencies:.package(path: "../libxmtp")
// In your app target's dependencies:.product(name: "XMTPiOS", package: "libxmtp")Use a matching published SDK and native binary after the self-hosted release is available. A remote branch dependency alone does not build the native bindings.
Platform prerequisites
Section titled “Platform prerequisites”Use Node.js 22 or later for package tooling and a bundler that supports WebAssembly.
The Browser SDK stores its database in browser storage and does not encrypt it.
dbEncryptionKey is ignored by the Browser SDK.
Use Node.js 22 or later. Keep the 32-byte dbEncryptionKey and the database path
stable between launches.
Use Android API 23 or later and Java 17 for the SDK build. Provide an Android
Context and a 32-byte database encryption key. Pass the backend URL in
ClientOptions.Api. Call suspend functions from a coroutine.
Use Swift 6.1 or later. The package supports iOS 14 or later and macOS 11 or later.
Pass the backend URL in ClientOptions.Api and provide a 32-byte database
encryption key for the encrypted local database. Call async methods from an async
context.

