# 安裝

## Installation

{% tabs %}
{% tab title="Yarn" %}

```bash
$ yarn add @qubic-connect/core
```

```javascript
import QubicConnect from '@qubic-connect/core';
```

{% endtab %}

{% tab title="NPM" %}

```bash
$ npm install @qubic-connect/core
```

```javascript
import QubicConnect from '@qubic-connect/core';
```

{% endtab %}

{% tab title="CDN" %}

```html
<script type="text/javascript" src="https://unpkg.com/@qubic-connect/core"></script>
```

{% endtab %}
{% endtabs %}

## Initialize

{% hint style="info" %}
**哪裏可以找到 API key 和 secret？**

如果你已經訂閱或購買 Qubic Creator 的服務，請前往 [Qubic Creator Admin 後台](https://admin.qubic.market/developer)，並找到左側側邊欄中的 [開發者工具](https://admin.qubic.market/developer)，接著找到 **Creator Storefront API & Qubic Connect SDK**，點擊 **建立 Creator Storefront API & Qubic Connect SDK**，即可獲得 API key 和 secret。
{% endhint %}

```javascript
const qubicConnect = new QubicConnect({
  name: 'Display Name',
  key: 'API_KEY',
  secret: 'API_SECRET',
});
```

{% hint style="warning" %}
如果你使用 React 或相似的 Framework，你可能需要在全域環境或 Context 中執行以上初始化的程式碼片段。

請避免在同一個生命週期中重複初始化，可能會造成無法預期的錯誤。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://qubic.gitbook.io/docs/guides/qubic-connect-sdk/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
