Open Game Backend generates a unique SDK for your backend with type-safe methods to call your scripts.

Setup

Godot, Unity, Unreal, and Rust SDKs coming soon.

JavaScript & TypeScript

1

Generating SDK

Replace <output> with the path where you want to generate the SDK.

opengb sdk generate --output <output> typescript
2

Install SDK

Replace ./path/to/sdk with the path to the generated SDK.

3

Initiate SDK

import { BackendApi } from "opengb-sdk";
const backend = new BackendApi({});

The default SDK connects to http://localhost:8080 by default (where opengb dev runs).

4

Call script

const data = await backend.callUsersGetUser({ userIds });
console.log("Users", data.users);