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

# Creating Extensions

> Build a custom extension that adds wallet providers or other runtime services to the Dynamic JavaScript SDK.

An extension is a function that adds functionality to a `DynamicClient`. Use it to integrate a wallet that Dynamic does not officially support, or to add new features that the Dynamic team has not implemented. Once published to npm, other developers can import and call the extension to add that functionality to their own Dynamic client.

<Warning>
  The core extension APIs (`WalletProvider`, `Storage`, `registerExtension`, etc.) may change between major versions of the Dynamic SDK. Pin your extension to a specific major version and review the release notes before upgrading.
</Warning>

## Extension skeleton

Every extension follows the same pattern: check whether it is already registered with `hasExtension`, call `registerExtension`, then add the providers or services the extension contributes.

```typescript theme={"system"}
import {
  getDefaultClient,
  hasExtension,
  registerExtension,
} from "@dynamic-labs-sdk/client/core";
import type { DynamicClient } from "@dynamic-labs-sdk/client";

const MY_EXTENSION_KEY = "myCustomExtension";

export const addMyExtension = (
  client: DynamicClient = getDefaultClient()
): void => {
  if (hasExtension({ extensionKey: MY_EXTENSION_KEY }, client)) {
    return;
  }

  registerExtension({ extensionKey: MY_EXTENSION_KEY }, client);

  // Register wallet providers or use core services below.
};
```

* `extensionKey` is a unique string for your extension.
* `hasExtension` makes the call idempotent so multiple imports do not double-register.
* `client` defaults to `getDefaultClient()`. Only pass a client explicitly if your app uses multiple Dynamic clients.

## Extension interfaces

<CardGroup cols={2}>
  <Card title="Wallet Provider" icon="wallet" href="/docs/javascript/reference/creating-extensions/wallet-provider">
    Connect a custom wallet by implementing the `WalletProvider` interface.
  </Card>

  <Card title="Custom Functions" icon="code" href="/docs/javascript/reference/creating-extensions/custom-functions">
    Add standalone functions that use `DynamicClient` services.
  </Card>

  <Card title="Storage" icon="database" href="/docs/javascript/reference/creating-extensions/storage">
    Persist extension state with regular or secure `Storage`.
  </Card>

  <Card title="Publish" icon="package" href="/docs/javascript/reference/creating-extensions/publish">
    Package and publish your extension to npm.
  </Card>
</CardGroup>

## Related

* [Adding Extensions](/docs/javascript/reference/adding-extensions) — Use existing chain and addon extensions.
* [Creating a Dynamic Client](/docs/javascript/reference/client/create-dynamic-client)
* [Initializing the Dynamic Client](/docs/javascript/reference/client/initialize-dynamic-client)
