A Go framework for building terminal-style user interfaces that run in web browsers. Terminus brings the simplicity and power of terminal UIs to the web, using a Model-View-Update (MVU) architecture similar to Elm.
NOTE This project is a demonstration of vibe coding intended to provide a trustworthy and verifiable example that developers and researchers can use. It is not intended for use in a production environment.
This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.
- ๐ฅ๏ธ Terminal-Style UI in the Browser: Build text-based interfaces that run in any modern web browser
- ๐ฏ MVU Architecture: Simple, predictable state management with Model-View-Update pattern
- ๐ฆ Rich Widget Library: Pre-built components for common UI needs
- ๐ Server-Side Rendering: Keep your application logic in Go, minimize client-side JavaScript
- โก Real-Time Updates: WebSocket-based communication for instant UI updates
- ๐จ Full Styling Support: Colors, bold, italic, underline, and more using ANSI-style formatting
- ๐ฑ Responsive Design: Works on desktop and mobile browsers
- ๐ง Easy to Extend: Simple component interface for building custom widgets
Full-featured text input with:
- Cursor movement and text editing
- Validation support
- Placeholder text
- Max length constraints
- Custom styling for all states
Scrollable lists with:
- Keyboard navigation
- Real-time filtering
- Custom item rendering
- Selection callbacks
- Wrap-around navigation
Data tables with:
- Sortable columns
- Cell/row selection
- Custom alignment
- Row numbers
- Header customization
Loading indicators with:
- Multiple animation styles
- Custom characters
- Configurable speed
- Text positioning
go get github.com/GoogleCloudPlatform/terminuspackage main
import (
"fmt"
"log"
"github.com/GoogleCloudPlatform/terminus/pkg/terminus"
"github.com/GoogleCloudPlatform/terminus/terminus/style"
)
type HelloWorld struct {
count int
}
func (h *HelloWorld) Init() terminus.Cmd {
return nil
}
func (h *HelloWorld) Update(msg terminus.Msg) (terminus.Component, terminus.Cmd) {
switch msg := msg.(type) {
case terminus.KeyMsg:
switch msg.Type {
case terminus.KeyUp:
h.count++
case terminus.KeyDown:
h.count--
case terminus.KeyEscape:
return h, terminus.Quit
}
}
return h, nil
}
func (h *HelloWorld) View() string {
title := style.New().Bold(true).Foreground(style.Cyan).Render("Terminus Counter")
counter := style.New().Bold(true).Render(fmt.Sprintf("Count: %d", h.count))
help := style.New().Faint(true).Render("โ/โ to change โข ESC to quit")
return fmt.Sprintf("%s\n\n%s\n\n%s", title, counter, help)
}
func main() {
program := terminus.NewProgram(
func() terminus.Component { return &HelloWorld{} },
terminus.WithAddress(":8080"),
)
fmt.Println("Starting on http://localhost:8080")
if err := program.Start(); err != nil {
log.Fatal(err)
}
program.Wait()
}- Getting Started - Quick introduction and your first app
- Tutorial - Build a complete todo list application
- API Reference - Detailed component and widget documentation
- Architecture - How Terminus works under the hood
Explore our example applications:
| Example | Description | Run Command |
|---|---|---|
| Hello World | Simple starter app | go run ./examples/hello/ |
| Todo List | Task management with persistence | go run ./examples/todo/ |
| Chat | Real-time messaging | go run ./examples/chat/ |
| Dashboard | Complex layouts | go run ./examples/dashboard/ |
| Widgets | All widgets showcase | go run ./examples/widgets/ |
| Text Input | Forms with validation | go run ./examples/textinput/ |
| Commands | Advanced command usage | go run ./examples/commands/ |
| Layout | Layout system demo | go run ./examples/layout/ |
| Gemini Chat | AI chat with Google Gemini | go run ./examples/gemini_chat/ |
All examples run on http://localhost:8890 by default.
Terminus uses a unique server-side architecture:
โโโโโโโโโโโโโโโ WebSocket โโโโโโโโโโโโโโโ
โ Browser โ โโโโโโโโโโโโโโโโโโโโโโโโบ โ Go Server โ
โ โ JSON Messages โ โ
โ โโโโโโโโโโโ โ โ โโโโโโโโโโโ โ
โ โ Thin โ โ โ โ MVU โ โ
โ โ Client โ โ โ โ Engine โ โ
โ โโโโโโโโโโโ โ โ โโโโโโโโโโโ โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
Key benefits:
- Zero client-side state - All logic stays in Go
- Automatic UI updates - Just update your model
- Secure by default - No client-side code execution
- Easy testing - Pure functions throughout
- Core MVU engine with component system
- WebSocket communication layer
- Session management
- Full ANSI styling system (16, 256, and RGB colors)
- Efficient line-based diff algorithm
- Complete widget library (TextInput, List, Table, Spinner)
- Layout system with box drawing
- HTTP command helpers
- Comprehensive documentation
- Enhanced JavaScript client with full color support
- Performance optimizations
- Mouse support
- Browser compatibility testing
- Security hardening
- Additional widgets (Progress, Select, Tree)
- Hot reload for development
- DevTools browser extension
- Plugin system
We welcome contributions! Areas where you can help:
- ๐ Documentation improvements
- ๐ Bug reports and fixes
- โจ New widget implementations
- ๐จ Example applications
- ๐ Internationalization
- โก Performance optimizations
Please see our Contributing Guide (coming soon).
This project is licensed under the Apache 2.0 License.
Terminus is inspired by:
- Bubble Tea - Terminal UI framework for Go
- Elm - The MVU architecture
- Terminal emulators and their rich history
Happy coding! ๐