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_/sk_test_ 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/http
Use in serverless / edge runtimes (Lambda, Cloudflare Workers, Vercel Edge). Pure fetch, zero deps.
@mrdoge/protocol
Schemas and TypeScript types only. Useful for codegen, validation, or building tools on top of the protocol.
Install
npm i @mrdoge/nodepnpm add @mrdoge/nodeyarn add @mrdoge/nodebun add @mrdoge/nodenpm i @mrdoge/clientpnpm add @mrdoge/clientyarn add @mrdoge/clientbun add @mrdoge/clientnpm i @mrdoge/httppnpm add @mrdoge/httpyarn add @mrdoge/httpbun add @mrdoge/httpCreate 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,
});import { MrDoge } from "@mrdoge/client";
const mrdoge = new MrDoge({
// your backend route that mints short-lived JWTs
authEndpoint: "/api/mrdoge/token",
});
const sub = await mrdoge.matches.subscribeLive({ sports: ["soccer"] });
sub.on("match.upd", (match) => render(match));import { createHttpClient } from "@mrdoge/http";
const mrdoge = createHttpClient({
apiKey: process.env.MRDOGE_API_KEY!,
});
const { data: picks } = await mrdoge.call("ai.picks.list", {
date: "2026-05-18",
limit: 20,
});Get an API key
Head to your dashboard to mint an sk_live_… key.
You'll get one for testing (sk_test_…) and one for production. Both
share the same tier and rate limit.
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_… or sk_test_…. |
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. |