Skip to content

Getting Started

Our SDK is a modern, open-source, dependency-free JavaScript SDK for PlayFab that supports Promises, ES Modules, tree-shaking, and custom request middleware.

Install the SDK using npm:

Terminal window
npm install @community-fabs/playfab-sdk

Create a PlayFab client by providing your title ID and developer secret key.

import { initializePlayFab } from '@community-fabs/playfab-sdk/core';
const playfab = initializePlayFab({
titleId: 'YOUR_TITLE_ID',
developerSecretKey: 'YOUR_DEV_SECRET_KEY',
});

Import the API suite you want to use and create a client instance.

import getClientApi from '@community-fabs/playfab-sdk/client';
const clientApi = getClientApi(playfab);

All SDK methods return Promises and can be used with async/await.

await clientApi.loginWithCustomID({
CustomId: 'test-custom-id',
});
import { initializePlayFab } from '@community-fabs/playfab-sdk/core';
import getClientApi from '@community-fabs/playfab-sdk/client';
const playfab = initializePlayFab({
titleId: 'YOUR_TITLE_ID',
developerSecretKey: 'YOUR_DEV_SECRET_KEY',
});
const clientApi = getClientApi(playfab);
const result = await clientApi.loginWithCustomID({
CustomId: 'test-custom-id',
});
console.log(result);
  • Learn how to configure custom middleware for logging, retries, and request customization.
  • Explore the available PlayFab API suites.