Skip to content(if available)orjump to list(if available)

Show HN: Bagels – TUI expense tracker

Show HN: Bagels – TUI expense tracker

74 comments

·January 26, 2025

Hi! I'm Jax and I've been building this cool little terminal app for myself to track my expenses and budgets!

Other than challenging myself to learn Python, I built this mainly around the habit of budget tracking at the end of the day. (I tried tracking on-the-go, but the balance was always out of sync.) All data is stored in a single sqlite file, so you can export and process them all you want!

The app is built using the textual API for Python! Awesome framework which feels like I'm doing webdev haha.

You can check out some screenshots on gh: https://github.com/EnhancedJax/Bagels

Thanks!

mrusme

You have built a beautiful TUI, hats off. Having that said, however, if feels like a missed opportunity for this project to use an SQLAlchemy-based database backend over the more simplistic and widely supported ledger [1] format. While I understand that the your tool might not want to leverage the full complexity of a double-entry accounting system, as a friend of plain text accounting [2] I would have preferred a format that I can alter with existing tools, in order to be able to integrate _Bagels_ into an existing workflow.

Nevertheless, the TUI looks very clean and shows nicely how powerful the Textual application framework is.

[1] https://ledger-cli.org [2] https://plaintextaccounting.org

pmarreck

I don't know why (other than being a Gen X nerd) but I have a bizarre affinity for nicely-written TUI apps of late! Things like btop++ that respond to mouse clicks and smoothly reflow when the terminal window is resized etc...

Shout-out to Charmbracelet's stuff such as Glow (https://github.com/charmbracelet/glow) and Gum (https://github.com/charmbracelet/gum) for rendering markdown nicely in the terminal and for using TUI in your shell scripts

Gshaheen

I too am obsessed with beautiful TUI apps. I would love to see them inside a browser to lower the barrier to entry for the majority of folks. Almost like an emulated terminal inside the browser that’s simply accessed by url.

Are there any frameworks or examples of this being done?

stanac

This TUI is really beautiful. Looking at those rounded corners I am wondering if it is using some specific font created just for TUI.

EnhancedJax

Textual automatically has a rounded border style for containers!

joshka

They're in the Unicode box drawing block. https://en.wikipedia.org/wiki/Box-drawing_character

stanac

I am aware of those, I have used them, but this font has rounded corners on boxes, that's why I believe it is a custom font.

EnhancedJax

Baked into the Textual framework!

liamwire

Huge fan of wrapping simple PowerShell tools with Gum for making things a bit nicer for colleagues to use, Charm’s entire catalogue is art

danielvaughn

I love Charm so much.

matt3210

TUI is the superior ui. Works locally and via ssh.

dewey

But not on mobile, which is a big draw back especially for something you might want to do on the go (Op said that’s not the goal, but for me it would be)

nejsjsjsbsb

On Android you can install a Linux app and run it there. UX may be lacking. But add a BT keyboard and mouse and it ain't bad.

sorenjan

Textual can run the tui apps as web apps.

https://github.com/Textualize/textual-web

nejsjsjsbsb

k9s is also nice

marcyb5st

lazydocker as well. Also a big fan of bottom (https://github.com/ClementTsang/bottom) , which surprisignly enough even though it has charts and everything, it consumes way fewer resources on my system compared to htop.

thih9

Note: if anyone doesn't want to install the uv package manager via piping to shell, the:

    pip install uv
also works; more information: https://github.com/astral-sh/uv#installation

nickjj

Have you given consideration on using CSV files for the back-end?

I ask because funny enough over the weekend I spent 4 hours writing a terminal based expense tracker with a sole focus on making it easy to see income vs expenses vs business expenses totals to make it easier for me to file quarterly and yearly taxes. It's not a TUI but it lets me put items into a category and it tallies up the amounts with counts.

It's simple input / output with CSV files that you can edit with whatever editor you want and that's the main reason I wrote it. I've been using GnuCash for almost 10 years and it's kind of inefficient to input data quickly.

It's nice to see your project on the other side of the spectrum (super polished, TUI, etc.). What's it like to quickly add in items or generate income / expense / business expense reports? Ideally I'd like to be able to open my code editor of choice and do whatever operations I need to quickly insert multiple items into multiple categories.

EnhancedJax

No, it never came across my mind unfortunately. There are a handful of relations between each table for my schema design, so never though CSV would be viable for my use case.

The TUI is the frontend for the schema. You can do all CRUD with the UI, and I designed it to be able to add multiple records quickly, with input modes and templates!

terminaltrove

Thanks for making Bagels Jax, this is a very advanced TUI which is nicely shown in the screenshots, and also showcases the power of Textual which is a very powerful framework.

Great job!

If anyone is looking for tools or TUIs out there in Python or other languages we host a collection of them here [0] [1]

[0] https://terminaltrove.com/

[1] https://terminaltrove.com/language/python/

EnhancedJax

Thank you! Actually, I've submitted Bagels to terminaltrove I think a few weeks back but haven't got any replies, should I send an email to the curator instead?

terminaltrove

It's all good, I believe we found your submission and it is due to be listed.

We get hundreds of submissions a day and we try out most of the tools that are submitted, but we are more receptive to screenshots, ease of install / multiple packages (if any), and if it is (ideally) cross platform.

You should see Bagels in the trove soon!

alwyn

Thank you for introducing me to Terminal Trove. So many tools to try and experience, loving it!

gorgoiler

Kudos, great execution on the project and on the code too.

Question: Is there a good equivalent of the Dewey Decimal system for household and/or business expenses? I like your two level breakdown in default_categories.yaml and the must/need/want system and I’m wondering what prior art you used to put that together?

I see about 800 payees for my own transactions over the past two years and while the big ticket items are easy enough to spot — my favourite grocery store, my landlord, etc. — having a taxonomy that can encompass the long tail of spending would give me confidence that I have 100% understanding of my finances.

Edit: Here’s one from some UN statisticians. Turn to page 40 of the PDF (p27 in print) for the basic structure overview:

https://unstats.un.org/unsd/classifications/Econ/Download/In...

The overview felt quite ergonomic but rebalancing the overview to maintain constant branching might be useful. Section 625 on “retail services” is very large.

EnhancedJax

Sorry, I don't seem to understand your question... I think you're talking about categories and subcategories? You can have household as the parent category and all the expenses under it. The must/need/want system (I think) is used by a lot of expense trackers, and for Bagels I used it as a way to limit unnecessary spending (want%).

I primarily built Bagels starting from my use case, so maybe some of the modelling might not suit expenses of large quantities. I haven't got to the point in life where I have to pay taxes and bills yet haha

netsharc

Seems like grandparent commenter wants to add classifying codes to items s/he's bought.

For example from that PDF, bagels would have the classification "23490 Bread and other bakers' wares". That's under "23 Grain mill products, starches and starch products; other food products" -> "234 Bakery products".

To be able to see how often one buys grain products, and then bread products, is either funny, or an unnecessary amount of detail.

I've thought of scanning all my grocery store receipts, for example to calculate how many liters of Coca-Cola I've bought in a time period...

garyrob

Feedback requested: while I see that there is a bit of controversy about the author's using uv, I am wondering how much of a barrier that really is.

Suppose someone were to write a Python terminal app such that the docs required uv OR pipx. And it installed all its own dependencies, etc. using those mechanisms.

Would that be an acceptable way to write a useful utility these days? Or, if that person wanted to write a utility, would they get far more uptake if it were to be provided as an executable written in Rust?

JTyQZSnP3cQGa8B

IMHO there is no controversy. If you write applications in Python, you must have a modern package manager whether it’s uv or hatch or anything else.

I think that uv is the best so far but it doesn’t matter.

garyrob

I understand. But what I'm hoping for feedback about is: would I lose a lot of potential users of my utility if I write it in Python and require them to have uv, pipx, etc.? Because I could write it in Rust and just provide it as an executable. But Python would be easier for me as the developer.

bvrmn

Amazing project!

> I built this mainly around the habit of budget tracking at the end of the day.

I've built 3 personal financial trackers. 2 CLI based and last a web-based to be able to serve it in termux as a local android app.

Anecdote: the only thing which make it usable in the end is a joint account (most transactions are happened there) which reduced monthly transaction count to low acceptable level and did not become a chore without fancy importing from bank statements. Joint account allows to record only transfers and not individual expenses. It easily could be a separate account for small expenses, it has a low value to know which kind of grocery takes most of money.

EnhancedJax

Cool, are they open source? Would love to check them out!

> which make it usable in the end is a joint account (most transactions are happened there) which reduced monthly transaction count to low acceptable level

I'm not sure if I understand...

JTyQZSnP3cQGa8B

Is there an envelope system? I would definitely help write one if that’s not the case. Anyway it’s great, that’s exactly what I needed.

skwee357

This is amazing! But I wish it would use the ledger/beancount file format, as I don't have plans to migrate years of transactions.

oneeyedpigeon

It looks great, but I don't feel enthusiastic about installing yet another package manager. Are there really enough benefits from uv to justify it as the only option?

lpedrosa

> Are there really enough benefits from uv to justify it as the only option?

The author probably really likes uv, thus the biased instructions.

I also think uv is great, but I wouldn't mention it in the user facing installation instructions. People are used to pip/pipx, thus asking them to install yet another tool might drive potential users away.

The usual pip or pipx command should work fine. It's listed on PyPI: https://pypi.org/project/Bagels

I would only mention uv in the Development Setup section (https://github.com/EnhancedJax/Bagels?tab=readme-ov-file#dev...)

sorenjan

I find uv to be a great way for installing and trying different Python projects. It comes with the uvx command, which makes a temporary venv, installs the right Python version and all project dependencies, and starts the program. It uses the PyPi index, so it's not the only option, but I think it's better than pip/pipx.

For instance, running `uvx --python 3.13 Bagels` made a temporary environment and installed all dependencies in 1.01s on my computer, and it took less than 10 seconds for the program to start after creating a database etc. Next start takes less than 2 seconds since it's cached. If I decide I want to keep using it, I can install it using the uv tool command, if not I just do nothing.

https://docs.astral.sh/uv/guides/tools/

EnhancedJax

I believe you can simply use pipx, if you have that. I picked uv because it handles installing python for you. I do want to add Bagels to homebrew, but have to do a bit more reading to figure that out.

sorenjan

I think you should change the Windows install section in the readme. Instead of installing uv by downloading and running a Powershell script you can use winget:

  winget install --id=astral-sh.uv  -e
https://docs.astral.sh/uv/getting-started/installation/#wing...

EnhancedJax

Thanks! Will check out!

wdroz

They are using the "normal" dependencies section in the pyproject.toml, so you should be able to install with pip or other tools if you want.

It's only for dev-specifics dependencies that they are using the uv-specifics section.

You can try uv in 2 min and see if you like it or not.

ramon156

Im going to try this for myself. One questions though, does it support imports from stuff like gocardless[0]? Actual Budget supports this so I can import from EU banks.

[0] https://gocardless.com/guides/posts/european-payments/

EnhancedJax

Not atm. But you can write a script to feed your data into the sqlite db file! The schema can be found in https://github.com/EnhancedJax/Bagels/tree/main/src/bagels/m...