Show HN: Bagels – TUI expense tracker

github.com

274 points by EnhancedJax 3 days ago

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 2 days ago

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 2 days ago

    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

  • stanac 2 days ago

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

  • Gshaheen a day ago

    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?

    • withinboredom a day ago

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

      • Gshaheen 9 hours ago

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

      • alchemist1e9 a day ago

        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.

        • withinboredom a day ago

          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.

  • tartoran a day ago

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

  • matt3210 2 days ago

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

    • dewey 2 days ago

      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 2 days ago

        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.

        • dewey 2 days ago

          That’s really not what people understand as a “mobile” experience.

          • nejsjsjsbsb 2 days ago

            In that case best option is if this writes to files use Dropbox and another app that understands the format.

        • jeffhuys a day ago

          iOS has terminals too now, but of course sandboxed. You could install this in there, though, and no linux needed.

mrusme a day ago

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

  • withinboredom a day ago

    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 a day ago

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

  • globular-toast a day ago

    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.

gorgoiler 2 days ago

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 2 days ago

    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 2 days ago

      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 a day ago

      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 2 days ago

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 2 days ago

    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 2 days ago

      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 2 days ago

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

nickjj a day ago

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 a day ago

    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 2 days ago

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 2 days ago

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 2 days ago

    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 2 days ago

    > 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 2 days ago

    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.

  • wdroz 2 days ago

    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.

djvu97 2 days ago

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

  • dnel 2 days ago

    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 a day ago

      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 a day ago

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

nanna 2 days ago

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/

bvrmn a day ago

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 a day ago

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

insane_dreamer a day ago

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

garyrob a day ago

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 a day ago

    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 a day ago

      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.

wiseowise 2 days ago

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 2 days ago

    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

jimmcslim 2 days ago

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?

teruakohatu 2 days ago

That is a very slick UI. I was expecting something a lot simpler.

JTyQZSnP3cQGa8B a day ago

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.

anonymous344 a day ago

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

nighthawk454 2 days ago

To run without setup:

uv run --python 3.13 --no-project --with bagels bagels

TheTaytay a day ago

Oh wow! That looks really nice. I’ve been wanting to okay with Textual too. This makes me even more intrigued.

  • EnhancedJax a day ago

    Definitely try textual! Their support on Discord is really nice too

zznnzzzzzz 2 days ago

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!

Temporary_31337 2 days ago

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)

  • withinboredom a day ago

    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.

  • EnhancedJax 2 days ago

    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.

    • Temporary_31337 a day ago

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

skydiver7373 2 days ago

this is so cool! thank you for building this.

danielvaughn 2 days ago

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.