# Ledger

Source: https://docs.formance.com/v4.0/modules/ledger

Stack: v4.0

Formance Ledger records financial movements as balanced transactions. It gives applications a programmable accounting core for holding balances, enforcing funds availability, and preserving a complete history of every change.

## Choose your next task

[Quick Start](https://docs.formance.com/v4.0/modules/ledger/quick-start)

Create a ledger, record a posting, read the resulting balance, and retry the write safely.

[Understand the Model](https://docs.formance.com/v4.0/modules/ledger/get-started/overview)

Learn the four accounting primitives and decide what to read next.

[Model Your Ledger](https://docs.formance.com/v4.0/modules/ledger/modeling)

Design accounts, assets, metadata, and validation rules for your domain.

[Write Transactions](https://docs.formance.com/v4.0/modules/ledger/transactions)

Record postings, run Numscript, retry writes, and correct transactions.

[Read and Query Data](https://docs.formance.com/v4.0/modules/ledger/querying)

Read balances and history with deliberate filtering and consistency choices.

[Integrate with Events](https://docs.formance.com/v4.0/modules/ledger/events)

Publish ledger changes to downstream systems and recover consumers safely.

[Operate Ledger](https://docs.formance.com/v4.0/modules/ledger/operations)

Deploy, secure, monitor, back up, and restore a production ledger.

[Numscript](https://docs.formance.com/v4.0/modules/numscript)

Express multi-leg financial rules as deterministic transactions.

## Product ledger and general ledger

| Ledger type        | Primary responsibility                                                                                                                         |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| **Product ledger** | Controls balances and financial movements inside an application, where concurrency, scarcity, and an exact history matter at transaction time. |
| **General ledger** | Classifies financial events to report the financial position of a business, commonly in an ERP or accounting system.                           |

Formance Ledger is a product ledger. You define the account structure and business rules your application needs, then map the resulting financial events into your general ledger where required.

Ledger enforces the double-entry transaction model by design: every transaction involves two or more accounts in compensating directions, and balances are derived from an immutable log. It stays flexible on accounting business rules — account classification, debit/credit conventions — so you choose how much accounting logic to handle in real time versus delegating to a GL.

Start with account names that describe the business boundary they represent. A deliberate [chart of accounts](https://docs.formance.com/v4.0/modules/ledger/modeling/chart-of-accounts) makes later reconciliation and reporting work easier.

## Core model

| Resource        | Meaning                                                                                     |
| --------------- | ------------------------------------------------------------------------------------------- |
| **Ledger**      | An isolated accounting namespace for accounts and transactions.                             |
| **Account**     | An address that holds balances for one or more assets.                                      |
| **Transaction** | An atomic group of postings recorded together.                                              |
| **Posting**     | One movement of an integer amount and asset from a source account to a destination account. |

Every posting has one source and one destination. Ledger applies all postings in a transaction together or rejects the transaction without a partial result. It derives balances from the recorded movements instead of accepting balance updates directly.

## History and corrections

Ledger keeps an append-only history of financial operations. You do not edit a recorded transaction in place. When a business event needs correction, record a new operation that preserves both the original event and the correction.

## One ledger or several

Use one ledger when all accounts share the same business and operational boundary. Use several ledgers when tenants or domains require separate accounting namespaces.

Accounts and transactions never cross ledger boundaries by accident. If workloads require independent availability, capacity, security, or recovery policies, place them in separate Ledger deployments rather than relying only on logical ledger separation.
