Skip to content

Latest commit

 

History

History

README.md

Go Money Documentation

Comprehensive documentation for the Go Money personal finance system.


For AI Agents

Start here to minimize token usage.

Quick Reference Description
INDEX.md Master index - find any doc by keyword
Schema Quick-Ref All tables, columns, enums in one file
Business Logic Quick-Ref Formulas, rules, transaction behavior
Analytics Quick-Ref Query templates ready to use

Quick Links

Schema Reference

Table Documentation

Table Description
accounts Bank accounts, credit cards, categories
transactions All financial transactions
categories Transaction categories
tags Flexible transaction tags
currencies Currency definitions and rates
rules Transaction processing rules
double_entry Double-entry bookkeeping ledger
stats Pre-computed daily statistics
users User authentication
import_deduplication Import duplicate detection

Analytics

Query Patterns

MCP Server

API Reference

Core Concepts

Account Types

Type Value Purpose
Asset 1 Cash, bank accounts, investments
Liability 4 Credit cards, loans, debts
Expense 5 Spending categories
Income 6 Revenue sources
Adjustment 7 Balance adjustments

Transaction Types

Type Value Description
Transfer 1 Between Asset/Liability accounts
Income 2 Money received
Expense 3 Money spent
Adjustment 5 Balance correction

Multi-Currency

  • Each account has a currency
  • Transactions store amounts in original and base currency
  • currencies.rate converts to base currency: base_amount = amount / rate

Double-Entry Bookkeeping

Every transaction creates:

  • One debit entry (is_debit = true)
  • One credit entry (is_debit = false)
  • Total debits always equal total credits

Soft Deletes

Most tables use soft deletes:

  • deleted_at IS NULL = active record
  • deleted_at IS NOT NULL = deleted record
  • Always filter with WHERE deleted_at IS NULL

Common Query Patterns

Active Records

SELECT * FROM accounts WHERE deleted_at IS NULL;

This Month's Expenses

SELECT SUM(destination_amount_in_base_currency)
FROM transactions
WHERE transaction_type = 3
  AND deleted_at IS NULL
  AND DATE_TRUNC('month', transaction_date_only) = DATE_TRUNC('month', CURRENT_DATE);

Net Worth

SELECT SUM(CASE
    WHEN type = 1 THEN current_balance
    WHEN type = 4 THEN -current_balance
    ELSE 0
END) as net_worth
FROM accounts
WHERE type IN (1, 4) AND deleted_at IS NULL;

Transactions by Tag

SELECT * FROM transactions
WHERE :tag_id = ANY(tag_ids)
  AND deleted_at IS NULL;

Getting Started

  1. Start with Schema Overview for the big picture
  2. Review Enum Reference to understand field values
  3. Explore Common Queries for analytics patterns
  4. Use MCP Overview for AI-assisted queries