Installation
Pick the package that fits your runtime, server, browser, or edge.
The Mr. Doge SDK ships as four packages. Pick one: they all expose the same resource surface; the difference is how you authenticate and what runtime they target.
Which package?
@mrdoge/node
Use on your backend. Authenticates with sk_live_… API keys. Both HTTP and WebSocket.
@mrdoge/client
Use in browsers, React Native, or any client where you must NOT embed an API key. Auth via short-lived JWTs.
@mrdoge/react
Using React? Start here instead: hooks wrapping @mrdoge/client, backed by a shared cache. See the dedicated installation guide.
@mrdoge/http
Use in serverless / edge runtimes (Lambda, Cloudflare Workers, Vercel Edge). Pure fetch, zero deps.
Install
npm install @mrdoge/nodeCreate a client
import { MrDoge } from "@mrdoge/node";
const mrdoge = new MrDoge({
apiKey: process.env.MRDOGE_API_KEY!,
});
const { data: matches } = await mrdoge.matches.list({
sports: ["soccer"],
limit: 10,
});Get an API key
Head to your dashboard to mint an sk_live_… key.
Keys share your account's tier and rate limit, and you can mint additional
keys per environment so you can revoke one without affecting the others.
Never ship sk_live_… keys in client-side code. For browser or React
Native apps, the flow is two packages:
- Your backend installs
@mrdoge/nodeand exposes a token-mint route that callsmrdoge.tokens.create(). This route is the only place yoursk_live_…key ever lives. - Your frontend installs
@mrdoge/clientand points it at that route. The SDK fetches a short-lived JWT, refreshes it before expiry, and never sees the API key.
Full walkthrough in authentication.
Constructor options
Both @mrdoge/node and @mrdoge/client accept a few common options:
| Option | Type | Notes |
|---|---|---|
baseUrl | string | Server URL override. Default wss://api.mrdoge.co/sdk/v1. |
locale | string | Default locale, e.g. "en", "pt-BR", "es". |
timezone | string | Default timezone (IANA), e.g. "America/Sao_Paulo". |
requestTimeoutMs | number | Per-call timeout. Default 10000. |
maxReconnectAttempts | number | Reconnect cap. Default Infinity. |
Node-specific:
| Option | Type | Notes |
|---|---|---|
apiKey | string | Required. sk_live_…. |
compression | boolean | permessage-deflate on WS. Default true. |
Client-specific:
| Option | Type | Notes |
|---|---|---|
authEndpoint | string | URL to POST for tokens. Required (or fetchToken). |
fetchToken | () => Promise<{token, expiresAt}> | Custom token fetcher. |
authHeaders | Record<string,string> | Extra headers on the auth POST. |
refreshLeewaySec | number | Seconds before expiry to refresh. Default 30. |