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

# Midaz entities

> See how Midaz core entities (Organizations, Ledgers, Assets, Portfolios, Accounts, Segments, and Balances) connect to power financial operations at scale.

This diagram shows how the main building blocks of Midaz connect to support financial operations at scale. Figure 1 gives an overview of how the system works.

<Frame caption="Figure 1. Midaz and its interconnected domains and modular structure.">
  <img src="https://mintcdn.com/lerian-49cb71fc/SEOef3JqTInYAAau/images/en/d2/midaz-entities-v3.svg?fit=max&auto=format&n=SEOef3JqTInYAAau&q=85&s=bda0ca5101ade6a55c127a3375af6e62" alt="Midaz core building blocks and how its interconnected domains fit together to support financial operations at scale" width="1559" height="1395" data-path="images/en/d2/midaz-entities-v3.svg" />
</Frame>

## Core components

***

### Midaz

Midaz is at the center. It coordinates everything, from data persistence to business logic.

### Data Layer

All data flows into the persistent **data layer**. This layer gives the system durability, consistency, and performance.

## Domains and relationships

***

### Organizations

Each organization is a distinct environment in Midaz. It can hold one or many ledgers, based on how you structure your data.

### Ledgers

A ledger holds all financial activity. It tracks balances, stores assets, and powers transactions. Every ledger belongs to an organization.

From here, the system branches into:

* **Assets**: define the kind of value you track.
* **Portfolios**: group related accounts under a shared purpose.

### Assets

Assets define the units of value, like BRL, USD, points, or tokens. Each account uses one specific asset.

### Portfolios

Portfolios group accounts by business logic. You can create as many portfolios as you need to organize your financial structure. Each portfolio contains one or more accounts.

### Accounts & Segments

An account belongs to a portfolio and represents an individual balance. **Segments** group accounts, so you can isolate data by customer, product, region, or any other dimension.

**Account Types** classify accounts by nature and purpose. They enable transaction routing and operational validation across account categories.

### Balance

A **Balance** represents the net amount an **Account** holds of a given **Asset** in a specific **Ledger**.

* An account can carry **multiple balances**. Each has a `balanceKey` (e.g. `default`, `collateral`, `operational`) to partition funds without splitting the account.
* An **external account** has only one balance (`default`).
* If you omit `balanceKey` in a transaction, Midaz uses the default balance.
* Midaz derives balances automatically from ledger operations. You can list, fetch, or (in admin or test scenarios) adjust them manually.
* The Valkey cache key includes `balanceKey` in its format: `balance:{transactions}:<orgId>:<ledgerId>:<alias>#<balanceKey>`.

### Transactions

A transaction moves value between accounts. Each transaction contains **operations** (debits and credits). This keeps your logic consistent, traceable, and aligned with your business model and accounting policies.

### Accounting Routes entities

The [Accounting Routes entities](/en/products/midaz/transaction-routing-entities) extend Midaz. They create a structured system that guarantees correct annotations and correct financial-flow directions.

It has two parts:

* **Operation Routes:** define atomic transaction behaviors. Each route sets how Midaz annotates and directs one financial movement, based on your business rules and accounting standards.
* **Accounting Routes:** orchestrate multiple Operation Routes into balanced financial events. When route validation is enabled in the ledger settings, they enforce the configured transaction structure. (The API calls this `transactionRoute`.)

This pair defines the transaction structure. When you enable route validation in the ledger settings, Midaz validates transactions against the configured route.

## Get help

***

<Tip>
  **Need help designing your Midaz setup?**

  Our consulting service can help you tailor the structure to your organization's needs. This applies whether you start from scratch or optimize an existing setup.

  [Contact us](https://lerian.studio/contact) to learn more.
</Tip>
