gitmyhub

bubbletea

Go ★ 43k updated 6d ago

A powerful little TUI framework 🏗

A Go framework for building polished interactive terminal apps, file managers, dashboards, config wizards, using a clean three-part architecture that keeps state, logic, and rendering strictly separated.

Gosetup: moderatecomplexity 3/5

Bubble Tea is a Go framework for building interactive terminal user interfaces (TUIs) — programs that run inside a terminal window and respond to keyboard and mouse input, but look far more polished than a plain command-line tool. Think of tools like file managers, interactive git clients, or configuration wizards that run entirely in your terminal.

The framework solves a specific design problem: building interactive terminal apps traditionally means managing a lot of messy state — tracking what is on the screen, deciding when to redraw, handling keyboard input, and keeping everything consistent. This quickly becomes spaghetti code. Bubble Tea solves this by applying a design pattern called The Elm Architecture (originally from a web programming language called Elm), which enforces a clean separation of concerns.

Here is how it works: your application has three pieces. The Model holds all application state (what items are in a list, what the cursor position is, what has been selected). The Update function receives events like keypresses or network responses and returns a new version of the model — it never mutates state directly. The View function takes the current model and returns what should be rendered on screen. Bubble Tea's runtime calls these three functions in a loop, handling all the low-level terminal drawing, cursor management, color output, and resize events for you. An optional component library called "Bubbles" provides ready-made building blocks like text inputs, progress bars, and list pickers.

You would use Bubble Tea when building a developer tool, CLI configuration wizard, database browser, deployment dashboard, or any program where you want a rich, interactive terminal experience instead of a flat sequence of prompts. It is well-suited for both small inline widgets and full-screen applications.

The stack is Go, with no external runtime dependencies beyond the Bubble Tea library itself.

Where it fits