Backend SDKs
Stream ships seven backend SDKs. Each one covers every Stream product: one client object gives you chat, video, feeds and moderation from the same process, authenticated with your API key and secret. The code tabs across this Platform section assume you have constructed that client.
Backend SDKs run on your server and hold your API secret. Anything that runs on a user's device belongs in a client SDK instead.
The SDKs
| Language | Package | Registry |
|---|---|---|
| Node.js | @stream-io/node-sdk |
npm |
| Python | getstream |
PyPI |
| Go | github.com/GetStream/getstream-go/v6 |
Go modules |
| Java | io.getstream:stream-sdk-java |
Maven Central |
| Ruby | getstream-ruby |
RubyGems |
| PHP | getstream/getstream-php |
Packagist |
| .NET | getstream-net |
NuGet |
Full source code for every SDK is on the GetStream GitHub organization. If Stream has no SDK for your language, use the REST API directly.
Installation
npm install @stream-io/node-sdk
# or
yarn add @stream-io/node-sdkpip install getstreamgem install getstream-ruby
# or in your Gemfile
gem 'getstream-ruby'composer require getstream/getstream-phpgo get github.com/GetStream/getstream-go/v6dotnet add package getstream-net// Gradle
dependencies {
implementation("io.getstream:stream-sdk-java:$version")
}Creating a client
Construct the client with your API key and secret. Both are in your Stream Dashboard. The secret grants full access to the API, so it must never leave your server.
import { StreamClient } from "@stream-io/node-sdk";
// or: const { StreamClient } = require("@stream-io/node-sdk");
const client = new StreamClient("your_api_key", "your_api_secret");from getstream import Stream
client = Stream(api_key="your_api_key", api_secret="your_api_secret")require 'getstream_ruby'
client = GetStreamRuby::Client.new(
api_key: 'your_api_key',
api_secret: 'your_api_secret'
)use GetStream\ClientBuilder;
$client = (new ClientBuilder())
->apiKey('your_api_key')
->apiSecret('your_api_secret')
->build();import "github.com/GetStream/getstream-go/v6"
client, err := getstream.NewClient("your_api_key", "your_api_secret")using GetStream;
var client = new StreamClient("your_api_key", "your_api_secret");import io.getstream.services.framework.StreamSDKClient;
// Reads credentials from the STREAM_API_KEY and STREAM_API_SECRET
// environment variables, or from the io.getstream.apiKey and
// io.getstream.apiSecret properties:
var client = new StreamSDKClient();
// Or pass them explicitly:
var client = new StreamSDKClient("your_api_key", "your_api_secret");Construct one client when your process starts and reuse it everywhere. The client is safe to share and maintains one HTTP connection pool for all products. See Connection pooling for the pool and timeout settings you can pass at construction.
One client, every product
App-level operations live directly on the client: users, tokens, app settings and async tasks. Product-specific operations hang off a product namespace, such as client.chat in Python or client.Chat() in Go.
The first server-side task in most integrations is minting a token that lets a user connect from your app. Authentication and tokens covers that end to end.
Shared behavior
The SDKs behave the same way across languages, and this section documents that behavior once:
- Error handling: the typed exception hierarchy every SDK raises.
- Logging: structured log events with identical field names in every language.
- Async operations: waiting on long-running tasks.
- Rate limits: reading limit headers and handling 429 responses.