Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Docs Maintenance Guide
Use this file as the handoff checklist for future edits to this documentation PR.
## Source Layout
- The docs source lives in `apps/docs`.
- `docs.json` is the Docs Cloud configuration for publishing, previews, and content roots.
- Keep every page grounded in README content, package metadata, source exports, CLI help, environment examples, or existing docs.
## Docs Routes
- /docs - Introduction
- /docs/installation - Installation
- /docs/quickstart - Quickstart
- /docs/configuration - Configuration
- /docs/databases - Databases
- /docs/features - Features
## Editing Guidelines
- Prefer reader-facing setup, usage, and troubleshooting notes over source inventories.
- Do not add commands, flags, environment variables, routes, imports, or framework names unless they are present in the repository.
- If you add or rename a page, keep its frontmatter title and description accurate and make sure the navigation ordering still includes it.
- Avoid analyzer language such as generated from, source evidence, implementation map, source surface, or detected in files.
## Verification
- Build the docs site with `cd apps/docs && node ./scripts/docs-cloud-vercel.mjs install && node ./scripts/docs-cloud-vercel.mjs build` before handing off a docs PR.
- Open `/docs` and at least one generated leaf page to confirm the sidebar and page content match the PR.
14 changes: 14 additions & 0 deletions apps/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules
.env*
!.env.example
.next
.nuxt
.output
.svelte-kit
.astro
dist
build
.vercel
app/api/docs
app/docs/layout.tsx
mdx-components.tsx
70 changes: 70 additions & 0 deletions apps/docs/app/docs/configuration/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: "Configuration"
description: "Global CLI options, environment variables, and deployment configuration."
order: 0
---

# Configuration

All global options are placed **before** the database subcommand. Every option also has a matching environment variable so you can configure SQL Studio in containerised or automated environments without modifying your start command.

```bash
sql-studio [OPTIONS] <SUBCOMMAND> [ARGS...]
```

## Global CLI options

| Option | Short | Description | Default | Env var |
|--------|-------|-------------|---------|---------|
| `--address` | `-a` | Address and port to bind to | `127.0.0.1:3030` | `ADDRESS` |
| `--timeout` | `-t` | Timeout for queries from the query page | `5secs` | `TIMEOUT` |
| `--base-path` | `-b` | Base URL path for the UI (e.g. `/sql-studio`) | _(none)_ | `BASE_PATH` |
| `--no-browser` | | Don't open the URL in the system browser | `false` | `NO_BROWSER` |
| `--no-shutdown` | | Don't show the shutdown button in the UI | `false` | `NO_SHUTDOWN` |

## Timeout format

The `--timeout` option accepts human-readable durations. For example: `5secs`, `30secs`, `1min`, `2min 30secs`. The timeout applies to queries executed from the Query page — it does not affect table browsing or schema loading.

## Base path

Use `--base-path` when you're serving SQL Studio behind a reverse proxy at a subpath. For example, `--base-path /sql-studio` makes the UI available at `http://your-host/sql-studio` instead of the root.

## Logging

SQL Studio reads the `RUST_LOG` environment variable for log verbosity. Set it before running the binary:

```bash
RUST_LOG=debug sql-studio sqlite ./my-database.db
```

Useful values are `error`, `warn`, `info`, and `debug`.

## Examples

Bind to a custom port and suppress the browser auto-open:

```bash
sql-studio --address 0.0.0.0:8080 --no-browser sqlite ./my-database.db
```

Set a longer query timeout for heavy analytical queries:

```bash
sql-studio --timeout 2min postgres postgres://localhost:5432/analytics
```

Run behind a reverse proxy at `/studio`:

```bash
sql-studio --base-path /studio --no-browser --no-shutdown postgres postgres://localhost:5432/mydb
```

You can equally export the environment variables instead of passing flags:

```bash
ADDRESS=0.0.0.0:8080
NO_BROWSER=true
NO_SHUTDOWN=true
TIMEOUT=2min
```
123 changes: 123 additions & 0 deletions apps/docs/app/docs/databases/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: "Databases"
description: "Overview of all databases supported by SQL Studio."
order: 1
---

# Databases

SQL Studio supports ten database backends and file formats. Each backend has its own subcommand with specific positional arguments. Global options like `--address` and `--timeout` are placed before the subcommand — see [Configuration](/docs/configuration) for details.

## General syntax

```bash
sql-studio [OPTIONS] <SUBCOMMAND> [ARGS...]
```

## Supported databases

| Database | Subcommand | Type |
|----------|------------|------|
| SQLite | `sqlite` | Local file |
| libSQL | `libsql` | Remote server |
| Local libSQL | `local-libsql` | Local file (libSQL driver) |
| PostgreSQL | `postgres` | Remote server |
| MySQL / MariaDB | `mysql` | Remote server |
| DuckDB | `duckdb` | Local file |
| Parquet | `parquet` | Local file |
| CSV | `csv` | Local file |
| ClickHouse | `clickhouse` | Remote server |
| Microsoft SQL Server | `mssql` | Remote server |

## SQLite

Open a local SQLite database file. Use the special `preview` path to launch with a built-in sample database when you don't have a file handy.

```bash
sql-studio sqlite ./my-database.db
sql-studio sqlite preview
```

## libSQL

Connect to a remote libSQL (Turso) server. Pass the server URL and your auth token.

```bash
sql-studio libsql https://your-db.turso.io your-auth-token
```

## Local libSQL

Open a local SQLite file using the libSQL driver. Useful when you need libSQL-specific features on a local file.

```bash
sql-studio local-libsql ./my-database.db
```

## PostgreSQL

Connect to any PostgreSQL-compatible server. Use `--schema` to target a schema other than `public`.

```bash
sql-studio postgres postgres://user:password@localhost:5432/mydb
sql-studio --schema myschema postgres postgres://user:password@localhost:5432/mydb
```

The `--schema` option defaults to `public` and can also be set via the `SCHEMA` environment variable.

## MySQL / MariaDB

Connect using a standard MySQL connection URL. SQL Studio uses rustls for TLS, so encrypted connections work out of the box.

```bash
sql-studio mysql mysql://user:password@localhost:3306/mydb
```

## DuckDB

Open a local DuckDB analytical database file.

> **Note:** DuckDB support is not available in the musl (static Linux) build. Use the glibc Linux build, macOS, or Windows instead.

```bash
sql-studio duckdb ./analytics.duckdb
```

## Parquet

Open a local Apache Parquet file. SQL Studio uses DuckDB under the hood, giving you full SQL access to columnar data.

> **Note:** Parquet support requires the glibc Linux build, macOS, or Windows — not the musl build.

```bash
sql-studio parquet ./data.parquet
```

## CSV

Open a local CSV file. SQL Studio uses DuckDB to query it, so you get full SQL access to tabular data.

> **Note:** CSV support requires the glibc Linux build, macOS, or Windows — not the musl build.

```bash
sql-studio csv ./data.csv
```

## ClickHouse

Connect to a ClickHouse analytics server. All arguments have sensible defaults, so connecting to a local instance requires no extra arguments.

> **Note:** ClickHouse support is currently partial.

```bash
sql-studio clickhouse http://localhost:8123 default "" default
sql-studio clickhouse # uses all defaults
```

## Microsoft SQL Server

Connect using an ADO.NET connection string. SQL Studio uses the Tiberius driver with rustls for TLS. For local development with self-signed certificates, add `TrustServerCertificate=true` to your connection string.

```bash
sql-studio mssql "Server=localhost;Database=mydb;User Id=sa;Password=secret;"
```
25 changes: 25 additions & 0 deletions apps/docs/app/docs/features/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "Features"
description: "Explore the SQL Studio user interface."
order: 2
---

# Features

SQL Studio provides four main UI pages accessible from the sidebar. Each page is available for every supported database backend with no additional configuration.

## Overview dashboard

The Overview page is the landing page when you open SQL Studio. It shows database metadata cards at the top — file name or connection URL, database version, total size, and creation/modification timestamps when available. Below that, summary cards display the total count of tables, indexes, triggers, and views. Bar charts give you a visual breakdown of row counts, column counts, and index counts across all tables.

## Table Explorer

The Table Explorer lists every table in your database with its row count. Selecting a table shows metadata cards (row count, column count, index count, table size), the full `CREATE TABLE` SQL that defines the schema, and a data grid below. The data grid uses infinite scroll, so you can page through millions of rows without loading them all at once.

## Query Editor

The Query Editor gives you a full Monaco editor — the same engine that powers VS Code — connected directly to your database. You get SQL syntax highlighting, auto-complete suggestions for table names and column names drawn from your live schema, and multi-line editing. Write your query and click Run (or use the keyboard shortcut) to execute it. Results appear in a table below the editor. The query timeout is configurable via `--timeout` — see [Configuration](/docs/configuration).

## ERD Viewer

The ERD Viewer renders an interactive entity-relationship diagram of your entire schema. Tables appear as draggable nodes listing each column with its data type, nullability, and primary key indicator. Foreign key relationships are drawn as edges between tables. The diagram is built with React Flow, so you can pan, zoom, and rearrange nodes freely. An auto-layout button resets the arrangement if things get cluttered.
76 changes: 76 additions & 0 deletions apps/docs/app/docs/installation/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: "Installation"
description: "Install and configure SQL Studio."
order: 10
---

# Installation

SQL Studio ships as a single self-contained binary. Pick the method that fits your environment — no runtime dependencies are required once the binary is in place.

## Shell script (macOS and Linux)

The fastest way to install on macOS or Linux is the official installer script:

```bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/frectonz/sql-studio/releases/download/0.1.51/sql-studio-installer.sh | sh
```

This downloads the latest prebuilt binary and puts it on your `PATH`.

## PowerShell (Windows)

On Windows, run the installer from a PowerShell prompt. The installer script is linked from the [releases page](https://github.com/frectonz/sql-studio/releases).

## Nix

SQL Studio is available in Nixpkgs. If you use Nix, install it through your normal Nix workflow.

## Docker

A Docker image is published on Docker Hub as `frectonz/sql-studio`. The example below starts SQL Studio connected to a PostgreSQL database and exposes the UI on port `3030`:

```bash
docker run -p 3030:3030 frectonz/sql-studio /bin/sql-studio \
--no-browser \
--no-shutdown \
--address=0.0.0.0:3030 \
postgres \
postgres://localhost:5432/
```

When running in Docker you almost always want these three flags:

- `--no-browser` — there is no desktop browser inside the container
- `--no-shutdown` — keeps the server running so it isn't stopped from the UI
- `--address=0.0.0.0:3030` — binds to all interfaces so the host can reach the container port

## Building from source

You need Rust and Node.js installed. The frontend is statically embedded in the binary at build time, so you must build the UI before running `cargo build`:

```bash
git clone git@github.com:frectonz/sql-studio.git
cd sql-studio
cd ui
npm install
npm run build
cd ..
cargo build --release
```

The compiled binary lands at `target/release/sql-studio`.

## Updating

If you installed via the shell script or PowerShell installer, re-run the same install command to pull the latest release. Docker users can `docker pull frectonz/sql-studio` to get the newest image.

## Verifying the install

Run the built-in preview mode to confirm everything works:

```bash
sql-studio sqlite preview
```

SQL Studio will start and open `http://127.0.0.1:3030` in your browser using a sample database. If the page loads, your install is working correctly.
30 changes: 30 additions & 0 deletions apps/docs/app/docs/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "Introduction"
description: "Single binary, single command SQL database explorer. Connect to SQLite, PostgreSQL, MySQL, DuckDB, ClickHouse, MSSQL, Parquet, CSV, and more — no config files required."
order: 0
---

# Introduction

SQL Studio is a single-binary, single-command web-based database explorer. Point it at any supported database and you instantly get a rich browser UI for browsing schemas, exploring tables, running queries, and visualising relationships — no config files, no installation wizards, no background services.

The binary embeds the entire frontend. One command starts the server and opens your browser. When you're done, hit the shutdown button or `Ctrl+C`. Nothing lingers.

## Supported databases

SQL Studio speaks ten database dialects out of the box:

- **SQLite** — local `.db` / `.sqlite` files via the `sqlite` subcommand
- **libSQL** — remote Turso servers via the `libsql` subcommand
- **Local libSQL** — local SQLite files via the libSQL driver with `local-libsql`
- **PostgreSQL** — any PostgreSQL-compatible server via the `postgres` subcommand
- **MySQL / MariaDB** — MySQL and MariaDB servers via the `mysql` subcommand
- **DuckDB** — local `.duckdb` analytical files via the `duckdb` subcommand
- **Parquet** — local Apache Parquet files via the `parquet` subcommand
- **CSV** — local CSV files via the `csv` subcommand
- **ClickHouse** — ClickHouse analytics servers via the `clickhouse` subcommand (partial support)
- **Microsoft SQL Server** — MSSQL via ADO.NET connection strings with the `mssql` subcommand

## Where to go next

If you haven't installed SQL Studio yet, head to [Installation](/docs/installation) for every available install method including shell script, Nix, Docker, and building from source. Then follow [Quickstart](/docs/quickstart) to launch the UI for the first time in under a minute. Once you're running, [Configuration](/docs/configuration) covers every CLI flag and its matching environment variable, and [Databases](/docs/databases) has the full connection reference for each supported backend.
Loading
Loading