# Welcome to **dblab**

![dblab](https://raw.githubusercontent.com/danvergara/dblab/main/assets/gopher-dblab.png){ width="300" : .center }

Cross-platform, zero dependencies, terminal-based UI application for your databases.  

![integration tests](https://github.com/danvergara/dblab/actions/workflows/ci.yaml/badge.svg)  ![unit tests](https://github.com/danvergara/dblab/actions/workflows/test.yaml/badge.svg)  [![Release](https://img.shields.io/github/release/danvergara/dblab.svg?label=Release)](https://github.com/danvergara/dblab/releases)

---

**Documentation**: <a href="https://dblab.app" target="_blank">https://dblab.app</a>

**Source Code**: <a href="https://github.com/danvergara/dblab" target="_blank">https://github.com/danvergara/dblab</a>

---

## Overview

dblab is a fast and lightweight interactive terminal-based UI application for PostgreSQL, MySQL, and SQLite3,
written in Go and works on macOS, Linux, and Windows machines. The main idea behind using Go for backend development
is to utilize the ability of the compiler to produce zero-dependency binaries for
multiple platforms. dblab was created as an attempt to build a very simple and portable
application to work with local or remote PostgreSQL/MySQL/SQLite3/Oracle/SQL Server databases.
  

## Features

  * Cross-platform support for macOS/Linux/Windows (32/64-bit)  
  * Simple installation (distributed as a single binary)  
  * Zero dependencies.  
  * Vim-style query editor (normal and insert modes, line-oriented editing commands).  
  * Multi-query execution: write multiple SQL statements separated by `;` and run them concurrently with results in separate tabs.  
  * Single-query execution: execute only the query on the current cursor line with `ctrl+r`, without running other statements in the editor.  
  * Connection profiles with secure credential storage in the OS keyring.  
  * Query history: executed queries are automatically saved and can be browsed or re-used from a searchable list.  
  * Read-only mode: use `--readonly` to prevent accidental writes by forcing the database session into read-only mode (PostgreSQL, MySQL, SQLite, Oracle, and SQL Server).  
  * Built-in help modal: press `?` to display a help overlay showing all available key bindings; press `Esc` to dismiss it.  

## Installation

A single binary handles every supported client — CGO is not required, including for SQLite3.

### Homebrew installation

It works with Linux, too.

```{ .sh .copy }
brew install --cask danvergara/tools/dblab
```

Or

```{ .sh .copy }
brew tap danvergara/tools
brew install --cask dblab
```

### Manual Binary Installation
The binaries are compatible with Linux, macOS, and Windows.  
You can manually download and install the binary release from [the release page](https://github.com/danvergara/dblab/releases).

### Automated installation/update
> Don't forget to always verify what you're piping into bash

Install the binary using our bash script:

```{ .sh .copy }
curl https://raw.githubusercontent.com/danvergara/dblab/master/scripts/install_update_linux.sh | bash
```

