# @mixin.dev/mixin-node-sdk

> Mixin SDK for Node.js and Javascript

Latest version **7.6.0** (published 2026-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mixin.dev/mixin-node-sdk
pnpm add @mixin.dev/mixin-node-sdk
yarn add @mixin.dev/mixin-node-sdk
bun add @mixin.dev/mixin-node-sdk
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.6.0 |
| Published | 2026-09-18 |
| First published | 2022-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 15 |
| Unpacked size | 346 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | contact@mixin.one |
| Maintainers | crossle, jadeydi, hundredark, yeungkc |
| Keywords | mixin, node, blockchain, crypto, js |

## Links

- npm: https://www.npmjs.com/package/@mixin.dev/mixin-node-sdk
- Repository: https://github.com/MixinNetwork/bot-api-nodejs-client
- Homepage: https://github.com/MixinNetwork/bot-api-nodejs-client#readme
- Issues: https://github.com/MixinNetwork/bot-api-nodejs-client/issues
- npm.io page: https://npm.io/package/@mixin.dev/mixin-node-sdk

## Dependencies (15)

- [ws](https://npm.io/package/ws.md) ^8.21.3
- [md5](https://npm.io/package/md5.md) ^2.3.0
- [bs58](https://npm.io/package/bs58.md) ^6.0.0
- [pako](https://npm.io/package/pako.md) ^2.2.0
- [uuid](https://npm.io/package/uuid.md) ^14.0.2
- [axios](https://npm.io/package/axios.md) ^1.20.0
- [axios-retry](https://npm.io/package/axios-retry.md) 4.5.0
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^11.1.5
- [int64-buffer](https://npm.io/package/int64-buffer.md) ^1.1.2
- [nano-seconds](https://npm.io/package/nano-seconds.md) ^1.2.2
- [@noble/curves](https://npm.io/package/@noble/curves.md) ^2.4.0
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^2.4.0
- [@noble/ciphers](https://npm.io/package/@noble/ciphers.md) ^2.4.0
- [is-retry-allowed](https://npm.io/package/is-retry-allowed.md) ^3.0.0
- [serialize-javascript](https://npm.io/package/serialize-javascript.md) ^7.1.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 7.6.0 (latest) — 2026-09-18
- 7.5.6 — 2026-08-24
- 7.5.5 — 2026-08-10
- 7.5.4 — 2026-07-22
- 7.5.3 — 2026-05-12
- 7.5.2 — 2026-04-14
- 7.5.1 — 2026-04-07
- 7.5.0 — 2026-03-18
- 7.4.9 — 2025-12-26
- 7.4.8 — 2025-12-26
- 7.4.7 — 2025-11-06
- 7.4.6 — 2025-09-17
- 7.4.5 — 2025-08-19
- 7.4.4 — 2025-08-11
- 7.4.3 — 2025-08-01
- … 46 more at https://npm.io/package/@mixin.dev/mixin-node-sdk/versions

## README

# bot-api-nodejs-client

The Node.js version of the mixin SDK [https://developers.mixin.one/docs/api-overview](https://developers.mixin.one/docs/api-overview)

[中文版](./README.zh-CN.md)

## New version features

1. More friendly type and code hints
2. More standardized function naming
3. More comprehensive test coverage

## Install

```shell
npm install @mixin.dev/mixin-node-sdk
```

If you use `yarn`

```shell
yarn add @mixin.dev/mixin-node-sdk
```

## Usage

1. Use Mixin API

```js
const { MixinApi } = require('@mixin.dev/mixin-node-sdk');

const keystore = {
  app_id: '',
  session_id: '',
  server_public_key: '',
  session_private_key: '',
};
const client = MixinApi({ keystore });

// Use Promise
client.user.profile().then(console.log);
// Use async await
async function getMe() {
  const me = await client.user.profile();
  console.log(me);
}
```

2. Receive Mixin Messenger messages

```js
const { BlazeKeystoreClient } = require('@mixin.dev/mixin-node-sdk/blaze');

const keystore = {
  app_id: '',
  session_id: '',
  server_public_key: '',
  session_private_key: '',
};
const config = {
  parse: true,
  syncAck: true,
};

const client = BlazeKeystoreClient(keystore, config);
client.loop({
  onMessage(msg) {
    console.log(msg);
  },
});
```

3. OAuth

```js
const { MixinApi, getED25519KeyPair, base64RawURLEncode } = require('@mixin.dev/mixin-node-sdk');

const code = ''; // from OAuth url
const app_id = ''; // app_id of your bot
const client_secret = ''; // OAuth Client Secret of your bot

const { seed, publicKey } = getED25519KeyPair(); // Generate random seed and ed25519 key pairs

let client = MixinApi();
const { scope, authorization_id } = await client.oauth.getToken({
  client_id: app_id,
  code,
  ed25519: base64RawURLEncode(publicKey),
  client_secret,
});
const keystore = {
  app_id,
  scope,
  authorization_id,
  session_private_key: Buffer.from(seed).toString('hex'),
};
client = MixinApi({ keystore });
const user = await client.user.profile();
```

## Use the sdk in web browser

This SDK uses node `Buffer`, which is not available in web browser. You can use polyfills to make it work.

For example, you can use `vite-plugin-node-polyfills` for vite.

```js
// vite.config.js
import { nodePolyfills } from 'vite-plugin-node-polyfills';
// ...
export default defineConfig({
  // ...
  plugins: [
    nodePolyfills({
      globals: {
        Buffer: true,
      },
    }),
  ],
});
```

## License

```
Copyright 2024 Mixin.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

---
_Source: https://npm.io/package/@mixin.dev/mixin-node-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
