Skip to content

About

LedgerForge is an open-source double-entry ledger and financial core for building wallets, billing systems, reconciliation pipelines, and money-movement infrastructure.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

676 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LedgerForge

Build and Test

LedgerForge is an open-source double-entry ledger for applications that move money. Use it to record wallet transfers, billing activity, reservations and refunds through an HTTP API, a Go library or a local MCP server.

PostgreSQL stores the financial records. Redis supports queues and background workers. Search and observability services are optional. LedgerForge records money movement; connecting payment rails and defining your accounting model remain application responsibilities.

Accounting guarantees

  • Exact amounts: postings and balance arithmetic use integer units. Supply precise_amount with an explicit precision to avoid floating-point input loss; 1250 at precision 100 represents 12.50.
  • Double entry: each applied transfer debits its source and credits its destination by the same amount. Split transfers distribute that amount across their legs.
  • Immutable postings: corrections and refunds create linked transactions. Financial postings and accepted execution controls are preserved; customer metadata can be updated.
  • Idempotency by reference: reuse the same unique transaction reference after a timeout. Duplicate references are rejected; look up the original outcome instead of retrying with a new reference.

See ledger concepts for amount handling, balance semantics and asynchronous transaction states.

Quickstart: a balanced transfer

Requires Docker with Compose and Python 3. From a checkout:

git clone https://github.com/devaccuracy/ledgerforge.git
cd ledgerforge
./examples/quickstart/start.sh
./examples/quickstart/transfer.sh

This local-only demo builds the current checkout, generates a random master key, runs migrations and binds the API to 127.0.0.1:5001. It creates two USD balances and posts 12.50 synchronously using integer units. The source gets a bounded demo overdraft of 12.50; the result is -1250 and 1250 units, with equal total debits and credits. A retry with the same reference must leave those balances unchanged.

source: -1250 units
destination: 1250 units
total debits = total credits = 1250 units
reference retry: balances unchanged

Stop it with docker compose -p ledgerforge-demo -f examples/quickstart/compose.yaml down. See the example guide for the API payload, credentials and cleanup. These credentials and database defaults are for local use. Read the deployment guide before exposing a service.

Why LedgerForge

  • Exact money: integer postings and balance counters, preserved decimal request tokens, explicit precision and deterministic split allocation. Invalid monetary inputs are rejected before posting.
  • A verifiable ledger: read-only ledgerforge verify replays accounting evidence. Versioned audit chains and exportable checkpoints support audit verify --anchor against independently retained roots. See the verification guide for coverage and legacy limits.
  • Agent guardrails: per-key currency/precision limits, balance/ledger allowlists, durable daily reservations and approval holds enforced by the server. Delegated keys inherit restrictions and share ancestor budgets. Bind MCP to an API key and keep independent approver credentials outside the agent's authority. See agent safety and the executable policy example.
  • A hardened API: owner-bound key management, constrained delegation, authoritative revocation checks, bounded input and sanitized backend errors. Dedicated webhook signing secrets and destination controls protect outbound integrations. See security operations.
  • Tested invariants: exact-amount and allocation fuzz targets, generated PostgreSQL operation sequences, balance conservation checks and race tests for financial lifecycle and spending-capacity transitions.
  • Operational workflows: inflight reservations, partial settlement, refunds, split/bulk transfers, reconciliation, lineage, snapshots and optional search, metrics and OpenTelemetry. PostgreSQL retains financial truth while workers handle asynchronous execution and delivery.

Install

  • Release binaries: download ledgerforge and ledgerforge-mcp for Linux, macOS or Windows from GitHub Releases, then check the archive against checksums.txt (sha256sum -c checksums.txt --ignore-missing).
  • Container image: docker pull ghcr.io/devaccuracy/ledgerforge:1.0.0. The image contains both binaries; the release lists its digest and SBOMs.
  • From source: go install github.com/devaccuracy/ledgerforge/cmd/ledgerforge@v1.0.0 (Go 1.26.9 or later).

Run ledgerforge version to confirm what you installed, then follow the deployment guide and run ledgerforge migrate up before starting the server.

Run the published image locally

cp ledgerforge.example.json ledgerforge.json
# Replace server.secret_key with a random secret before starting.
# For example, generate one with: openssl rand -hex 32
docker compose up -d

The config explicitly enables authentication. API requests use the X-LedgerForge-Key header. Keep ledgerforge.json private and out of version control. The :main image tracks tested main-branch commits; pin a release tag or digest in production with LEDGERFORGE_IMAGE.

Documentation

Development

make verify
make test-integration
make vuln
make cover

See CONTRIBUTING.md for prerequisites and test isolation.

Community and license

Use GitHub issues for bugs and feature requests. Follow the Code of Conduct. Report vulnerabilities privately to security@ledgerforge.io.

Licensed under Apache 2.0. Required notices are in NOTICE.md.

About

LedgerForge is an open-source double-entry ledger and financial core for building wallets, billing systems, reconciliation pipelines, and money-movement infrastructure.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages