# Install SDK

Source: https://developers.bitgo.com/docs/get-started-sdk-install

## Overview

The BitGo <a href="https://github.com/BitGo/BitGoJS" target="_blank" rel="noreferrer">JavaScript SDK</a> and <a href="https://www.npmjs.com/package/bitgo" target="_blank" rel="noreferrer">npm libraries</a> enable you to build apps and services for all the [Coins and Tokens](/coins) that BitGo supports. The SDK is an out-of-the-box solution that runs in a browser or Node.js and solves complicated transactional logic required to integrate BitGo REST APIs.

You can use the SDK to:

* Create and manage wallets and addresses.
* Create and execute secure, co-signed transactions.
* Create, store, and interact with tokens and NFTs.
* Implement personal on-premise servers in conjunction with the BitGo Express package for secure interactions with the BitGo Platform.
* Sign keys offsite and send transactional data confidently to BitGo APIs.

You have 2 options for installing the SDK:

* **Modular** - Integrate only the coins you need.
* **All Coins** - Integrate all coins that BitGo supports.

> 📘 **Note**
>
> BitGo recommends you implement a modular integration for the following benefits:
>* Better compatibility in resource-constrained environments (such as running in AWS lambda)
>* Reduce dependency exposure
>* Smaller install and memory footprint

## Prerequisites

* Set up a BitGo account in the test [Environment](/docs/get-started-environments).
* [Create Access Tokens](/docs/get-started-access-tokens).
* Set up your coding environment with the following:
    * <a href="https://www.docker.com/" target="_blank" rel="noreferrer">Docker</a>
    * <a href="https://git-scm.com/" target="_blank" rel="noreferrer">Git</a>
    * <a href="https://nodejs.org/" target="_blank" rel="noreferrer">Node.js</a> version 20
    * <a href="https://github.com/nvm-sh/nvm" target="_blank" rel="noreferrer">Node Version Manager (NVM)</a>
    * <a href="https://npmjs.com/" target="_blank" rel="noreferrer">npm</a> version 3.10.10 or higher
    * Python 2.7 (required for UTXO coins)

### Core Packages

<Tabs>
<Tab title="Modular">
The following core packages enable you to integrate only the coins you need:

* <a href="https://github.com/BitGo/BitGoJS/tree/master/modules/sdk-api" target="_blank" rel="noreferrer">sdk-api</a> - Main entry point for API functionality and for registering coins asynchronously.
* <a href="https://github.com/BitGo/BitGoJS/tree/master/modules" target="_blank" rel="noreferrer">sdk-coin-\{name\}</a> - Implementation and dependencies necessary to interact with BitGo APIs and coin blockchains (such as mainnet, testnet, and any related tokens).
</Tab>
<Tab title="All Coins">
This following core package enables you to integrate all the coins that BitGo supports.

* <a href="https://github.com/BitGo/BitGoJS/tree/master/modules/bitgo" target="_blank" rel="noreferrer">bitgo</a> - Authentication, wallet management, user authentication, cryptographic primitives, abstract coin interfaces, and all supported coin implementations.
</Tab>
</Tabs>

## Steps

### 1. Install TypeScript

```shell CLI
npm install -g typescript
```

### 2. Configure Your `.env` File

Create an `.env` file in the root directory of your project and add the following environment variables:

```shell CLI
ACCESS_TOKEN=<YOUR_ACCESS_TOKEN>
ENV=test
WALLET_PASSPHRASE=<YOUR_LOGIN_PASSPHRASE>
ENTERPRISE_ID=<YOUR_ENTERPRISE_ID>
BITGO_EXPRESS_URL=<YOUR_LOCAL_HOST>
```

### 3. Install Dependencies

```shell CLI
npm install axios zod cuid dotenv readline
```

### 4. Install Core Packages

```shell CLI (all coins)
# Main entry point for API functionality
npm install bitgo
```
```shell CLI (modular)
# Main entry point for API functionality
npm install @bitgo/sdk-api
# Individual coin module
# For example, btc would be sdk-coin-btc
npm install @bitgo/sdk-coin-{name}
```

### 5. Use Core Packages

```shell CLI (all coins)
import { BitGo } from 'bitgo';
const sdk = new BitGo();
```
```ts TypeScript (modular)
import { BitGoAPI } from '@bitgo/sdk-api';
import { register } from '@bitgo/sdk-coin-sol';

const sdk = new BitGoAPI();

// Registers all coins and tokens from the module (e.g. Sol, Tsol)
register(sdk);
```

> 👍 **Tip**
>
> Each coin module's `register` function automatically registers all coins and tokens from that module, including testnet variants. This is the recommended approach for modular installs.

<details>
<summary>Legacy per-coin registration</summary>

You can also register individual coins manually:

```ts TypeScript (modular)
import { BitGoAPI } from '@bitgo/sdk-api';
import { Btc } from '@bitgo/sdk-coin-btc';

const sdk = new BitGoAPI();

// You must register testnet coins separately (e.g. Tbtc4 instead of Btc)
sdk.register('btc', Btc.createInstance);
```

</details>

### 6. Verify Your Installation

After installing the SDK, confirm it's working:

```shell CLI
node -e "const BitGoJS = require('bitgo'); console.log('BitGo SDK loaded successfully');"
```

If you installed modularly:

```shell CLI
node -e "const { BitGo } = require('@bitgo/sdk-core'); console.log('BitGo SDK Core loaded successfully');"
```

### 7. Run Your First SDK Script

Create a file called `get-started.js` and paste the following:

```js JavaScript
const BitGoJS = require('bitgo');

async function main() {
  const bitgo = new BitGoJS.BitGo({
    env: 'test',
    accessToken: process.env.BITGO_ACCESS_TOKEN,
  });

  // Verify authentication by fetching your user profile
  const user = await bitgo.me();
  console.log('Authenticated as:', user.username);
  console.log('User ID:', user.id);
}

main().catch(console.error);
```

Run it:

```shell CLI
export BITGO_ACCESS_TOKEN="v2x..."
node get-started.js
```

#### Step Result

```text
Authenticated as: you@example.com
User ID: 62ab90e06dfda30007974f0a52a12995
```

## Next Steps

1. Get notified about new releases by configuring your watch settings for the <a href="https://github.com/BitGo/BitGoJS" target="_blank" rel="noreferrer">JavaScript SDK</a> repo. Select **Watch** > **Custom** > **Releases**.
1. [Create Wallets](/docs/wallets-create-wallets).

## See Also

* <a href="https://github.com/BitGo/BitGoJS/" target="_blank" rel="noreferrer">GitHub Repo: BitGo JavaScript SDK</a>
* <a href="https://www.npmjs.com/package/bitgo" target="_blank" rel="noreferrer">Node Package Manager (npm): BitGo Libraries</a>
* [Update SDK](/docs/get-started-sdk-update)
* [API Reference](https://developers.bitgo.com/reference)
