1
0
Fork 0
forked from aiolabs/libra
libra/description.md
Padreug c174cda48d Rename Castle Accounting extension to Libra
Full identifier rename: module path lnbits.extensions.castle →
lnbits.extensions.libra, DB ext_castle → ext_libra, URL prefix
/castle/ → /libra/, manifest id castle → libra, fava ledger slug
default castle-ledger → libra-ledger, Beancount source metadata
castle-api → libra-api and link prefixes castle-{entry,tx}- →
libra-{entry,tx}-, column castle_wallet_id → libra_wallet_id, all
Python/JS/HTML identifiers (castle_ext, CastleSettings,
castle_reference, castleWalletConfigured, etc.).

Display name "Castle Accounting" → "Libra" (the scales/balance
metaphor — fits double-entry bookkeeping).

No backward compat: production hosts will be force-updated. Old
castle-prefixed Beancount metadata in existing Fava ledgers is
historical; new entries use libra-* prefixes going forward.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 10:24:46 +02:00

2.4 KiB

Libra

A comprehensive double-entry accounting system for collective projects, designed specifically for LNbits.

Features

  • Double-Entry Bookkeeping: Full accounting system with debits and credits
  • Chart of Accounts: Pre-configured accounts for Assets, Liabilities, Equity, Revenue, and Expenses
  • User Expense Tracking: Members can record out-of-pocket expenses as either:
    • Liabilities: Libra owes them money (reimbursable)
    • Equity: Their contribution to the collective
  • Accounts Receivable: Track what users owe the Libra (e.g., accommodation fees)
  • Revenue Tracking: Record revenue received by the collective
  • User Balance Dashboard: Each user sees their balance with the Libra
  • Lightning Integration: Generate invoices for outstanding balances
  • Transaction History: View all accounting entries and transactions

Use Cases

1. User Pays Expense Out of Pocket

When a member buys supplies for the Libra:

  • They can choose to be reimbursed (Liability)
  • Or contribute it as equity (Equity)

2. Accounts Receivable

When someone stays at the Libra and owes money:

  • Admin creates an AR entry (e.g., "5 nights @ 10€/night = 50€")
  • User sees they owe 50€ in their dashboard
  • They can generate an invoice to pay it off

3. Revenue Recording

When the Libra receives revenue:

  • Record revenue with the payment method (Cash, Lightning, Bank)
  • Properly categorized in the accounting system

Technical Details

  • Built on PostgreSQL/SQLite with full transaction support
  • RESTful API for all operations
  • Validates that journal entries balance before saving
  • Automatic user-specific account creation
  • Indexed for performance on large datasets

API Endpoints

User Endpoints (Invoice Key)

  • GET /api/v1/balance - Get your balance
  • POST /api/v1/entries/expense - Add an expense
  • GET /api/v1/entries/user - Get your transactions
  • POST /api/v1/pay-balance - Record a payment

Admin Endpoints (Admin Key)

  • POST /api/v1/entries/receivable - Create accounts receivable
  • POST /api/v1/entries/revenue - Record revenue
  • POST /api/v1/pay-user - Pay a user
  • POST /api/v1/accounts - Create new accounts
  • GET /api/v1/entries - View all entries

Getting Started

  1. Enable the Libra extension in LNbits
  2. Visit the Libra page to see your dashboard
  3. Start tracking expenses and balances!

The extension automatically creates a default chart of accounts on first run.