Show HN: Bagels – TUI expense tracker
github.comHi! 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!
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
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
I love Charm so much.
This TUI is really beautiful. Looking at those rounded corners I am wondering if it is using some specific font created just for TUI.
They're in the Unicode box drawing block. https://en.wikipedia.org/wiki/Box-drawing_character
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.
The code references FiraCode:
https://github.com/EnhancedJax/Bagels/blob/7b4bfd051f6beff8f...
But the actual character is: ╯
256F ╯ Box Drawings Light Arc Up And Left
https://www.unicode.org/charts/nameslist/n_2500.html
Baked into the Textual framework!
Textual automatically has a rounded border style for containers!
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?
ssh in the browser + self-hosting is usually all you need.
I was thinking more completely self contained. Did some research and seems it might be possible with xterm + webcontainer.
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.
I currently host an ssh-only game that logs you in based on your github user. Ie: ssh withinboredom@my-game and it looks your keys up at github.com/withinboredom.keys ... then uses that as the authorized keys (this is all built-in to ssh btw).
It wouldn't be too difficult to extend this to support webauthn/passkeys via a little bit of magic.
Actually... that sounds like a pretty interesting project.
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).
TUI is the superior ui. Works locally and via ssh.
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)
Textual can run the tui apps as web apps.
https://github.com/Textualize/textual-web
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.
That’s really not what people understand as a “mobile” experience.
In that case best option is if this writes to files use Dropbox and another app that understands the format.
iOS has terminals too now, but of course sandboxed. You could install this in there, though, and no linux needed.
k9s is also nice
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.
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
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.
You can do whatever you want with your own accounts. I don't have anything like an "accounts receivable" in mine.
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.
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.
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
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...
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!
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/
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?
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!
Thank you for introducing me to Terminal Trove. So many tools to try and experience, loving it!
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.
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!
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.
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?
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/
> 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...)
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.
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:
https://docs.astral.sh/uv/getting-started/installation/#wing...Thanks! Will check out!
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.
How different is this from ledger in terms of storing transactions???
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.
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.
Converting between pta formats is easy but between pta and database formats will always be difficult.
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/
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/
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...
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.
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...
Very nice design! Kudos. Looks like something I would use. For me personally, bank/CC sync is a dealbreaker for any personal budgeting/expense app as there is no way I have the time to enter those in manually or even download monthly CSVs and import them. (I presently use Copilot -- not related to MSFT, though I don't know how they'll survive without a rename now that MSFT has gone "all-in" with "Copilot-everything" :/ -- for this feature alone.)
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?
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.
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.
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?
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
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).
Looks great. I've scanned the front page of the GH repo and I don't see a mention of double-entry accounting, so curious if it is doing that under the hood?
That is a very slick UI. I was expecting something a lot simpler.
Note: if anyone doesn't want to install the uv package manager via piping to shell, the:
also works; more information: https://github.com/astral-sh/uv#installationNice job, you should add it here: https://textual.textualize.io/#built-with-textual
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.
i have expense tracker in my long "todos" list, it should have the following: - copy and paste bank transfers from online bank. not just the monthly report because then it's not real time - offline or self-host, no cloud - no ai, but pattern match to auto tag each line and learn from it don't think will ever have a time to do this, so feel free to steal these
Great use of TUI ! I wonder if this app implements a method to import spending from bank account exported to a .csv for example, this would be very useful !
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...
To run without setup:
uv run --python 3.13 --no-project --with bagels bagels
Oh wow! That looks really nice. I’ve been wanting to okay with Textual too. This makes me even more intrigued.
Definitely try textual! Their support on Discord is really nice too
What I would like to know is where you are able to find bagels for $2.5!
Looks very slick though, congrats on getting it to this level of polish!
:D
Superb application and I agree the terminal simplicity plus some minima amount of visualisation is what appeals to me. But my online banking provides all of this plus automatic categorisation and if needed I can always export to csv. So not sure why I would enter these manually, I guess it’s different in the US? (I live in Europe where things like easy export and account transfers are required by law)
Same. But since it is just sqlite; it should be rather simple-ish to export my account as json and import it. It'd probably take a weekend, max.
However, there is some value in entering your expenses manually... either you won't; or you'll spend less so you have less to enter.
I live in Hong Kong, and the problem is I juggle around 5 different accounts, including transit cards, mobile wallet apps and cash. I use my transit card to pay for transit and food, wallet apps to online shop etc. and there's no centralized system to manage expenses other than a tracker.
Good to understand - HongKong was a finiancial hub for Asia and an early adopter of 'fintech' which means you are stuck with banks running on tech from the 1980s while some developing countries went straight to mobile payments....
WTF! This is absolutely so cool. Thank you!!
Thanks!
Looks gorgeous! Respect to Jax.
this is so cool! thank you for building this.
Dude this is so pretty. I’m definitely going to be using this, as I’ve been trying to find a good expense tracker but the web platforms all suck in various ways.
I love jax
I love jax !
[flagged]