> ## 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.

Implementing Midaz in a banking environment requires a strategic approach to entity hierarchy and account structuring. Below are best practices to optimize the setup of organizations, ledgers, accounts, portfolios, and segments for operational efficiency and scalability.

## Optimal hierarchy of Organizations and Ledgers

***

### Single vs. multiple Organizations

Banks operating as a single legal entity typically require one Organization in Midaz. However, for banking groups with subsidiaries, a hierarchical structure is recommended, with a parent organization overseeing multiple child organizations. This setup aligns with corporate governance and enables data segregation per entity.

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

### Using multiple Ledgers

Within an organization, determine the number of ledgers to use based on operational needs. A common approach is to maintain a **primary ledger** for customer transactions while using additional ledgers for specialized purposes, such as treasury operations or regulatory segmentation.

<Note>
  Use multiple ledgers only when necessary to minimize complexity. Transfers between ledgers require external flow orchestration via APIs.
</Note>

## Efficient account structuring for retail and corporate banking

***

### Retail customers – Portfolio per customer

For retail banking, best practice is to create a **Portfolio for each customer**, containing individual accounts for different asset types (e.g., checking, savings, credit card). This setup allows efficient balance retrieval and streamlined operations.

<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, utilize **child accounts** within portfolios to reflect internal structuring. A company might have a parent account for its main funds and child accounts for subdivisions like payroll or expense tracking.

### Internal accounts

Establish internal accounts for revenue, expenses, and settlement flows. Dedicated accounts for "Fee Income – USD" or "Interest Expense – USD" ensure clear financial reporting.

## Worked example: a typical digital bank

***

Here's how a digital bank offering checking accounts, savings, and Pix transfers might structure its Midaz deployment:

```
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="Operation Route validates">
    The "Pix Out" Transaction Route kicks in — it defines a debit from Maria's checking account and a credit to the Settlement Account, plus an optional fee operation.
  </Step>

  <Step title="Operations execute">
    Four operations are created atomically: debit R$ 500 from Maria, credit R$ 500 to Settlement, debit R\$ 0.50 fee from Maria and credit to Fee Revenue.
  </Step>

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

  <Step title="External settlement">
    The Settlement Account is reconciled with the central bank's Pix infrastructure via external integration.
  </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 with dedicated database partitions    |
| 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. Splitting too early adds orchestration overhead without clear benefit.
</Tip>
