Skip to main content

Crate beankeeper

Crate beankeeper 

Source
Expand description

§Beankeeper

Idiomatic, ergonomic library of primitives for professional double-entry accounting.

§Core Invariant

Every core::Transaction enforces the fundamental accounting equation: total debits must equal total credits.

§Quick Start

use beankeeper::prelude::*;

// Create accounts
let cash = Account::new(
    AccountCode::new("1000").unwrap(),
    "Cash",
    AccountType::Asset,
);
let revenue = Account::new(
    AccountCode::new("4000").unwrap(),
    "Sales Revenue",
    AccountType::Revenue,
);

// Build a balanced transaction
let txn = JournalEntry::new("Sale of goods")
    .debit(&cash, Money::usd(500_00))
    .unwrap()
    .credit(&revenue, Money::usd(500_00))
    .unwrap()
    .post()
    .unwrap();

assert_eq!(txn.description(), "Sale of goods");

§Crate Structure

  • types — Fundamental accounting types (amounts, currencies, accounts, entries)
  • core — Transaction building, validation, and the general ledger
  • reporting — Trial balances and account balance summaries
  • error — Top-level error type aggregating all domain errors

Modules§

core
Core accounting logic.
error
Top-level error type aggregating all domain errors.
prelude
Convenience re-exports for common usage.
reporting
Accounting reports and summaries.
types
Fundamental accounting types.