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

# Architecture

> Explore Midaz's modular architecture, centered on the Ledger service and its supporting infrastructure.

<Note>
  Midaz runs the modular Ledger service and a separate Tracer service. Deploy and scale each service and its supporting infrastructure for your environment. For a business-oriented overview, see [About Midaz](/en/products/midaz/about-midaz).
</Note>

Midaz can run in public or private cloud environments. Select and operate the infrastructure that fits your deployment requirements.

Midaz uses a **modular architecture**. Ledger is organized around domain boundaries, with supporting infrastructure for storage, caching, messaging, and streaming. Tracer runs as a separate service.

## Repository and deployment boundary

Midaz v4.0.0 ships two runtimes in one source-available ELv2 repository and release: the Ledger modular monolith (with CRM and Fees) and Tracer. Tracer is not embedded in the Ledger process: deploy and scale it separately.

Ledger HTTP v2 can opt into the one-way reservation seam to Tracer. Ledger HTTP v1 never calls it. Tracer's public HTTP surface remains `/v1`, so the seam does not create a public Tracer v2 API. Tracer never calls Ledger.

## Modular architecture

***

The diagram below (*Figure 1*) shows how the pieces fit together.

<Frame caption="Figure 1. Midaz macro-architecture">
  <img src="https://mintcdn.com/lerian-49cb71fc/L6O4e7zHOgclCLRh/images/en/d2/midaz-macro-architecture.svg?fit=max&auto=format&n=L6O4e7zHOgclCLRh&q=85&s=2d958af73f0fe312f0f01b4479913a20" alt="" className="mx-auto" style={{ width:"80%" }} width="2021" height="1481" data-path="images/en/d2/midaz-macro-architecture.svg" />
</Frame>

### 1. Cluster layer (customer management)

The customer manages this layer. It provides the Kubernetes foundation that runs Midaz. Enable these services:

* **Service**: Networking abstraction to expose and route services.
* **AutoScaler**: Automatically adjusts the number of pods.
* **HPA (Horizontal Pod Autoscaler)**: Scales applications based on metrics.
* **Secrets**: Secure management of sensitive data.
* **ConfigMap**: Externalized configuration management.

This layer governs and coordinates all components within the cluster.

### 2. Front-end layer

The front-end layer provides the user interface for system interaction (admin panel, dashboards, and more).

<Note>
  Newer releases of Midaz no longer include a bundled console in the repository. **[Lerian Console](/en/platform/console/about-lerian-console)** now provides the visual interface. The Lerian Console includes Midaz as one product module.

  If you use an older version of Midaz, you may still have the standalone **Midaz Console**. This component is now in maintenance mode. It receives critical security patches only. Migrate to Lerian Console for the latest features and improvements.
</Note>

### 3. Back-end layer

The Ledger back-end is a **modular monolith** that holds the core responsibilities of the Midaz ledger. Midaz also runs Tracer as a separate service.

Ledger brings together four core components:

* **Onboarding domain**: manages organizations, ledgers, assets, portfolios, segments, and accounts.
* **Transactions domain**: handles financial transactions, operations, and asset movements.
* **CRM**: is embedded in the Ledger process.
* **Fees**: is embedded in the Ledger process.

This approach keeps clear domain boundaries. It also simplifies deployment and lowers operational complexity.

### 4. Data layer

This layer holds the databases and infrastructure components that support application data and event flows:

* **PostgreSQL**: separate `onboarding` and `transaction` databases, each configured with primary and replica connections.
* **Valkey**: A Redis-compatible key-value store for caching or fast data retrieval.
* **MongoDB**: Stores unstructured and semi-structured data, such as entity metadata.
* **RabbitMQ**: Message broker for asynchronous communication between services.
* **Redpanda**: Kafka-compatible broker for Ledger event streams. Ledger publishes configured events to it only when you set `STREAMING_ENABLED=true` and configure streaming brokers.

Persistence is deployment-specific. The bundled Compose configuration does not mount a data volume for Redpanda. Configure production storage and retention for each service.

### 5. Helm Chart layer

Midaz uses **Helm Charts** to deploy and configure the infrastructure.

The chart connects the code to Kubernetes. It deploys each component the same way across environments.

<Tip>
  For more details, see the [Deploying using Helm](/en/platform/deploy/midaz/midaz-installation) page.
</Tip>

## How the layers work together

***

Each layer has a focused role.

* Kubernetes coordinates how the layers communicate.
* Helm keeps deployments and configurations in sync.

You can add new components as needed without disruption to what already runs.
