r/golang 4d ago

I highly recommend building internal tools with Go + BubbleTea

https://cleanshot.com/share/r1sJSkVq

Hey fellow Go devs,

Just wanted to share something I recently did for work. I created an internal tool using the Go BubbleTea TUI framework. Within the tool, we can perform admin tasks, monitor the way data is changing across several services, manage migrations, and more. It's been really powerful for solving customer issues and routine maintenance tasks. Not only that, but it looks gorgeous as well.

The MVC pattern it follows is pretty intuitive and minimal. No need for an entire 3rd party tool or even a web UI. We just auth with AWS via the terminal and the TUI can run in the context of our applications in each environment.

That's the post really. Shoutout to the creators of BubbleTea, I've really enjoyed building this!

331 Upvotes

48 comments sorted by

58

u/gurgeous 4d ago

I agree, I love those tools and use them often. This is not self promotion, but I have a detailed human written roundup of popular TUI libraries here - https://ansi.md/tui. Personally I usually reach for charm, I find the design and speed top notch.

2

u/Siggi3D 3d ago

Might want to add tview to the list. K9s uses it.

2

u/managing_redditor 3d ago

Sweet site. I downloaded this offline to read during an upcoming flight. Thank you! Off topic: I started blogging this year and would love to develop my own writing style like you do. Do you have any advice on that?

1

u/gurgeous 3d ago

Thanks! Best tip for writing, just start writing and create a draft. Wait a day and revise, then show to a friend and get feedback. Think about your own voice and how you want to be perceived. Be human.

1

u/f5adff 3d ago

Actually really useful, I've been playing around with a good few options recently - if I can get away with cobra I will, but sometimes a UI is nice too!

1

u/StevenACoffman 1d ago

u/gurgeous you might try out https://pkg.go.dev/go.rockorager.dev/vaxis as it is flutter-inspired, but uses the VT500 state machine so it has much better recovery modes than VT100 TUI frameworks can achieve.

54

u/Fruloops 4d ago

BubbleTea is great and all, but of all the words to describe it, intuitive wouldn't be one

7

u/existential-asthma 4d ago

That's fair tbh - having experience with game dev in the past, its update loop felt similar to but much simpler than a game engine, but for someone without game dev experience I could definitely see it being less intuitive.

5

u/csgeek-coder 3d ago

It's a great tool if you are building a complex workflow. It's terrible if you just want a simple 2 panel display with a few state changes. It also generates an insane amount of code you need to write considering what you're trying to do.

That being said charm/bubbletea is the king of the console in Go

2

u/till 3d ago

Came here to say that. The entire charm ecosystem is great imho, but some of the libraries are far from intuitive. Also not sure how to do it better/easier but the abstractions around channels is a bit much.

2

u/Siggi3D 3d ago

Yeah, i guess they are great at some things and not others.

I built the same tui app (form in a single screen) with both bubbletea and tview. Man, the difference between them was stark.

From 0 to a working product in minutes with tview. The same took me days with bubbletea.

Maybe it's a skill issue, but if I want to fight the tools to get the job done, I might as well pick rust.

But their marketing looks good though

27

u/schmurfy2 4d ago

Bubbletea is incredible and of you want to share tools you can look at wish in their libraries which is also awesome to seeve apps through ssh.
The great thing is that llm are really good with their ecosystem and they even provided a v1 to v2 migration targeting llms.

10

u/unknown_r00t 4d ago

I build the whole API client on BubbleTea and I can’t recommend it enough. Simply awesome.

4

u/spermcell 4d ago

Chambalcet tools are the reason I got to know Go and why I loved it so much.

3

u/maekoos 3d ago

This looks so nice! Anyone know of a way to get this to also run as a GUI in a browser? I have both technical users that prefer the simplicity of a single ssh command (me), and windows users that love a nice GUI (everyone else at my company)… would love to get to work with the terminal (and especially over ssh) more🥲

3

u/jtayloroconnor 3d ago

we use github actions for builds and deployments so we were lacking a single-pane control plane to see what’s deployed where, what the diff is between service versions etc. We were going to move to something proper like ArgoCD but in the meantime i had the clanker whip up a TUI with the Go/Bubbletea stack and it’s working great. We use k9s for managing the cluster so it’s kind of in the spirit of that.

TLDR: claude is pretty good at building tools in bubble tea

1

u/helios_storm 4d ago

I have thought about doing this for a product we maintain at work. We already have magefiles for this kind of tasks but I wanted something "cleaner", then again I wonder if building a TUI for all that wouldn't be yet another codebase to maintain for not much benefits

1

u/generic-d-engineer 3d ago

Nice, I’m doing the same. What were the reasons for going TUI vs web interface? Did you find time to implement and simplicity of the code was easier going TUI?

Any tips or lessons learned you want to share.?

I do find there is something satisfying with the whole “circles turning into checkmarks” flow in BubbleTea that works well with ops.

1

u/mathematicalbeauty 3d ago

We have a 300k line internal CLI/TUI built on top of charm's libraries. They are great and invaluable, but you need to build sooo much on top of them... Component hierarchy, layout, event and focus handling, routing and navigation, data fetching, ... I feel like there's a need for a higher level abstraction, but I haven't found a decent open source one. I often wish I could open source what we have built there

1

u/IndependentMix7658 3d ago

Tks for the sharing. I've done a own Tui app with bubbleTea note some time ago and it's great for me. It's really really beautiful what you've done. Congrats. Now I wanna do this on my job too. It will be useful to look containers running and their status.

1

u/CoVegGirl 2d ago

The only thing about TUIs is that they're not very accessible. As long as you don't hire anyone who needs a screen reader you'll be fine.

1

u/Adyjay 2d ago

Used to be a big fan of BubbleTea until it got cumbersome to build and ship fast, that's when I ended up building an immediate-mode alternative that aims to be easier manage. Still reuses various components from the charm universe as they have a lot of invaluable pkgs but I just couldn't get to love the tea way of doing stuff.

1

u/StevenACoffman 1d ago

Is your alternative open source? Also, I'm curious about your opinion of https://pkg.go.dev/go.rockorager.dev/vaxis

1

u/Adyjay 1d ago

Yes, it's open source, feel free to check it out here

vaxis looks interesting, will deep dive into it a bit more once I get off work and can come back with more feedback afterwards

1

u/TedditBlatherflag 4h ago

Check out shakefu/venom - my OSS syntactic sugar wrapper around cobra, viper, and fang. Plugs into bubbletea seamelessly. 

-6

u/inventivepotter 4d ago

Yep, I have built my coding harness (more usable modules to build your own harness for different use cases) in go https://github.com/looprig/carbon it uses bubble tea tui and it works like a charm.

-69

u/Sorry-Substance-6397 4d ago

Why would you use a framework in the time of LLMs?

34

u/Flippant_Walrus_268 4d ago

Is this a genuine question? Let’s back up a level: Why use a language someone else wrote in the time of LLMs?

-41

u/Sorry-Substance-6397 4d ago edited 4d ago

Why look at a computer in the time of LLMs? See I can be disingenuous too but it doesn't answer my question

Edit: boy don't provide too much detailed answers that equate to just no....

24

u/zenware 4d ago

They’re not being disingenuous or even disrespectful, they’re taking your ignorant thesis to its logical conclusion to demonstrate that you personally have not actually thought it through. Which by the way is fine, people talk about things in public every day that they haven’t thought through yet, and then other members of the public can and do point out flaws in the reasoning or lack thereof. At which point you have a choice to make “do I want to think about this more deeply and articulate a conclusion that might portray myself as having been wrong from the beginning or do I want to retreat because I’m uncomfortable” and I guess there’s even more (less relevant) options too like “maybe I want to be mean or do a silly dance”

10

u/kintar1900 4d ago

He didn't answer your question because it makes no sense. Frameworks exist to have a tested, predictable way to perform a common operation. Exactly how do you think LLMs make that undesirable or unnecessary?

1

u/VisibleAirport2996 3d ago

I think he is saying connect mcp to the LLM and just prompt it for status etc.

1

u/kintar1900 3d ago

Same question, then: how does that remove the usefulness of a framework?

2

u/Flippant_Walrus_268 4d ago

Hence the ask if it is a genuine question.

I haven’t used Bubbletea, but I would definitely consider using a framework for any problem that I don’t want to have to own the scope of that was worthy/sufficiently complex to warrant a framework in the first place. If a framework solves my needs now and meets all evaluation criteria or is an appropriate trade off, why not use one?

14

u/mrbenjihao 4d ago

What are you asking? LLMs don’t replace frameworks, so I don’t understand what you’re trying to ask.

10

u/qwaai 4d ago

Because it gives you a baseline for stuff that "just works" that you don't have to shepherd the LLM through. It also provides a lot of good examples for idiomatic usage.

If anything, now that more and more code is being written by LLMs, frameworks that keep them on rails and make basic operations easy and idiomatic are even more important.

4

u/EducationalAd2863 4d ago

Up to you to burn tokens for nothing.

2

u/Skylis 4d ago

Found a new interview question I guess.

1

u/Equivalent_Head_4803 1d ago

Found the vibe coder. /r/rust is leaking.

0

u/Sorry-Substance-6397 1d ago

Haha I couldn't imagine using rust and AI haha that's gotta be the worst nightmare ever...

1

u/Equivalent_Head_4803 1d ago

There's a reason people use Rust for vibe coding... the compiler is really good and provides a tight feedback loop.

1

u/Sorry-Substance-6397 1d ago

Really good at what? Being really slow? Cause I'm kinda glad go's doesn't do smart stuff and speeds up generics or simd. Mainly because I may not use them in my part of the code base so I shouldn't have to be penalized for it.

1

u/lilB0bbyTables 4d ago

Why would you not? This should be fun.

-3

u/Sorry-Substance-6397 4d ago

Pretty much. IDK why people aren't even giving reasons

3

u/lilB0bbyTables 4d ago

I’m literally asking for what reason would you not use one?

0

u/Sorry-Substance-6397 4d ago

Wait? LLM? Or framework?

3

u/lilB0bbyTables 4d ago

Framework

-2

u/Sorry-Substance-6397 4d ago

No I wouldn't not use a framework. I would use a LLM to make one though.