EthioConnect JavaScript SDK
Monorepo workspace containing the official JavaScript/TypeScript SDK for the EthioConnect platform. The SDK is split into three npm packages separated by trust boundary and runtime target.
Packages
| Package | Description | Runtime |
|---|---|---|
@comm-baas/types | Shared TypeScript type definitions derived from API contracts. Zero runtime code. | Any |
@comm-baas/server-sdk | Server-side client for token minting, room management, presence, analytics, and billing. Authenticates with a tenant API key. | Node 18+ |
@comm-baas/client-sdk | Browser client providing authenticated HTTP access and WebSocket signaling with session resume. Authenticates with a short-lived JWT. | Browser |
@comm-baas/react | React hooks and context providers wrapping the client SDK. | Browser (React 18+) |
Architecture
Your Backend Browser
============ =======
@comm-baas/server-sdk @comm-baas/client-sdk
| |
| ApiKey auth | Bearer JWT auth
v v
EthioConnect API <-- types --> EthioConnect API
|
| WebSocket signaling
v
LiveKit SFU (media)
The server SDK runs exclusively on your backend and holds the tenant API key. It mints short-lived JWTs for end-users. The client SDK runs in the browser, authenticates with those JWTs, and manages the WebSocket signaling connection. Both packages depend on @comm-baas/types for shared type definitions.
Quick Start
1. Install packages
On your backend (Node.js):
npm install @comm-baas/server-sdk
In your frontend project (browser):
npm install @comm-baas/client-sdk livekit-client
The @comm-baas/types package is installed automatically as a dependency of both SDKs.
2. Mint a token on your server
import { CommBaasServer } from '@comm-baas/server-sdk';
const server = new CommBaasServer({
apiKey: process.env.COMM_BAAS_API_KEY!,
baseUrl: 'https://api.comm-baas.example.com',
});
const room = await server.rooms.create({
display_name: 'Team Standup',
max_participants: 10,
});
const { access_token } = await server.auth.mintToken({
user_id: 'usr_123',
display_name: 'Alice',
});
3. Join a room from the browser
import { CommBaasClient, SignalingConnection } from '@comm-baas/client-sdk';
const client = new CommBaasClient({
baseUrl: 'https://api.comm-baas.example.com/v1',
token: accessToken,
});
const http = client.getHttpClient();
const join = await http.post('/rooms/room_abc/join');
const signaling = new SignalingConnection(
join.signal_url,
join.signal_ticket,
);
signaling.on('hello', (msg) => {
console.log('Connected, session:', msg.session_id);
});
signaling.connect();
Development
This workspace uses npm workspaces. From the sdks/js/ root:
npm install # Install all dependencies
npm run build # Build all packages (types first, then SDKs)
npm run lint # Run linting
npm run typecheck # Type-check all packages
npm run test # Run tests
Versioning
All packages follow lockstep versioning. When any package changes, all are published with the same version number, guaranteeing type compatibility.