Enhancing Your Beancount Experience with Custom Links and Queries
Beancount, the double-entry accounting system beloved by developers and finance nerds alike, is powerful in its simplicity. But for those who want more control and faster navigation inside Fava, Beancount’s web interface, custom sidebar links and SQL queries can take your workflow to the next level.
In this guide, we’ll show you how to:
- Add quick-access links to Fava’s sidebar
- Use SQL queries for advanced filtering and analysis
- Customize your workflow for monthly reviews or anomaly detection
Why Customize Fava?
Fava is already a beautiful interface for viewing your Beancount ledger, but as your journal grows, so does the need for better shortcuts and smarter queries.
Pain points this solves:
- Navigating through time ranges repeatedly
- Filtering transactions across nested accounts
- Spotting negative balances or anomalies faster
✨ Custom Sidebar Links
Let’s start with improving your daily workflow with simple sidebar shortcuts. These links appear in Fava’s left sidebar and can take you directly to filtered views like this month’s transactions or last month’s income.
Add these lines to your Beancount file:
2021-01-01 custom "fava-sidebar-link" "Current Month" "/jump?time=month"
2021-01-01 custom "fava-sidebar-link" "Last Month" "/jump?time=month-1"
2021-01-01 custom "fava-sidebar-link" "Clear All" "/jump?account=&time=&filter="
What They Do:
- Current Month: Opens the transaction view filtered to the current month.
- Last Month: Instantly jumps to the previous month—great for end-of-month reviews.
- Clear All: Resets filters, showing all entries again.
These shortcuts eliminate manual time input and make your Fava experience feel more fluid and personalized.
🔍 Custom SQL Queries
For deeper insight, Fava’s SQL interface is incredibly powerful. Here’s a query that finds all negative balances in accounts that match a pattern—perfect for flagging unusual or problematic transactions.
SELECT account, units(sum(position)), sum(position)
WHERE number(units(position)) < 0
AND account ~ '.*:BCM:.*'
AND date >= DATE(2021,12,9)
AND date < DATE(2022,1,9)
Breakdown:
account ~ '.*:BCM:.*'
: Filters accounts containing:BCM:
in their name.number(units(position)) < 0
: Flags negative balances (e.g. overspent budgets).- Date filters narrow the result to a specific 1-month window.
Use cases:
- Spot errors like duplicate expenses or incorrect postings
- Audit a specific vendor or category
- Quickly extract actionable insights for budgeting
🛠 Pro Tip: Combine Links + Queries
While Fava doesn’t allow direct links to custom queries, you can create a monthly review habit by:
- Using the “Current Month” link to start your review
- Opening your saved queries tab in another pane
- Reviewing both simultaneously—filter first, then dig deep
This combo helps you catch anomalies before they spiral and ensure your ledger stays clean.
Final Thoughts
Beancount is minimal by design, but small enhancements like these bring huge gains in efficiency. Whether you’re reviewing your budget, debugging strange balances, or simply saving clicks, custom links and SQL queries give you more power and less friction.
Bonus: If you're using Fava’s custom reports, you can even build full dashboards tailored to your personal finance rituals.
Ready to take control?
Start small: add the “Current Month” link. Then build your own queries. Your future self will thank you.
Want more tips like this? Subscribe to our newsletter or explore more Beancount recipes at Beancount.io.