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

Show HN: Bagels – TUI expense tracker

Show HN: Bagels – TUI expense tracker

89 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!

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

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.

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.

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!

EnhancedJax

Textual automatically has a rounded border style for containers!

tartoran

Good TUI apps are written for efficiency. With a few keystroke you can navigate around and take actions that can be slower and tax more using GUIs and even more using modern GUIs. It appears to me that TUIs are seeing a rise in interest and that is probably not just fad driven, they're a lot more efficient for some tasks. Of course TUIs aren't for everyone and the learning curve could be steeper (not necessarily so though).

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?

pmarreck

Not sure but https://angband.live/ lets you play Angband (a purely terminal game) in the browser, or watch other people play it live, which is kind of neat

withinboredom

ssh in the browser + self-hosting is usually all you need.

alchemist1e9

browser terminal + ssh + self hosting!

I’ve not looked into this is years but I once had this idea that in browser terminal and I remember discovering there exists javascript xterm implementation.

For me though I was thinking the setup needs custom MFA security since public browsers or devices can be compromised. Haven’t researched yet how to somehow add that to the access.

If it worked how I’d imagine you can just walk up to any computer with a modern browser, go to your self-hosted IP, it sends you access code to phone, or uses authenticator or rsa token, something, and you get your terminal access.

Gshaheen

I was thinking more completely self contained. Did some research and seems it might be possible with xterm + webcontainer.

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)

sorenjan

Textual can run the tui apps as web apps.

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

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.

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.

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

globular-toast

This was my first thought too. Looking at the code it seems pretty tightly coupled to SQLAlchemy right now, but I imagine this could be replaced with a generic repository with a (probably read only) ledger backend to complement the SQLAlchemy one.

withinboredom

God. Please no. I hate double-entry accounting. I fiddled with Bagels for a bit and really like how simple it is to keep up to date. I don't need non-sensical accounts like "accounts receivable" and stuff like that. That's for my accountant.

For me, I just need a way to keep track of the money. That being said, I don't care too much about how it does things under the hood.

globular-toast

You can do whatever you want with your own accounts. I don't have anything like an "accounts receivable" in mine.

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...

gorgoiler

Yes, categories and sub-categories are important things to standardize if you have multiple people contributing to one cost reporting tool. My analogy was with the Dewey decimal system: a standard set of categories agreed upon by librarians so that they all agree how to organize their bookshelves!

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?

alwyn

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

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!

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.

djvu97

How different is this from ledger in terms of storing transactions???

dnel

Seems like a missed trick, I'm not going to change my accounting system for one app but if it was in the pta ecosystem I could easily see myself using it as a nice front end for my existing data files.

NoboruWataya

As a GnuCash user, my pipe dream in this area is all of these tools--ledger, beancount, GnuCash, this--operating on the same data format. There are some things I like about each of them but it is not easy to switch back and forth.

dnel

Converting between pta formats is easy but between pta and database formats will always be difficult.

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?

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/

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...)

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.

nanna

I must say that as an Emacs user, I do feel a bit jealous of UIs like this. Is it something about doing everything in buffers which means we don't make complex layouts like this? Could/should we take inspiration from something like Textual, which this expense tracker is built on top of? https://textual.textualize.io/

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...

wiseowise

Looks absolutely awesome.

But, man, Textual is such a chore to write and docs are crap. Is there HTML based TUI toolkit?

I know there’s https://github.com/vadimdemedes/ink, anything else besides it?

EnhancedJax

My first choice of framework was ink (came from web dev background), but couldn't get it to work how I wanted it to. Textual adopts the component model, and IMO the docs are awesome! It's like writing React honestly (without the reactive part. Textual does support reactivity, but couldn't get it to work and just wrote code to update the UI jQuery style). It also uses CSS to style, which is great and works as expected most of the time!

Maybe give it a second try haha

marcyb5st

In rust land there is a Dioxus renderer for TUIs (https://docs.rs/dioxus-tui/latest/dioxus_tui/ but I believe it is no longer one of the supported renderers). In JS there is Ink (https://github.com/vadimdemedes/ink).

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...