Skip to main content

Game Service Setup Guide

If you do not have game services set up yet, you can clone the game service template and complete the setup using the instructions below.

The template is built using the NestJS framework. To get started, follow these steps:

Step 1. Install Dependencies

To install the necessary dependencies, use one of the following commands:

yarn

or if using npm:

npm install

Step 2. Configure the Database

After installing dependencies, set up the database using PostgreSQL. Define the following environment variables in your .env file to configure the database connection:

Example:

DB_TYPE=postgres
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=local-database-test

Step 3. Fill in the Environment Variables

In your initial setup, you can set the PUBLIC_RSA_KEY and PRIVATE_RSA_KEY to N/A so that the service can start:

PUBLIC_RSA_KEY=N/A
PRIVATE_RSA_KEY=N/A
DEVELOPER_API_KEY="YOUR_DEVELOPER_API_KEY"

Step 4. Run the service

Once your environment variables are set, run the following command to start the service in development mode:

yarn start:dev

or if using npm:

npm run dev

Step 5. Access the swagger in local server.

After the service starts successfully, you can access the Swagger documentation at:

http://localhost:3001/documentation

There should have full list of setup API for interact with Unity client

Step 6. Generate RSA Key Pairs

From here, you can use the leaderboards/generate-keys endpoint to generate your RSA public and private keys.

Example Link: http://localhost:3001/documentation#/leaderboard/LeaderboardController_generateRSAKeys

Example :

  1. Endpoint for generate RSA Key pairs.

generate-rsa-key-pairs-step-1

  1. Generate RSA Keypair though local endpoint.

generate-rsa-key-pairs-step-2

Step 7. Update the Environment with RSA Keys

Once the RSA key pairs are generated, update your .env file with the following:

PUBLIC_RSA_KEY=your_generated_public_key
PRIVATE_RSA_KEY=your_generated_private_key

Put the Developer API Key in the .env file.

DEVELOPER_API_KEY=Your_developer_api_key

Step 8. Configure Unity Client

Ensure that you configure the Myria Leaderboard SDK in Unity by passing the PUBLIC_RSA_KEY in the SDK config to enable secure communication with the backend.

By following these steps, your backend service should be successfully set up and ready to integrate with your Unity game.