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

> Learn how to work with Midaz core entities, accounts, and transactions

This diagram shows how the main building blocks of Midaz connect to support financial operations at scale. In , you can find an overview of the system's operation.

<Frame caption="Figure 1. Midaz and its interconnected domains and modular structure.">
  <img src="https://mintcdn.com/lerian-49cb71fc/QD9X_k9nLmY4Tfwk/images/en/docs/midaz_entities_v3.jpg?fit=max&auto=format&n=QD9X_k9nLmY4Tfwk&q=85&s=3406b9da8b9d45d6bbf5ebf18f7a25c2" alt="" width="1444" height="1081" data-path="images/en/docs/midaz_entities_v3.jpg" />
</Frame>

## Core components

***

### Midaz

At the center of it all. Midaz coordinates everything, from data persistence to business logic, so you can focus on what matters.

### Data Layer

All data flows into the persistent **data layer**, ensuring durability, consistency, and performance across the system.

## Domains and relationships

***

### Organizations

Each organization represents a distinct environment using Midaz. It can hold one or many ledgers, depending on how you structure your data.

### Ledgers

Ledgers are where all financial activity happens. They track balances, store assets and power transactions. Every ledger belongs to an organization.

From here, the system branches into:

* **Assets**: define what kind of value is tracked.
* **Portfolios**: group related accounts under a shared purpose.

### Assets

Assets define the units of value, like BRL, USD, points, or tokens. Every account is tied to a specific asset.

### Portfolios

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

### Accounts & Segments

Accounts are tied to portfolios and represent individual balances. They’re grouped by **Segments**, which help you isolate data by customer, product, region, or any other dimension. Segments make it easier to track and report with precision.

Also, Accounts can be logically classified by **Account Types**, which define the nature and purpose of accounts within the financial structure, enabling proper transaction routing and operational validation across different account categories.

### Balance

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

* An account may carry **multiple balances**, each identified by a `balanceKey` (e.g. `default`, `collateral`, `operational`), to partition funds without splitting accounts.
* **External accounts** are limited to a single (default) balance.
* If `balanceKey` is omitted in a transaction, the default balance is used.
* Balances are derived automatically from ledger operations. They can be listed, fetched, or (in admin/testing scenarios) adjusted manually.
* The cache key (Valkey) also includes `balanceKey` in its format:  `<org_id>:<ledger_id>:<account_alias>:<balance_key>`.

### Transactions

Transactions move value between accounts. Each transaction is made up of **operations** (debits and credits). This keeps your logic consistent, traceable, and aligned with both your business model and your accounting policies.

### Transaction Routing entities

The [Transaction Routing entities](/en/midaz/transaction-routing-entities) extend Midaz capabilities by creating a structured ecosystem that guarantees correct annotations and proper financial flow directions.

It’s composed of:

* **Operation Routes:** Define atomic transaction behaviors, specifying how each financial movement is annotated and directed according to predefined business rules and accounting standards.
* **Transaction Routes:** Orchestrate multiple Operation Routes into balanced financial events, enforcing double-entry validation and maintaining transaction integrity across all accounts.

This duo creates a self-governing ecosystem where transactions are automatically validated for proper annotation and correct flow direction.

## In short

***

Midaz gives you a powerful, modular structure:

* Organizations manage ledgers.
* Ledgers hold assets, portfolios, and accounting structures.
* Portfolios contain accounts, grouped by segment.
* Transactions move value and trigger accounting treatments.
* All data is synced, traceable, and ready for financial reporting.

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

  Our consulting service can help you tailor the structure to your organization’s unique needs — whether you’re starting from scratch or optimizing an existing setup.

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