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
83 changes: 83 additions & 0 deletions apps/docs/app/docs/configuration/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: "Configuration"
description: "Global CLI options, environment variables, and deployment configuration."
order: 0
---

# Configuration

All global options must be placed **before** the database subcommand. The general command shape is:

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

Every option also has a corresponding environment variable, so you can configure SQL Studio without repeating flags in scripts or containers.

## Global 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. Any of the following are valid:

```bash
sql-studio --timeout 30secs sqlite ./app.db
sql-studio --timeout 1min sqlite ./app.db
sql-studio --timeout "2min 30secs" sqlite ./app.db
```

## Binding to All Interfaces

By default, SQL Studio binds to `127.0.0.1:3030` — localhost only. To expose it on the network (for example, inside a container or VM), bind to `0.0.0.0`:

```bash
sql-studio --address 0.0.0.0:3030 sqlite ./app.db
```

## Base Path

If you're serving SQL Studio behind a reverse proxy at a sub-path, use `--base-path` to set the URL prefix so assets and navigation links resolve correctly:

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

## Environment Variables

You can set any option via environment variable instead of a flag. This is useful in Docker Compose or CI environments:

```bash
ADDRESS=0.0.0.0:8080
TIMEOUT=30secs
NO_BROWSER=true
NO_SHUTDOWN=true
BASE_PATH=/sql-studio
```

For verbose server logging, set `RUST_LOG`:

```bash
RUST_LOG=debug
```

## Deployment Example

A typical production-style invocation with all flags explicit:

```bash
sql-studio \
--address 0.0.0.0:3030 \
--timeout 30secs \
--no-browser \
--no-shutdown \
postgres \
postgres://user:password@db-host:5432/mydb
```
34 changes: 34 additions & 0 deletions apps/docs/app/docs/databases/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "Databases"
description: "Overview of all databases supported by SQL Studio."
order: 1
---

# Databases

SQL Studio supports a wide range of SQL databases and file formats. Each backend has its own subcommand with specific arguments. Global options like `--address` and `--timeout` always go before the subcommand.

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

See [Configuration](/docs/configuration) for all available global options.

## 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 |

> **Note:** DuckDB, Parquet, and CSV support depend on the DuckDB library and are not available in the musl (static Linux) build. Use the glibc Linux build, macOS, or Windows for those subcommands.

Click any database in the table above for its connection arguments, URL format, and examples.
17 changes: 17 additions & 0 deletions apps/docs/app/docs/features/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "Features"
description: "Explore the SQL Studio user interface."
order: 12
---

# Features

SQL Studio provides four main UI pages, all accessible from the left sidebar once the server is running.

**Overview Dashboard** shows database metadata and statistics — the file path or connection URL, server version, database size, and a summary of tables, indexes, triggers, and views. Bar charts break down row counts, column counts, and index counts per table at a glance.

**Table Explorer** lists every table with its row count. Select a table to see its column definitions, constraints, creation SQL, and a paginated data grid with infinite scroll.

**Query Editor** gives you a Monaco-powered SQL editor — the same editor that powers VS Code — with syntax highlighting and IntelliSense autocomplete sourced from your live database schema. Write a query and run it with a button click or keyboard shortcut.

**ERD Viewer** renders an interactive entity-relationship diagram with tables as nodes and foreign-key relationships as edges. You can pan, zoom, and drag nodes to arrange the diagram however makes sense for your schema.
78 changes: 78 additions & 0 deletions apps/docs/app/docs/installation/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: "Installation"
description: "Install and configure SQL Studio."
order: 10
---

# Installation

SQL Studio ships as a prebuilt binary for macOS, Linux, and Windows. Pick the method that fits your environment.

## Shell Script (macOS and Linux)

The fastest way to install the latest release:

```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 binary and places it on your `PATH`. Verify the install:

```bash
sql-studio --help
```

## PowerShell (Windows)

Run the following in a PowerShell terminal:

```bash
irm https://github.com/frectonz/sql-studio/releases/download/0.1.51/sql-studio-installer.ps1 | iex
```

## Nix

SQL Studio is available in Nixpkgs:

```bash
nix-env -iA nixpkgs.sql-studio
```

Or in a flake-based setup, add it to your `devShells` or `environment.systemPackages`.

## Docker

A Docker image is published on Docker Hub at `frectonz/sql-studio`. The following example runs SQL Studio against a PostgreSQL server 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, always pass `--no-browser` (no desktop browser inside a container), `--no-shutdown` (keep the server alive), and `--address=0.0.0.0:3030` (bind to all interfaces so the host can reach the port).

## Build from Source

You'll need Rust and Node.js installed. The Rust binary statically embeds the compiled frontend, so you must build the UI first:

```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 is at `target/release/sql-studio`.

> **Note:** DuckDB support (used by the `duckdb`, `parquet`, and `csv` subcommands) is not available in the musl (static Linux) build. Use the glibc Linux build, macOS, or Windows for those backends.

## Updating

If you installed via the shell script or PowerShell installer, re-run the same install command to update to the latest release.
19 changes: 19 additions & 0 deletions apps/docs/app/docs/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Introduction"
description: "Single binary, single command SQL database explorer supporting SQLite, PostgreSQL, MySQL, DuckDB, ClickHouse, MSSQL, Parquet, CSV, and more."
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 UI for browsing schemas, table data, and running ad-hoc SQL — no configuration files, no installation wizards, no background daemons to manage.

The entire tool ships as one self-contained Rust binary that statically embeds the frontend. You run one command, a browser tab opens, and you're exploring your data. When you're done, click the shutdown button or press `Ctrl-C`.

SQL Studio supports SQLite, libSQL (Turso), PostgreSQL, MySQL / MariaDB, DuckDB, ClickHouse, Microsoft SQL Server, Parquet, and CSV files. Each backend has its own subcommand with sensible defaults, so connecting to a local file is as simple as:

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

If you're ready to install, head to [Installation](/docs/installation). To see it running in under a minute, go to [Quickstart](/docs/quickstart). Once you're up and running, [Configuration](/docs/configuration) covers the server options, and [Databases](/docs/databases) documents every supported backend.
54 changes: 54 additions & 0 deletions apps/docs/app/docs/quickstart/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: "Quickstart"
description: "Run SQL Studio for the first time."
order: 20
---

# Quickstart

This page gets you from a fresh install to a running SQL Studio UI in under a minute. You'll use the built-in sample database so there's nothing to set up.

## Try the Sample Database

SQL Studio ships with a built-in preview database. Run this single command after installing:

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

SQL Studio starts the server on `http://127.0.0.1:3030` and opens that URL in your browser automatically. You'll land on the Overview dashboard showing metadata, table counts, and row-count charts for the sample data.

## Use Your Own SQLite File

Point SQL Studio at any `.db` or `.sqlite` file on disk:

```bash
sql-studio sqlite ./my-app.db
```

## Connect to a Remote Database

For a PostgreSQL server, pass the connection URL:

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

MySQL and MariaDB work the same way:

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

## What You'll See

Once the UI opens you have four pages available from the sidebar:

- **Overview** — database metadata, version, size, and bar charts of per-table statistics.
- **Tables** — browse every table, its schema, row count, and paginated data with infinite scroll.
- **Query** — a Monaco-powered SQL editor with IntelliSense autocomplete drawn from your live schema.
- **Schema** — an interactive ERD diagram showing tables, columns, and foreign-key relationships.

## Next Steps

See [Databases](/docs/databases) for the full list of supported backends and their connection arguments. If you need to change the bind address, set a query timeout, or run behind a reverse proxy, check [Configuration](/docs/configuration).
2 changes: 2 additions & 0 deletions apps/docs/app/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "tailwindcss";
@import "@farming-labs/theme/colorful/css";
33 changes: 33 additions & 0 deletions apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { RootProvider } from "@farming-labs/theme";
import docsConfig from "../docs.config";
import "./global.css";

const geistSans = Geist({
variable: "--fd-font-sans",
subsets: ["latin"],
});

const geistMono = Geist_Mono({
variable: "--fd-font-mono",
subsets: ["latin"],
});

export const metadata: Metadata = {
title: {
default: "Docs",
template: docsConfig.metadata?.titleTemplate ?? "%s",
},
description: docsConfig.metadata?.description,
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body className={`${geistSans.variable} ${geistMono.variable} font-sans antialiased`}>
<RootProvider>{children}</RootProvider>
</body>
</html>
);
}
14 changes: 14 additions & 0 deletions apps/docs/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Link from "next/link";

const title = "SQL Studio";
const description = "Single binary, single command SQL database explorer supporting SQLite, PostgreSQL, MySQL, DuckDB, ClickHouse, MSSQL, Parquet, CSV, and more.";

export default function HomePage() {
return (
<main style={{ padding: 32 }}>
<h1>{title}</h1>
<p>{description}</p>
<Link href="/docs">Open docs</Link>
</main>
);
}
Loading
Loading