> For the complete documentation index, see [llms.txt](https://city-protocol.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://city-protocol.gitbook.io/docs/developers/city-protocol-sdk.md).

# City Protocol SDK

TypeScript clients for integrating City Protocol wallets, funding, swaps, lending, vaults, portfolio data and AML screening.

The City Protocol SDK (`@cityprotocol/core`) is the builder-facing integration layer for City Protocol. It sits between your product and the underlying provider stack, so your team can offer wallets, funding, swaps, lending, vaults and screening without wiring each provider together independently.

## What your team owns

Your product keeps its own logic. Your team owns:

* the user experience;
* the customer, account and ledger models;
* policy, permissions and support operations;
* how financial capabilities are packaged into your product.

## The integration model

A typical City Protocol integration has three layers: your product, the City Protocol SDK with the City Protocol-managed backend flows, and the upstream providers and protocols.

<figure><img src="https://3297077862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxNp2waFk6hg1G4lEQZu%2Fuploads%2FMYecGtI71xlXUqycp4cO%2Ffig-sdk.png?alt=media" alt="Your frontend sends intent to your backend, which holds the credentials and calls the seven City Protocol SDK clients, each of which reaches its own upstream provider or protocol"><figcaption><p>Backend-first integration. Your backend holds credentials and calls the SDK clients, and the frontend renders the results.</p></figcaption></figure>

## Recommended architecture

For production, default to backend-first:

1. The frontend collects user intent and renders the interface.
2. The frontend calls your backend.
3. Your backend calls the City Protocol SDK clients.
4. Your backend stores state, enforces policy and processes asynchronous updates.
5. The frontend renders normalized results.

## Module map

| Module                                                                               | Client                | Use it for                                                        |
| ------------------------------------------------------------------------------------ | --------------------- | ----------------------------------------------------------------- |
| [Vault](/docs/developers/city-protocol-sdk/vault.md)                                 | `CityClient`          | Yield and managed vault interactions                              |
| [Portfolio](/docs/developers/city-protocol-sdk/vault/portfolio-sdk.md)               | `CityPortfolioClient` | Indexed portfolio and activity data                               |
| [Wallet](/docs/developers/city-protocol-sdk/wallet.md)                               | `verifyPrivyWallet`   | Wallet login, session verification and connected-account identity |
| [Add fund](/docs/developers/city-protocol-sdk/add-fund.md)                           | `CityFundClient`      | Deposit addresses and supported-asset flows                       |
| [Swap](/docs/developers/city-protocol-sdk/swap.md)                                   | `CitySwapClient`      | Quotes, approvals, route building and execution orchestration     |
| [Lending and borrowing](/docs/developers/city-protocol-sdk/lending-and-borrowing.md) | `CityLendingClient`   | Morpho Blue and Aave V3 interactions                              |
| [AML](/docs/developers/city-protocol-sdk/aml.md)                                     | `CityAmlClient`       | Wallet and transaction screening                                  |

## Suggested rollout order

Most teams integrate in this sequence:

1. wallet and account identity;
2. funding and money movement;
3. swaps, lending, vaults and portfolio features.

Start with [Get started](/docs/developers/city-protocol-sdk/get-started.md).
