{"id":13563759,"url":"https://github.com/KenanBek/dbui","last_synced_at":"2025-04-03T20:31:45.817Z","repository":{"id":38833534,"uuid":"365829904","full_name":"KenanBek/dbui","owner":"KenanBek","description":"Universal Database CLI for MySQL, PostgreSQL, and SQLite. Terminal User Interface Application.","archived":false,"fork":false,"pushed_at":"2023-03-29T14:48:13.000Z","size":2085,"stargazers_count":194,"open_issues_count":26,"forks_count":13,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-31T21:51:25.062Z","etag":null,"topics":["cli","database","database-management","go","golang","mysql","postgresql","sqlite","tui"],"latest_commit_sha":null,"homepage":"https://kenanbek.gitbook.io/dbui/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KenanBek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["KenanBek"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.paypal.me/KananRahimov","https://www.codervlogger.com/#/portal/signup"]}},"created_at":"2021-05-09T19:16:06.000Z","updated_at":"2025-03-24T17:28:08.000Z","dependencies_parsed_at":"2024-03-16T22:58:31.589Z","dependency_job_id":"0f2abb4e-8111-4dbd-bdac-5d859aca7103","html_url":"https://github.com/KenanBek/dbui","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenanBek%2Fdbui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenanBek%2Fdbui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenanBek%2Fdbui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenanBek%2Fdbui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KenanBek","download_url":"https://codeload.github.com/KenanBek/dbui/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247074800,"owners_count":20879329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","database","database-management","go","golang","mysql","postgresql","sqlite","tui"],"created_at":"2024-08-01T13:01:23.012Z","updated_at":"2025-04-03T20:31:44.934Z","avatar_url":"https://github.com/KenanBek.png","language":"Go","funding_links":["https://github.com/sponsors/KenanBek","https://www.paypal.me/KananRahimov","https://www.codervlogger.com/#/portal/signup"],"categories":["Go","cli"],"sub_categories":[],"readme":"# 🗄 DBUI: Database CLI\n\n**dbui** is database CLI for MySQL and PostgreSQL. It is the terminal user interface application built\nwith the [tview](https://github.com/rivo/tview).\n\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/kenanbek/dbui)](https://github.com/KenanBek/dbui/releases/latest)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kenanbek/dbui/Build)](https://github.com/KenanBek/dbui/actions/workflows/build.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kenanbek/dbui)](https://goreportcard.com/report/github.com/kenanbek/dbui)\n[![Codecov](https://img.shields.io/codecov/c/github/kenanbek/dbui)](https://app.codecov.io/gh/KenanBek/dbui/)\n\n![dbui screenshot](docs/dbui.gif \"DBUI: CLI for MySQL, PostgreSQL, and SQLite databases\")\n\n**dbui** provides features like,\n\n- Connect to multiple data sources and instances.\n- List all schemas in a selected data source.\n- List all tables in a selected schema.\n- Preview a selected table.\n- Execute custom SQL queries on a selected table or schema.\n- User-friendly UI features like,\n    - query execution status,\n    - warning and error messages,\n    - full-screen and focus modes,\n    - mouse support.\n\nRuns on Mac, Linux, and [Windows](https://kenanbek.gitbook.io/dbui/additional/windows).\n\n##### Linux\n\n`dbui` is available as downloadable binaries from the [releases](https://github.com/kenanbek/dbui/releases/latest) page.\nDownload the `.deb` or `.rpm` from the [releases](https://github.com/kenanbek/dbui/releases/latest) page and install\nwith `sudo dpkg -i` and `sudo rpm -i` respectively.\n\n#### Currently supported databases\n\n- MySQL\n- PostgreSQL\n- SQLite\n\n#### What's next?\n\n- Auto-generate SQL Queries for Insert, Update, Delete.\n- Save frequently used SQL Queries.\n- Configurable keyboard layout.\n- Autocomplete for SQL Queries.\n\n#### Current status\n\n- 🚧 Under development, expect bugs, errors, and unexpected crashes.\n- 🐞 Bug and error report very well appreciated.\n- 📣 I highly recommend to check for periodic updates.\n\n##### Known Issues\n\n- ❗️Critically low amount of tests.\n- ⚠️Having multiple connections and many queries triggers a high CPU load. Now\n  when [this PR](https://github.com/KenanBek/dbui/pull/28) merged, as a next step, I will work on profiling the\n  application.\n\n## Demo\n\n### Install\n\n```shell script\nbrew tap kenanbek/dbui https://github.com/kenanbek/dbui\nbrew install dbui\n```\n\nOther [installation options](#install). If you have installed the first versions of `dbui`, you might need to un-tap the\nold cask URL. Check [this][wiki-brew-untap] for more information.\n\n### Demo with in-memory dataset\n\nYou can run `dbui` with a demo data source.\n\n```shell script\ndbui -demo\n```\n\nThis command will open `dbui` with two dummy data sources, and you can navigate through the demo dataset.\n\nTo test it with a real database, you can use the following steps.\n\n### Demo with Docker containers\n\n#### Step 1. Run demo databases\n\n```shell script\ndocker run -d --name dbui-mysql-demo -p 3316:3306 -e MYSQL_ROOT_PASSWORD=demo genschsa/mysql-employees\ndocker run -d --name dbui-postgresql-demo -p 5432:5432 ghusta/postgres-world-db:2.4-alpine\n```\n\n#### Step 2. Create dbui.yml configuration file\n\nCreate `dbui.yml` file in the current folder with the following content:\n\n```shell script\ndataSources:\n  - alias: employees\n    type: mysql\n    dsn: \"root:demo@(localhost:3316)/employees\"\n  - alias: world-db\n    type: postgresql\n    dsn: \"user=world password=world123 host=localhost port=5432 dbname=world-db sslmode=disable\"\n  - alias: chinook\n    type: sqlite\n    dsn: \"internal/sqlite/testdata/chinook.db\"\ndefaut: employees\n```\n\nMore about [configuration files](#configuration).\n\n#### Step 3. Start dbui\n\n```shell script\ndbui\n```\n\n## Table of Contents\n\n- [Usage](#usage)\n    - [Install](#install)\n        - [Brew](#option-1-brew)\n        - [Go Install](#option-2-go-install)\n        - [Source Code](#option-3-source-code-demo-databases)\n    - [Configuration](#configuration)\n        - [Configuration Order](#configuration-order)\n    - [Keyboard Layout](#default-keyboard-layout)\n        - [Focus Hot Keys](#focus-hot-keys)\n        - [Special](#special)\n        - [Tables Specific](#table-specific)\n- [Contribution](#contribution)\n\n## Usage\n\n### Install\n\n#### Option 1: Brew\n\n```shell script\nbrew tap kenanbek/dbui https://github.com/kenanbek/dbui\nbrew install dbui\n```\n\nIf you have installed the first versions of `dbui`, you might need to un-tap the old cask URL.\nCheck [this][wiki-brew-untap] for more information.\n\n#### Option 2: Go Install\n\n```shell script\ngo install github.com/kenanbek/dbui@latest\n```\n\n#### Option 3: Source Code (+demo databases)\n\n```shell script\ngit clone https://github.com/KenanBek/dbui.git\ncd dbui\nmake demodbs # runs docker containers with mysql and postgresql demo dbs\n\n# you can destroy them by executing\nmake demodbs/destroy\n```\n\nCopy configuration and run:\n\n```shell script\ntouch dbui.yml # check below for the content\nmake run\n```\n\nCopy/paste the configuration provided below for demo databases.\n\n### Configuration\n\nBy default `dbui` uses configuration file (`dbui.yml`).\n\n```yaml\ndataSources:\n  - alias: employees\n    type: mysql\n    dsn: \"root:demo@(localhost:3316)/employees\"\n  - alias: world-db\n    type: postgresql\n    dsn: \"user=world password=world123 host=localhost port=5432 dbname=world-db sslmode=disable\"\ndefaut: employees\n```\n\nFirst, it checks in the current directory, then in the user's home directory.\n\nAll provided database connections will be available in the application, and you can switch among them without restarting\nthe application.\n\nAlternatively, it is possible to start `dbui` for a single database connection using a DSN (data source name) and type\narguments.\n\n```shell\n$ dbui -dsn \u003cconnection string\u003e -type \u003cdata source type\u003e\n\n# example for a mysql connection\n$ dbui -dsn \"codekn:codekn@(localhost:3306)/codekn_omni\" -type mysql\n```\n\n#### Configuration Order\n\n```shell\n# when\n$ dbui\n# read from `./dbui.yml` if not then from `~/dbui.yml`\n\n# when\n$ dbui -f /my/custom/dir/mydbui.yml\n# read from custom directory `/my/custom/dir/mydbui.yml`\n\n# when\n$ dbui -dsn \"\u003cconnection-string\u003e\" -type mysql\n# init single connection mode\n```\n\n### Default Keyboard Layout\n\n![dbui keyboard hot keys](docs/keyboard-layout.png \"DBUI Keyboard Hot Keys\")\n\n#### Focus Hot Keys\n\n- `Ctrl-A` - sources\n- `Ctrl-S` - schemas\n- `Ctrl-D` - tables\n- `Ctrl-E` - preview\n- `Ctrl-Q` - query\n\n#### Special\n\n- `Tab` - navigate to the next element\n- `Shift-Tab` - navigate to the prev element\n- `Ctrl-F` - toggle focus-mode\n- `Ctrl-C` - exit\n\n#### Table Specific\n\nUse these keys when the tables panel is active:\n\n- `e` - describe selected table\n- `p` - preview selected table (works as ENTER but does not change focus)\n\n#### Preview Specific\n\nUse these keys when the data preview panel is active:\n\n- `y` - copy a selected row into the clipboard (coming soon).\n\n## Contribution\n\nThe code and its sub-packages include various form of documentation: code comments or README files. Make sure to get\nfamiliar with them to know more about internal code structure. This section includes references to additional READMEs.\n\n- [About `Controller` package - an abstraction over multiple data sources](internal/controller/README.md)\n\nDBUI is a work in progress, and any feedback/contributions are more than welcome.\n\nThe backlog can be viewed on [GitHub Issues](https://github.com/kenanbek/dbui/issues) page.\n\n## References\n\nThis project inspired by [k9s](https://github.com/derailed/k9s)\n, [lazydocker](https://github.com/jesseduffield/lazydocker), and [htop](https://github.com/htop-dev/htop).\n\nI use `tview` terminal UI for the interactive user interface:\n\n- [tview](https://github.com/rivo/tview)\n\nFor test purposes, I use these Docker-based demo databases:\n\n- [genschsa/mysql-employees](https://hub.docker.com/r/genschsa/mysql-employees)\n- [ghusta/docker-postgres-world-db](https://github.com/ghusta/docker-postgres-world-db)\n\n[wiki-brew-untap]: https://github.com/KenanBek/dbui/wiki/Brew-Untap\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKenanBek%2Fdbui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKenanBek%2Fdbui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKenanBek%2Fdbui/lists"}