> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Extending Viem

## Overview

Viem is designed for composition. Build a standalone Action around a Client, then bind it through a
decorator when method syntax is useful.

Extensions can preserve the caller's inferred types or provide Chain and Transport behavior without
taking ownership of application configuration.

:::code-group
```ts twoslash [example.ts]
import { Actions } from 'viem'
import { client } from './viem.config'

const balance = await Actions.address.getBalance(client, {
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
})
```
:::

<Cards>
  <Card icon="lucide:scissors" title="Tree-Shakable Actions" description="Call only the standalone Actions an application needs." to="/docs/guides/extending/tree-shakable-actions" />

  <Card icon="lucide:brackets" title="Type Composition" description="Preserve Chain, Account, Transport, token, RPC, and extension types." to="/docs/guides/extending/type-composition" />

  <Card icon="lucide:blocks" title="Extend a Client" description="Add composable methods and namespaces with Client.extend." to="/docs/guides/extending/client" />

  <Card icon="lucide:square-function" title="Build Actions & Decorators" description="Design a standalone Action and an optional method-style adapter." to="/docs/guides/extending/actions-decorators" />

  <Card icon="lucide:network" title="Custom Chains & Transports" description="Add chain-specific behavior and custom RPC communication." to="/docs/guides/extending/chains-transports" />

  <Card icon="lucide:package-open" title="Distribute a Viem Library" description="Accept caller-owned Clients and publish tree-shakable, type-safe extensions." to="/docs/guides/extending/libraries" />
</Cards>
