> 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/neofinance-as-a-service/naas-ecosystem/lending-and-borrowing-module/how-it-works.md).

# How It Works

The lending flow follows a similar philosophy to the vault layer: build first, then execute. The client constructs the full set of transactions needed for a given action (including token approvals and any prerequisite steps), and the caller is responsible for signing and broadcasting them.

{% stepper %}
{% step %}

#### **Initialize**

Create a `CityLendingClient` with a public client (for reads) and a wallet client (for writes). The wallet client is optional if you only need to read on-chain state.
{% endstep %}

{% step %}

#### **Build**

Call the appropriate build method for the action you want to perform. The client returns a structured transaction payload, and in the case of Morpho, a set of prerequisite transactions as well.
{% endstep %}

{% step %}

#### **Execute**

Send each transaction through the user's wallet. For Morpho operations, prerequisites (such as token approvals) must be sent before the main bundler transaction. For Aave, approvals are handled separately by your application.
{% endstep %}

{% step %}

#### **Monitor**

Use read methods like `getAaveUserAccountData` to check account health, collateral ratios, and available borrowing power after execution.
{% endstep %}
{% endstepper %}
