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

# JavaScript SDK Overview

> A headless, framework-agnostic SDK for authentication, wallets, and signing. You build the UI — Dynamic handles everything else.

The JavaScript SDK (`@dynamic-labs-sdk/client`) works in **any environment that runs JavaScript** — React, React Native, Vue, Svelte, vanilla JS, or another framework. It gives you full control over authentication, wallet connections, and transaction signing without any built-in UI. You create a Dynamic client, add extensions for the chains you support, and call functions directly — rendering every screen, button, and input yourself.

> [!TIP]
>
> This SDK is headless: there is no built-in modal or login form, and you control every pixel of the UI. See the [Building UI guides](https://docs.dynamic.xyz/docs/javascript/building-ui/overview.md) for real-world flows built end to end. For React web apps, [React UI components](https://docs.dynamic.xyz/docs/javascript/building-ui/react-ui/overview.md) also provide prebuilt widgets for wallet connection and Flow payments.

## Choose your quickstart

Pick the path that matches how you build:

> [card] [React](https://docs.dynamic.xyz/docs/javascript/reference/react-quickstart.md)
>
> React apps with `@dynamic-labs-sdk/react-hooks`.

> [card] [React Native](https://docs.dynamic.xyz/docs/javascript/reference/react-native-quickstart.md)
>
> Expo or bare React Native with the same client and hooks.

> [card] [Vanilla JavaScript](https://docs.dynamic.xyz/docs/javascript/reference/quickstart.md)
>
> Framework-free or any other JS environment.

## How it works

**1. Create a client**

Call `createDynamicClient()` with your environment ID from the
[Dynamic Console](https://console.dynamic.xyz). This is the single entry point
for the SDK.

**2. Add extensions**

Register chain extensions (e.g. `addEvmExtension()`, `addSolanaExtension()`)
to enable wallet discovery and signing for each chain you support.

**3. Initialize**

The client initializes automatically by default. Wait for initialization to
complete before calling other SDK functions.

**4. Build your UI**

Use SDK functions to authenticate users, connect wallets, and sign
transactions. You decide what the UI looks like — the SDK provides the
logic.

## What you need to build

Because the SDK is headless, your app handles these screens:

* **Login** — collect an email/phone, trigger OTP or social auth, and verify the response
* **Wallet picker** — list available wallet providers and let the user choose one
* **MFA prompts** — prompt for TOTP codes or passkey verification when MFA is enabled
* **Step-up authentication** — re-verify identity before sensitive actions
* **Device registration** — verify the user's email when they sign in from an unrecognized device

> [!TIP]
>
> See [Authentication screens](https://docs.dynamic.xyz/docs/javascript/authentication-methods/headless-authentication.md) for the full list with implementation guides.

## What the SDK handles

You call functions; the SDK manages the rest:

* **Authentication** — email OTP, SMS, social login, passkeys, external JWTs, and MFA
* **Wallet management** — embedded wallets (MPC-backed, user-owned) and external wallets (MetaMask, Phantom, etc.)
* **Transaction signing** — chain-specific signing, typed data, and message signing
* **Session management** — JWTs, token refresh, and logout
* **Events** — subscribe to auth, wallet, and session state changes with `onEvent()`
* **Multi-chain** — EVM, Solana, Bitcoin, Aptos, Sui, TON, Tron, and Starknet via extensions
* **Gasless transactions** — sponsor gas so users don't pay, on both EVM (via ZeroDev) and Solana
* **Fireblocks Flow** — accept crypto from any wallet or exchange and settle in a token and chain you choose
* **Earn** — let users deposit into curated yield vaults, track positions, and claim rewards (EVM only)

## Architecture

The SDK creates and manages a hidden iframe internally for WaaS/MPC key operations. You do **not** need to configure or install a separate iframe host package.

```
┌─────────────────────────────────────────────┐
│  Your web app (any framework or none)       │
│                                             │
│  @dynamic-labs-sdk/client                   │
│  @dynamic-labs-sdk/evm (or /solana, etc.)   │
│                                             │
│  ┌─────────────────────────────────────┐    │
│  │  Hidden iframe (MPC key operations) │    │
│  │  Managed internally by the SDK      │    │
│  └─────────────────────────────────────┘    │
└─────────────────────────────────────────────┘
```

## Use with React and React Native

For React (web), `@dynamic-labs-sdk/react-hooks` wraps client functions as hooks so components re-render when state changes. See the [React Hooks guide](https://docs.dynamic.xyz/docs/javascript/reference/react-hooks-guide.md).

For React Native (Expo or bare), you add polyfills, native modules, and deep-link metadata — then auth, wallets, and signing match the web guides. See [React Native Setup](https://docs.dynamic.xyz/docs/javascript/react-native/setup.md) for Expo vs bare details.

## Common mistakes

| Mistake | Fix |
| :- | :- |
| Using `@dynamic-labs/sdk-react-core` without React | Use `@dynamic-labs-sdk/client` instead |
| Installing `@dynamic-labs/legacy-client` for React Native | That is the **legacy** RN SDK — use `@dynamic-labs-sdk/client` ([React Native Quickstart](https://docs.dynamic.xyz/docs/javascript/reference/react-native-quickstart.md)) |
| Adding `@dynamic-labs/legacy-web-extension` | Not needed — that package is for React Native on web |
| Loading SDK via `<script>` tag without a bundler | Use Vite, webpack, or another bundler |
| Expecting a built-in modal or wallet picker | The JS SDK has no modal. In a React web app, use the [connect wallet widget](https://docs.dynamic.xyz/docs/javascript/building-ui/react-ui/connect-wallet-widget.md), or build your own UI |
| Calling `createDynamicClient` inside a render loop | Create the client once at app startup |

## What's next

> [card] [Wallets](https://docs.dynamic.xyz/docs/javascript/reference/wallets/build-wallet-picker.md)
>
> Build a wallet picker, connect wallets, and manage accounts.

> [card] [Fireblocks Flow](https://docs.dynamic.xyz/docs/javascript/reference/flow-getting-started.md)
>
> Accept crypto payments and settle in any token or chain.

> [card] [Earn](https://docs.dynamic.xyz/docs/javascript/building-ui/earn-ui.md)
>
> Let users deposit into yield vaults, track positions, and claim rewards.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.