Skip to main content

Quick Started

Quick start guide for Leaderboard SDK Typescript

Step 1: Request Developer API Key

Before you begin, ensure you have an Admin API Key provided by Myria. You can obtain this key by contacting Myria Admin via our official Telegram channel or through the Support Zendesk channel.

Step 2: Set Up Your Backend

To integrate the leaderboard SDK, you need a backend built with a JavaScript-based runtime like Node.js. If you don’t have a backend set up yet, make sure you have a Node.js environment ready, or consider using a JavaScript-based framework like Nest.js or Express for a more structured and scalable application.

For more detailed examples and guidance on implementing the Myria Leaderboard SDK, please refer to our TypeScript SDK samples on GitHub here. This repository includes practical examples demonstrating how to create, manage, and interact with leaderboards, making it easier for you to integrate leaderboard functionality into your projects.

Step 3: Install and Use the SDK

Once your backend is ready, follow these steps:

3.1 Install the SDK

Install the @myria/leaderboard-ts-sdk package via npm:

npm install @myria/leaderboard-ts-sdk

or via yarn:

yarn install @myria/leaderboard-ts-sdk

3.2 Initialize and Create a Leaderboard

After installation, use your Developer API Key to interact with the Myria Leaderboard services. Here’s an example of how to create a leaderboard:

import { LeaderboardManager, InitLeaderboardParams } from '@myria/leaderboard-ts-sdk';

const developerApiKey = "YOUR_DEVELOPER_API_KEY";

const leaderboardParams: InitLeaderboardParams = {
env: 'STAGING', // Use your desired environment type
apiKey: developerApiKey,
};

const leaderboardManager = new LeaderboardManager(initLeaderboardParams);

async function createLeaderboard() {
const response = await leaderboardManager.create({
name: 'Your Leaderboard Name',
// additional configuration options
});

console.log('Leaderboard created:', response);
}