> 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/software-development-kit/lending-borrowing/common-frontend-flows.md).

# Common Frontend Flows

#### Lending Flow

1. Read available markets or pools using `getMorphoMarket` or Aave pool data.
2. Use `previewDeposit`-style reads or balance checks to show the user how much they can supply.
3. For Morpho, call `buildSupply` and execute the returned `requirements` followed by `bundlerTx`. For Aave, send an approval transaction first, then execute the tx from `buildAaveSupplyTx`.

#### Borrow Flow with Health Monitoring

1. After supplying collateral, read the user's account health via `getAaveUserAccountData` (for Aave) or `getMorphoPosition` (for Morpho).
2. Display available borrow power and health factor in the UI so the user can choose a safe borrow amount.
3. Call the relevant build method and execute.
4. After borrowing, re-read account health and update the UI.

#### Recommended Data Split

For the best frontend experience, combine data sources the same way you would with vaults:

Use `CityLendingClient` read methods for live on-chain state like positions, health factors, and market utilization. Pair this with `CityPortfolioClient` subgraph queries if you need historical lending activity or indexed transaction logs.
