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

# Structuring bank operations with Midaz

> Design Organizations, Ledgers, Portfolios, and Segments for retail and corporate banking — best practices for scalable hierarchies.

Midaz supports retail and corporate banking through a clear entity hierarchy. This page gives best practices to structure organizations, ledgers, accounts, portfolios, and segments. A good structure keeps operations simple as you scale.

## Optimal hierarchy of Organizations and Ledgers

***

### Single vs. multiple Organizations

A bank that operates as a single legal entity needs one Organization in Midaz. For a banking group with subsidiaries, use a parent organization over several child organizations. This structure matches your corporate governance. It also isolates data per entity.

<Note>
  The organization structure should reflect your corporate structure.
</Note>

### Using multiple Ledgers

Within an organization, choose the number of ledgers from your operational needs. Keep a **primary ledger** for customer transactions. Add ledgers for special purposes, such as treasury operations or regulatory segmentation.

<Note>
  Use multiple ledgers only when necessary to keep complexity low. A transfer between ledgers needs external orchestration through the API.
</Note>

## Efficient account structuring for retail and corporate banking

***

### Retail customers – Portfolio per customer

For retail banking, create a **Portfolio for each customer**. Each portfolio holds one account per asset type, such as checking, savings, or credit card. This structure makes balances easy to read per customer.

<Tip>
  Use [CRM](/en/midaz/crm/crm-data-security) to manage personal data such as tax IDs, addresses, and banking aliases — all in one place.
</Tip>

### Corporate clients – hierarchical accounts

For corporate banking, use **child accounts** within portfolios to reflect internal structure. A company can hold a parent account for its main funds. It can add child accounts for subdivisions, such as payroll or expense tracking.

### Internal accounts

Create internal accounts for revenue, expenses, and settlement flows. Named accounts like "Fee Income – USD" or "Interest Expense – USD" keep financial reporting clear.

## Worked example: a typical digital bank

***

This example shows how a digital bank can structure its Midaz deployment. The bank offers checking accounts, savings, and Pix transfers.

```
Organization: "Neobank S.A."
│
├── Ledger: "Main Ledger (BRL)"
│   │
│   ├── Segments
│   │   ├── "Standard" (default tier)
│   │   ├── "VIP" (premium customers)
│   │   └── "Business" (corporate accounts)
│   │
│   ├── Account Types
│   │   ├── "checking" → everyday transactions
│   │   ├── "savings" → interest-bearing deposits
│   │   ├── "settlement" → internal clearing
│   │   └── "fee-revenue" → bank fee collection
│   │
│   ├── Internal Accounts
│   │   ├── Settlement Account (clearing for Pix, TED)
│   │   ├── Fee Revenue Account
│   │   └── Interest Expense Account
│   │
│   └── Customer Portfolios
│       ├── Portfolio: "Maria Silva"
│       │   ├── Checking Account (BRL) — Segment: VIP
│       │   └── Savings Account (BRL) — Segment: VIP
│       │
│       └── Portfolio: "Tech Corp Ltda."
│           ├── Main Checking (BRL) — Segment: Business
│           ├── Payroll Account (BRL) — Segment: Business
│           └── Expense Account (BRL) — Segment: Business
│
└── Ledger: "Treasury"
    └── FX and interbank positions
```

### How a Pix transfer flows through this structure

<Steps>
  <Step title="Transaction initiated">
    Maria sends R\$ 500 via Pix from her checking account.
  </Step>

  <Step title="Transaction Route validates">
    The "Pix Out" Transaction Route applies. It defines a debit from Maria's checking account and a credit to the Settlement Account. It can also add a fee operation.
  </Step>

  <Step title="Operations execute">
    Midaz creates four operations atomically. It debits R$ 500 from Maria and credits R$ 500 to Settlement. It also debits a R$ 0.50 fee from Maria and credits R$ 0.50 to Fee Revenue.
  </Step>

  <Step title="Event published">
    Midaz emits a transaction event. The bank's notification service reads the event and sends Maria a push notification.
  </Step>

  <Step title="External settlement">
    An external integration reconciles the Settlement Account with the central bank's Pix infrastructure.
  </Step>
</Steps>

### Decision guide: when to split ledgers

| Scenario                                  | Recommendation                                                 |
| :---------------------------------------- | :------------------------------------------------------------- |
| Single currency, single business unit     | One ledger is enough                                           |
| Multiple currencies with occasional FX    | One ledger, separate asset accounts per currency               |
| Separate legal entities or subsidiaries   | One ledger per entity, under separate organizations            |
| Regulatory requirement for data isolation | Separate ledgers, or separate organizations for full isolation |
| Treasury and trading operations           | Dedicated treasury ledger alongside operational ledger         |

<Tip>
  When in doubt, start with a single ledger. You can always split later as operational complexity grows. If you split too early, you add orchestration overhead without clear benefit.
</Tip>
