Inspiration
I like to sometimes code Terminal User Interfaces in python and saw bubbletea recommended heavily. So I decided to use Royal Hackaway as an opportunity to check it out as well as golang as a whole.
There is a discord bot called Grow a Tree who's functionality seemed reasonably simple to replicate to provide a goal.
What it does
The user launches the client which connects to a central server to allow multiple people to share a tree. The idea is that the users work together every interval (for testing it is currently 15s) to make sure the tree is watered so it can keep growing. It does this
How I built it
I used websockets to communicate between the client and the server, using the json module of go to conveniently go between json and structs.
The client uses bubbletea + a few extensions (bubbles , lipgloss and the image from teacup)
Not coding related but they also have a very nice tool to use for gifs. https://github.com/charmbracelet/vhs, which i used to produce the gif at the top.
Challenges I ran into
Apparently if I add error handlers to specific parts of the code it results in concurrency errors? I believe it is incorrect usage of loggers, and can't use stdout as it is occupied with the user interface.
I was not familiar with the architecture bubbletea uses before and this cause confusion when integrating it with the websocket library.
Accomplishments that I'm proud of
The architecture is quite different to other ui lib with the Elm architecture.
Also this is the first time I have programmed in go.
What we learned
How to use go, double check the best practices for library before using it.
What's next for GoATree
Looking into how it can be simplified.
Built With
- bubbletea
- go
- websockets
Log in or sign up for Devpost to join the conversation.