Skip to main content

Choose Your SDK

Mirador provides two SDKs depending on your environment:

Web SDK

For browser-based applications

Node.js SDK

For server-side applications
SDKs for Python, Go, Rust, and other languages are currently in development. Contact us if you’re interested in early access.

Web SDK

Install the Mirador Web SDK for browser-based applications:
npm install @miradorlabs/web-sdk

Initialize the Web Client

import { Client } from '@miradorlabs/web-sdk';

const client = new Client('your-api-key');

Node.js SDK

Install the Mirador Node.js SDK for server-side applications:
npm install @miradorlabs/nodejs-sdk

Initialize the Node.js Client

import { Client } from '@miradorlabs/nodejs-sdk';

const client = new Client('your-api-key');

Configuration

Custom Gateway URL

If you’re using a self-hosted gateway or different environment: Web SDK:
import { Client } from '@miradorlabs/web-sdk';

const client = new Client('your-api-key', {
  apiUrl: 'https://your-gateway.example.com:443'
});
Node.js SDK:
import { Client } from '@miradorlabs/nodejs-sdk';

const client = new Client('your-api-key', {
  apiUrl: 'https://your-gateway.example.com:443'
});

Custom Keep-Alive Interval

Both SDKs support configurable keep-alive intervals:
const client = new Client('your-api-key', {
  keepAliveIntervalMs: 15000  // Ping every 15 seconds (default: 10000)
});

Module Formats (Web SDK Only)

The Web SDK provides multiple module formats:
FormatFileUse Case
ESMdist/index.esm.jsModern bundlers (Webpack, Vite, Rollup)
UMDdist/index.umd.jsBrowser globals, older module systems
TypeScriptdist/index.d.tsType definitions

ESM Import

import { Client } from '@miradorlabs/web-sdk';

UMD / Browser Global

<script src="path/to/@miradorlabs/web-sdk/dist/index.umd.js"></script>
<script>
  const client = new MiradorWeb.Client('your-api-key');
</script>

Browser Requirements

The SDK requires modern browser features:
  • ES2020+ - Modern JavaScript syntax
  • Fetch API - For network requests
  • Promises - For async operations

Supported Browsers

BrowserMinimum Version
Chrome80+
Firefox75+
Safari13.1+
Edge80+

Polyfills

For older browsers, you may need to include polyfills:
npm install core-js whatwg-fetch
import 'core-js/stable';
import 'whatwg-fetch';
import { Client } from '@miradorlabs/web-sdk';

Verifying Installation

Test that the SDK is working: Web SDK:
import { Client } from '@miradorlabs/web-sdk';

const client = new Client('your-api-key');
const trace = client.trace({ name: 'TestTrace' })
  .addEvent('installation_verified');

console.log('Web SDK installed successfully!');
Node.js SDK:
import { Client } from '@miradorlabs/nodejs-sdk';

const client = new Client('your-api-key');
const trace = client.trace({ name: 'TestTrace' })
  .addEvent('installation_verified');

await trace.create();
console.log('Node.js SDK installed successfully!');

Next Steps

Quickstart

Build your first trace