# Overview

## Portex SDK (beta)

### Install

* inline `https://sdk.portex.app/portex-sdk.min.js` to your mini-game
* or build from source code

```bash
git clone https://github.com/portex-app/portex-sdk.git
cd portex-sdk

pnpm install
pnpm build
```

### Usage

> Note: this is a beta version, you can only use it in telegram. get app-id from [Portex CLI](https://portex-app.gitbook.io/docs/cli/overview)

* initialize Portex SDK with your app-id

```javascript
const portex = new Portex({
	appId: 'your-app-id',
})

try {
	const result = await portex.init()

	if (result.status === 'ok') {
		// init success
		// get user info
		consle.log(sdk.webApp.initDataUnsafe)
	} else {
		// init failed
	}
} catch (error) {
	console.error(error)
}
```

* SDK Demo: <https://t.me/portex\\_app\\_bot?startapp>

### SDK Features

* [Social Invite](https://github.com/portex-app/docs/blob/main/en/sdk/sdk/social.md)
* [Payment](https://github.com/portex-app/docs/blob/main/en/sdk/sdk/payment.md)
* [leaderboard](https://portex-app.gitbook.io/docs/sdk/leaderboard)
* [Game Record](https://portex-app.gitbook.io/docs/sdk/game-record)
* [Webapp Adapter](https://github.com/portex-app/docs/blob/main/en/sdk/sdk/webapp.md)
* ads (coming soon)

### API Reference

* [Portex SDK API](https://sdk.portex.app/docs/index.html)

### Source

{% @github-files/github-code-block url="<https://github.com/portex-app/portex-sdk>" %}
