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

# Getting started with @turnkey/core

> Learn how to set up `@turnkey/core` in your frontend JavaScript application. This page will guide you through creating a Turnkey organization, configuring authentication, installing the SDK, and initializing the client.

## Turnkey organization setup

To start, you must create a Turnkey organization via the [Turnkey dashboard](https://app.turnkey.com). The steps are described in the [Account Setup](/getting-started/quickstart) section.

For this setup, we will use Turnkey's **Auth Proxy** to handle authentication. You can enable and configure this through the Turnkey dashboard.

<Steps>
  <Step title="Enable auth proxy">
    Navigate to the **Auth** section in the Turnkey dashboard and enable the
    **Auth Proxy**.

    <img src="https://mintcdn.com/turnkey-0e7c1f5b/b0fOk4Hn036S1cMU/images/getting-started/img/quickstart/auth-proxy-toggle.png?fit=max&auto=format&n=b0fOk4Hn036S1cMU&q=85&s=ea9ead0f15628dcdde3ae464b0b05893" alt="Auth Proxy toggle" width="1118" height="198" data-path="images/getting-started/img/quickstart/auth-proxy-toggle.png" />
  </Step>

  <Step title="Customize auth methods">
    You can choose which auth methods to enable and customize various options from
    this screen. For this quickstart, let's enable **email OTP**.
    When you're done, click **Save**.

    <img src="https://mintcdn.com/turnkey-0e7c1f5b/b0fOk4Hn036S1cMU/images/getting-started/img/quickstart/auth-proxy-options.png?fit=max&auto=format&n=b0fOk4Hn036S1cMU&q=85&s=9cb6b26d526e466318ce9e51982103b8" alt="Auth Proxy options" width="882" height="1137" data-path="images/getting-started/img/quickstart/auth-proxy-options.png" />
  </Step>

  <Step title="Finish up">
    Once you're finished with the auth proxy setup, copy your **Auth Proxy Config ID** and your **Organization ID** from the dashboard.

    <img src="https://mintcdn.com/turnkey-0e7c1f5b/b0fOk4Hn036S1cMU/images/getting-started/img/quickstart/auth-proxy-id.png?fit=max&auto=format&n=b0fOk4Hn036S1cMU&q=85&s=ded58859ffae79a0a8a35265c0f9e2a4" alt="Auth Proxy Config id" width="487" height="96" data-path="images/getting-started/img/quickstart/auth-proxy-id.png" />

    <img src="https://mintcdn.com/turnkey-0e7c1f5b/5sbBAG4Yfd-9P7Ds/images/getting-started/img/quickstart/org-id.png?fit=max&auto=format&n=5sbBAG4Yfd-9P7Ds&q=85&s=3502928686ad2e72458b6262d69e5095" alt="Organization id" width="1288" height="532" data-path="images/getting-started/img/quickstart/org-id.png" />

    These values will be required to configure the SDK in your app.
  </Step>
</Steps>

***

## Installation

Install the Turnkey Core SDK into your project:

<CodeGroup>
  ```bash npm theme={"system"}
  npm install @turnkey/core
  ```

  ```bash pnpm theme={"system"}
  pnpm add @turnkey/core
  ```

  ```bash yarn theme={"system"}
  yarn add @turnkey/core
  ```
</CodeGroup>

## React Native setup

If you're using React Native, there's some additional setup required. You can skip this section if you're using a web framework.

<Steps>
  <Step title="Install peer dependencies">
    Install the following peer dependencies.

    <CodeGroup>
      ```bash npm theme={"system"}
      npm install @react-native-async-storage/async-storage react-native-keychain @turnkey/react-native-passkey-stamper
      ```

      ```bash pnpm theme={"system"}
      pnpm add @react-native-async-storage/async-storage react-native-keychain @turnkey/react-native-passkey-stamper
      ```

      ```bash yarn theme={"system"}
      yarn add @react-native-async-storage/async-storage react-native-keychain @turnkey/react-native-passkey-stamper
      ```
    </CodeGroup>

    If you're not using Expo, you may need to install the iOS dependencies.

    ```bash theme={"system"}
    npx pod-install
    # or
    cd ios && pod install
    ```
  </Step>

  <Step title="Configure required polyfill">
    `@turnkey/core` requires a polyfill to work in React Native.

    Install the `react-native-get-random-values` package.

    <CodeGroup>
      ```bash npm theme={"system"}
      npm install react-native-get-random-values
      ```

      ```bash pnpm theme={"system"}
      pnpm add react-native-get-random-values
      ```

      ```bash yarn theme={"system"}
      yarn add react-native-get-random-values
      ```
    </CodeGroup>

    Then, import it at the top of your entry file (e.g. `index.js`, `entry.js` etc.). If you don't have this file, you'll need to create one.

    ```ts index.js theme={"system"}
    import 'react-native-get-random-values';
    // ... other imports

    // You may need this line if you're using Expo Router
    import 'expo-router/entry';
    ```

    You'll need to add this file to your `package.json` under the `main` field if it's not already there.

    ```json package.json theme={"system"}
    {
      "main": "index.js", // May be named differently in your project
      // ... other fields
    }
    ```
  </Step>
</Steps>

## Client initialization

Unlike `@turnkey/react-wallet-kit`, `@turnkey/core` doesn't provide a React provider or hooks — you work directly with the TurnkeyClient.

Here's a minimal setup example:

```ts theme={"system"}
import { TurnkeyClient, TurnkeyError } from "@turnkey/core";

const client = new TurnkeyClient({
  organizationId: "YOUR_ORGANIZATION_ID",
  authProxyConfigId: "YOUR_AUTH_PROXY_CONFIG_ID", // Can be omitted if you don't use the Auth Proxy
});

// Initialize the client. Required for async initialization.
await client.init();
```

## Optional configuration

The client accepts optional configuration for **passkeys** and **external browser wallets**. If omitted, those features will not be initialized.

### Passkeys

```ts theme={"system"}
const client = new TurnkeyClient({
  organizationId: "...",
  authProxyConfigId: "...",
  passkeyConfig: {
    rpId: "example.com", // Required for React Native
    timeout: 60000, // Default: 5 minutes
    userVerification: "preferred",
  },
});
```

All fields are optional in web environments.

On React Native, `rpId` is required. We recommend following [this guide](https://github.com/f-23/react-native-passkey?tab=readme-ov-file#configuration) to set up associated domains for iOS and Android.

### External browser wallets

```ts theme={"system"}
const client = new TurnkeyClient({
  organizationId: "...",
  authProxyConfigId: "...",
  walletConfig: {
    chains: {
      ethereum: {
        native: true,
        walletConnectNamespaces: ["eip155:1"], // Ethereum mainnet
      },
      solana: {
        native: true,
        walletConnectNamespaces: ["solana:mainnet"],
      },
    },

    // Optional: Configure WalletConnect. WalletConnect is used for connecting wallets from mobile devices.
    walletConnect: {
      projectId: "YOUR_PROJECT_ID",
      appMetadata: {
        name: "My App",
        description: "My dApp powered by Turnkey",
        url: "https://example.com",
        icons: ["https://example.com/icon.png"],
      },
    },
  },
});
```
