No description
Find a file
padreug 3add13075c Adds fiat currency metadata to payments
Adds fiat currency information to payment invoices and ledger entries.

This allows for tracking the fiat value of transactions and provides a more complete financial picture. Calculates the fiat amount proportionally based on the user's balance and includes the fiat currency, amount, and exchange rates in the invoice's extra data. This data is then extracted and added to the ledger entry's metadata when recording the payment.
2025-11-02 02:52:41 +01:00
core Completes core logic refactoring (Phase 3) 2025-10-23 02:45:50 +02:00
static Improves user display in audit log and requests 2025-11-01 09:25:22 +01:00
templates/castle Improves user display in audit log and requests 2025-11-01 09:25:22 +01:00
.gitignore initial commit 2025-10-22 12:33:45 +02:00
__init__.py Adds task cleanup on extension shutdown 2025-11-02 01:41:34 +01:00
account_utils.py Completes Phase 1: Beancount patterns adoption 2025-10-23 00:17:04 +02:00
BEANCOUNT_PATTERNS.md Completes core logic refactoring (Phase 3) 2025-10-23 02:45:50 +02:00
CLAUDE.md Adds CLAUDE.md to guide Claude Code 2025-11-01 23:22:25 +01:00
config.json initial commit 2025-10-22 12:33:45 +02:00
crud.py Adds background task for invoice processing 2025-11-02 01:40:40 +01:00
DAILY_RECONCILIATION.md Completes Phase 2: Adds reconciliation features 2025-10-23 02:31:15 +02:00
description.md initial commit 2025-10-22 12:33:45 +02:00
DOCUMENTATION.md Adds comprehensive documentation and patterns 2025-10-22 23:38:05 +02:00
EXPENSE_APPROVAL.md Implements expense approval workflow 2025-10-23 00:50:15 +02:00
manifest.json initial commit 2025-10-22 12:33:45 +02:00
migrations.py Adds on-chain Bitcoin payment support 2025-11-01 23:45:28 +01:00
models.py Adds on-chain Bitcoin payment support 2025-11-01 23:45:28 +01:00
PHASE1_COMPLETE.md Completes Phase 1 and updates UI 2025-10-23 00:17:04 +02:00
PHASE2_COMPLETE.md Completes Phase 2: Adds reconciliation features 2025-10-23 02:31:15 +02:00
PHASE3_COMPLETE.md Completes core logic refactoring (Phase 3) 2025-10-23 02:45:50 +02:00
README.md initial commit 2025-10-22 12:33:45 +02:00
services.py Adds per-user wallet configuration 2025-10-22 14:54:25 +02:00
tasks.py Adds fiat currency metadata to payments 2025-11-02 02:52:41 +01:00
views.py initial commit 2025-10-22 12:33:45 +02:00
views_api.py Adds fiat currency metadata to payments 2025-11-02 02:52:41 +01:00

Castle Accounting Extension for LNbits

A full-featured double-entry accounting system for collective projects, integrated with LNbits Lightning payments.

Overview

Castle Accounting enables collectives like co-living spaces, makerspaces, and community projects to:

  • Track expenses and revenue with proper accounting
  • Manage individual member balances
  • Record contributions as equity or reimbursable expenses
  • Track accounts receivable (what members owe)
  • Generate Lightning invoices for settlements

Installation

This extension is designed to be installed in the lnbits/extensions/ directory.

cd lnbits/extensions/
# Copy or clone the castle directory here

Enable the extension through the LNbits admin interface or by adding it to your configuration.

Usage

For Members

  1. Add an Expense: Record money you spent on behalf of the collective

    • Choose "Liability" if you want reimbursement
    • Choose "Equity" if it's a contribution
  2. View Your Balance: See if the Castle owes you money or vice versa

  3. Pay Outstanding Balance: Generate a Lightning invoice to settle what you owe

For Admins

  1. Create Accounts Receivable: Record when someone owes the collective money

  2. Record Revenue: Track income received by the collective

  3. View All Transactions: See complete accounting history

  4. Make Payments: Record payments to members

Architecture

Data Models

  • Account: Individual accounts in the chart of accounts
  • JournalEntry: Transaction header with description and date
  • EntryLine: Individual debit/credit lines (always balanced)

Account Types

  • Assets: Things the Castle owns (Cash, Bank, Accounts Receivable)
  • Liabilities: What the Castle owes (Accounts Payable to members)
  • Equity: Member contributions and retained earnings
  • Revenue: Income streams
  • Expenses: Operating costs

Database Schema

The extension creates three tables:

  • castle.accounts - Chart of accounts
  • castle.journal_entries - Transaction headers
  • castle.entry_lines - Debit/credit lines

API Reference

See description.md for full API documentation.

Development

To modify this extension:

  1. Edit models in models.py
  2. Add database migrations in migrations.py
  3. Implement business logic in crud.py
  4. Create API endpoints in views_api.py
  5. Update UI in templates/castle/index.html

Contributing

Contributions welcome! Please ensure:

  • Journal entries always balance
  • User permissions are properly checked
  • Database transactions are atomic

License

MIT License - feel free to use and modify for your collective!