Skip to main content

SDKs & Libraries

Build Matrix applications with official and community SDKs.

SDK Comparison

SDKLanguageMaintainerE2EEBest For
matrix-js-sdkJavaScriptElementWeb apps, Element
matrix-rust-sdkRustElementHigh performance, mobile
matrix-python-sdkPythonCommunityScripts, bots
matrix-nioPythonCommunityAsync bots
matrix-bot-sdkTypeScriptCommunityNode.js bots
mautrix-pythonPythonTulirBridges, bots
libQuotientC++/QtKDENative Qt apps

Choosing an SDK

For Web Applications

matrix-js-sdk - The official JavaScript SDK

  • Powers Element Web
  • Full feature support
  • Browser and Node.js

For Mobile Applications

matrix-rust-sdk - High-performance SDK

  • Powers Element X
  • Bindings for Swift, Kotlin
  • Cross-platform

For Bots & Scripts

matrix-nio or matrix-bot-sdk

  • Easy to learn
  • Good documentation
  • Active communities

For Desktop Applications

libQuotient (C++/Qt) or matrix-rust-sdk

  • Native performance
  • System integration
  • Cross-platform

Quick Start Examples

JavaScript

import { createClient } from 'matrix-js-sdk';

const client = createClient({
baseUrl: "https://matrix.example.com",
accessToken: "your-access-token",
userId: "@user:example.com"
});

client.startClient();
client.on("Room.timeline", (event, room) => {
if (event.getType() === "m.room.message") {
console.log(`${event.getSender()}: ${event.getContent().body}`);
}
});

Python (nio)

from nio import AsyncClient, RoomMessageText

async def main():
client = AsyncClient("https://matrix.example.com", "@user:example.com")
await client.login("password")

client.add_event_callback(message_callback, RoomMessageText)
await client.sync_forever()

async def message_callback(room, event):
print(f"{event.sender}: {event.body}")

Rust

use matrix_sdk::{Client, config::SyncSettings, ruma::events::room::message::RoomMessageEventContent};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::builder()
.homeserver_url("https://matrix.example.com")
.build()
.await?;

client.login_username("user", "password").send().await?;
client.sync(SyncSettings::default()).await?;
Ok(())
}

Feature Support Matrix

Featurejs-sdkrust-sdkniobot-sdk
Sync
E2EE
Verification
Spaces
Threads🔄🔄
VoIP🔄
Sliding Sync

Development Resources

Official

Community


Continue: matrix-js-sdk | matrix-rust-sdk | matrix-python-sdk