> ## Documentation Index
> Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup Client

> Learn how to setup the TypeScript SDK.

### Prerequisites

We require node version 18 or later version and npm version 8 to be installed in your environment. To install node and npm, we recommend you go to the [Node.js official website](https://nodejs.org) and download the latest LTS (Long Term Support) version.

### Install the Dependencies

Install the [Story SDK](https://www.npmjs.com/package/@story-protocol/core-sdk) node package, as well as [viem](https://www.npmjs.com/package/viem).

<CodeGroup>
  ```bash npm theme={null}
  npm install --save @story-protocol/core-sdk viem
  ```

  ```bash pnpm theme={null}
  pnpm install @story-protocol/core-sdk viem
  ```

  ```bash yarn theme={null}
  yarn add @story-protocol/core-sdk viem
  ```
</CodeGroup>

## Initiate SDK Client

Next we can initiate the SDK Client. There are two ways to do this:

1. Using a private key (preferable for some backend admin)
2. JSON-RPC account like Metamask where users sign their own transactions

### Set Up Private Key Account

<CardGroup cols={1}>
  <Card title="Working Example" href="https://github.com/storyprotocol/typescript-tutorial/blob/main/utils/config.ts" icon="thumbs-up">
    Check out the TypeScript Tutorial for a working example of how to set up the
    Story SDK Client.
  </Card>
</CardGroup>

Before continuing with the code below:

1. Make sure to have `WALLET_PRIVATE_KEY` set up in your `.env` file.
   * Don’t forget to fund the wallet with some testnet tokens from a [Faucet](/network/network-info/aeneid#faucet)
2. Make sure to have `RPC_PROVIDER_URL` set up in your `.env` file.
   * You can use the public default one (`https://aeneid.storyrpc.io`) or check out the other RPCs [here](/network/network-info/aeneid#rpcs).

```typescript utils.ts theme={null}
import { http } from "viem";
import { Account, privateKeyToAccount, Address } from "viem/accounts";
import { StoryClient, StoryConfig } from "@story-protocol/core-sdk";

const privateKey: Address = `0x${process.env.WALLET_PRIVATE_KEY}`;
const account: Account = privateKeyToAccount(privateKey);

const config: StoryConfig = {
  account: account, // the account object from above
  transport: http(process.env.RPC_PROVIDER_URL),
  chainId: "aeneid",
};
export const client = StoryClient.newClient(config);
```

### Setup for React (ex. Metamask)

The [React Setup Guide](/developers/react-guide/setup/overview) shows how we can also use the TypeScript SDK to delay signing & sending transactions to a JSON-RPC account like Metamask.
