Mr. Doge

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/node

Create 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/node and exposes a token-mint route that calls mrdoge.tokens.create(). This route is the only place your sk_live_… key ever lives.
  • Your frontend installs @mrdoge/client and 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:

OptionTypeNotes
baseUrlstringServer URL override. Default wss://api.mrdoge.co/sdk/v1.
localestringDefault locale, e.g. "en", "pt-BR", "es".
timezonestringDefault timezone (IANA), e.g. "America/Sao_Paulo".
requestTimeoutMsnumberPer-call timeout. Default 10000.
maxReconnectAttemptsnumberReconnect cap. Default Infinity.

Node-specific:

OptionTypeNotes
apiKeystringRequired. sk_live_….
compressionbooleanpermessage-deflate on WS. Default true.

Client-specific:

OptionTypeNotes
authEndpointstringURL to POST for tokens. Required (or fetchToken).
fetchToken() => Promise<{token, expiresAt}>Custom token fetcher.
authHeadersRecord<string,string>Extra headers on the auth POST.
refreshLeewaySecnumberSeconds before expiry to refresh. Default 30.

Next

On this page