Mirador - Database Explorer

A terminal-based database explorer built with Go and Bubble Tea. Mirador (Spanish for "viewpoint") provides an interactive TUI for connecting to and exploring database structures across PostgreSQL, MySQL, and SQLite databases.
Features
- Multi-database support: PostgreSQL, MySQL, and SQLite
- Interactive TUI: Clean, keyboard-driven interface
- Connection management: Save, edit, and switch between database connections
- Schema exploration: Browse tables, views, columns, indexes, and relationships
- Data preview: Quick view of table contents without writing SQL
- SQL query execution: Run custom queries with formatted results
- Export functionality: Export data to CSV and JSON formats
- Query history: Save and recall previously executed queries
Architecture
mirador/
βββ main.go # Main entry point with update logic
βββ internal/
β βββ config/ # Configuration and file storage
β βββ database/ # Database operations and adapters
β βββ models/ # Core types and interfaces
β βββ styles/ # UI theming
β βββ utils/ # Helper functions and utilities
β βββ views/ # UI view rendering
Mirador follows a clean, modular architecture with well-separated concerns across configuration management, database operations, type definitions, UI styling, utility functions, and view rendering. The main application logic and Bubble Tea update handlers are implemented in main.go using the appModel wrapper pattern.
Utils Package
The utils package provides centralized helper functions organized by domain:
- Database utilities: Schema detection, SQL generation, primary key finding, connection handling
- Data processing: Sorting parameters, table info creation, list management, result handling
- UI utilities: Smart table creation, intelligent column width calculation, enhanced data truncation
- Mathematical utilities: Min/max functions, pagination calculations
- Type inference: Content-aware data type detection (numeric, date, boolean, text), datetime parsing
- Timeout utilities: Async command helpers with timeouts and connection testing
Installation
Prerequisites
Build from source
git clone <repository-url>
cd mirador
go mod tidy
go build -o mirador main.go
Usage
Run the application:
./mirador
Or run directly with Go:
go run main.go
Navigation Controls
Global
- β/β: Navigate lists and tables
- Enter: Select or confirm
- Esc: Go back
- q/Ctrl+C: Quit
DB Type Selection
- enter: Select database type
- s: Open saved connections
- q: Quit
Saved Connections
Connection Form
- Enter: Save and connect
- F1: Test connection
- Tab: Switch fields
- Esc: Back
Schemas
- enter: Select schema
- esc: Back
Tables
- enter: Preview data
- v: View columns
- f: Relationships
- esc: Disconnect
Columns
- β/β: Navigate
- esc: Back to tables
Data Preview
- hjkl/ββββ: Navigate table and pages
- enter: Row details
- /: Filter data across all columns
- s: Sort mode - select column and cycle sort direction
- r: Reload table data
- h/l: Scroll columns horizontally when table is wider than screen
- Filter mode: enter apply filter, esc cancel
- Sort mode: β/β select column, enter cycle sort (offβascβdescβoff), esc exit
- esc: Back to tables
Row Details
- Field list: β/β navigate, enter view field, e edit, esc back
- Field detail: ββ/jk scroll, ββ/hl horizontal scroll, esc back
- Edit field: Ctrl+S save, Ctrl+K clear, Esc cancel
Query Runner
- Enter: Execute query
- Tab: Switch focus
- β/β: Navigate results
- Ctrl+E: Export CSV
- Ctrl+J: Export JSON
- Esc: Back to tables
Query History
- enter: Use query
- d: Delete
- esc: Back
Connection Strings
PostgreSQL
postgres://username:password@localhost:5432/database_name?sslmode=disable
MySQL
username:password@tcp(localhost:3306)/database_name
SQLite
/path/to/your/database.db
Workflow
- Select Database Type: Choose from PostgreSQL, MySQL, or SQLite
- Enter Connection String: Provide the appropriate connection string for your database
- Browse Tables: View all available tables in the connected database
- Explore Data: Preview table data (first 10 rows) or view column structure
- Run Queries: Execute custom SQL queries with formatted table results
- Export Data: Export query results or table previews to CSV/JSON format
π¦ Database Features
π·οΈ Schema Support
- PostgreSQL: Full schema support with automatic detection and selection interface
- MySQL: Database-level organization (no schema selection needed)
- SQLite: Uses default
main schema
π Tables & Views
- Enhanced data preview with smart column width distribution
- Improved sorting indicators directly in column headers (β/β)
- Intelligent data truncation for better readability
- Full column structure browsing for both tables and views
π Indexes & Constraints
- Complete index information (primary keys, unique indexes, regular indexes)
- Constraint details (foreign keys, primary keys, check constraints)
- Visual organization with type, affected columns, and full definitions
π Foreign Key Relationships
- Comprehensive relationship visualization across all tables
- Cross-database support for all relationship types
- Shows source/target tables and columns with constraint names
π€ Export Capabilities
- CSV: Comma-separated values with headers
- JSON: Array of objects format
- Automatic timestamped filenames
- Export from query results or table previews
π οΈ Development
π Quick Development Setup
# Clone and setup
git clone https://github.com/dancaldera/mirador.git
cd mirador
go mod tidy
# Run in development mode
go run main.go
# Build for production
go build -o mirador main.go
# Run tests
go test ./...
π Development Commands
| Command |
Purpose |
Notes |
go mod tidy |
Install dependencies |
Run after cloning |
go fmt ./... |
Format code |
Required before commit |
go vet ./... |
Static analysis |
Catches common errors |
go test ./... |
Run tests |
All tests must pass |
go build |
Build binary |
Creates mirador executable |
go run main.go |
Development run |
Hot reload for changes |
π Code Quality Standards
- File size limit: All source files must be under 500 lines
- Separation of concerns: Clear module boundaries and responsibilities
- Testing: Tests alongside code as
*_test.go files
- Formatting: Follow standard Go formatting (
go fmt)
- Documentation: Public functions must have Go doc comments
π¨ Architecture Patterns
- TEA Pattern: Model-Update-View architecture via Bubble Tea
- Dependency Injection: Components wired through initialization
- Package Organization: Domain-driven internal package structure
- Error Handling: Explicit error handling with user-friendly messages
π¦ Dependencies
Mirador is built on these excellent open-source libraries:
π¨ UI Framework
ποΈ Database Drivers
π Go Requirements
- Go Version: 1.24.5 or later
- CGO: Required for SQLite support
- Build Tags: None required
π€ Contributing
We welcome contributions! Here's how to get started:
π Quick Contribution Guide
-
Fork & Clone
git clone https://github.com/your-username/mirador.git
cd mirador
-
Create Feature Branch
git checkout -b feature/amazing-feature
-
Make Changes
- Follow our coding standards
- Add tests for new functionality
- Update documentation as needed
-
Test & Validate
go test ./...
go fmt ./...
go vet ./...
-
Submit Pull Request
- Use our PR template
- Link related issues
- Add screenshots for UI changes
π Contribution Areas
| Area |
Examples |
Difficulty |
| π Bug Fixes |
Connection issues, UI glitches |
π’ Beginner |
| π¨ UI/UX |
New themes, better layouts |
π‘ Intermediate |
| ποΈ Database Support |
New drivers, query features |
π΄ Advanced |
| π Documentation |
Guides, examples, translations |
π’ Beginner |
| β‘ Performance |
Query optimization, caching |
π΄ Advanced |
π License
MIT License Β© 2025 Daniel Caldera
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.
See LICENSE file for full details.
β Star History

π Built with β€οΈ by developers, for developers
Mirador - Your viewpoint into database exploration
Made with β and Go in 2025