Skip to content

Commit f583c3d

Browse files
committed
chore: add docs
1 parent 444d308 commit f583c3d

47 files changed

Lines changed: 6120 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.next
3+
out
4+
next-env.d.ts
5+
public/og
6+
.DS_Store

docs/app/api/docs/route.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Auto-generated by @farming-labs/next — do not edit manually.
2+
3+
import { createDocsAPI } from "@farming-labs/theme/api";
4+
5+
export const { GET, POST } = createDocsAPI();
6+
7+
export const revalidate = false;

docs/app/copy-button.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use client";
2+
3+
import { useState } from "react";
4+
5+
export function CopyButton({ text }: { text: string }) {
6+
const [copied, setCopied] = useState(false);
7+
8+
return (
9+
<button
10+
onClick={() => {
11+
navigator.clipboard.writeText(text);
12+
setCopied(true);
13+
setTimeout(() => setCopied(false), 2000);
14+
}}
15+
className="text-xs tracking-widest transition-colors duration-100"
16+
style={{ color: copied ? "var(--ss-primary)" : "var(--ss-muted-dim)" }}
17+
>
18+
{copied ? "COPIED" : "COPY"}
19+
</button>
20+
);
21+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: "Configuration"
3+
description: "Global CLI options, environment variables, and deployment configuration."
4+
icon: "settings"
5+
---
6+
7+
# Configuration
8+
9+
## Global CLI Options
10+
11+
These options apply to all database subcommands and must be placed **before** the subcommand.
12+
13+
```bash
14+
sql-studio [OPTIONS] <SUBCOMMAND> [ARGS...]
15+
```
16+
17+
| Option | Short | Description | Default | Env Var |
18+
|--------|-------|-------------|---------|---------|
19+
| `--address` | `-a` | Address and port to bind to | `127.0.0.1:3030` | `ADDRESS` |
20+
| `--timeout` | `-t` | Timeout for queries from the query page | `5secs` | `TIMEOUT` |
21+
| `--base-path` | `-b` | Base URL path for the UI (e.g. `/sql-studio`) | _(none)_ | `BASE_PATH` |
22+
| `--no-browser` | | Don't open the URL in the system browser | `false` | `NO_BROWSER` |
23+
| `--no-shutdown` | | Don't show the shutdown button in the UI | `false` | `NO_SHUTDOWN` |
24+
25+
### Timeout Format
26+
27+
The `--timeout` option accepts human-readable durations: `5secs`, `30secs`, `1min`, `2min 30secs`, etc.
28+
29+
### Examples
30+
31+
```bash
32+
# Custom address and longer timeout
33+
sql-studio --address 0.0.0.0:8080 --timeout 30secs sqlite ./my.db
34+
35+
# Serve under a base path
36+
sql-studio --base-path /sql-studio sqlite ./my.db
37+
```
38+
39+
## Environment Variables
40+
41+
Every CLI option can be set via an environment variable. This is particularly useful for Docker deployments or CI environments.
42+
43+
```bash
44+
export ADDRESS="0.0.0.0:3030"
45+
export TIMEOUT="30secs"
46+
export BASE_PATH="/sql-studio"
47+
export NO_BROWSER="true"
48+
export NO_SHUTDOWN="true"
49+
50+
sql-studio sqlite ./my.db
51+
```
52+
53+
## Logging
54+
55+
SQL Studio uses the `tracing` crate with `env-filter` support. Control log verbosity with the `RUST_LOG` environment variable:
56+
57+
```bash
58+
# Show info-level logs
59+
RUST_LOG=info sql-studio sqlite ./my.db
60+
61+
# Show debug-level logs
62+
RUST_LOG=debug sql-studio sqlite ./my.db
63+
64+
# Show only SQL Studio logs
65+
RUST_LOG=sql_studio=debug sql-studio sqlite ./my.db
66+
```
67+
68+
## Deployment
69+
70+
### Reverse Proxy
71+
72+
When deploying behind a reverse proxy (e.g. Nginx, Caddy, Traefik), use the `--base-path` option so all UI routes are served under a prefix:
73+
74+
```bash
75+
sql-studio --base-path /sql-studio --no-browser --no-shutdown sqlite ./my.db
76+
```
77+
78+
Then configure your reverse proxy to forward `/sql-studio/*` to `http://127.0.0.1:3030/sql-studio/`.
79+
80+
### Docker
81+
82+
```bash
83+
docker run -p 3030:3030 frectonz/sql-studio /bin/sql-studio \
84+
--no-browser \
85+
--no-shutdown \
86+
--address=0.0.0.0:3030 \
87+
postgres \
88+
postgresql://user:pass@host/mydb
89+
```
90+
91+
For file-based databases (SQLite, DuckDB, Parquet, CSV), mount a volume:
92+
93+
```bash
94+
docker run -p 3030:3030 \
95+
-v /path/to/data:/data \
96+
frectonz/sql-studio /bin/sql-studio \
97+
--no-browser \
98+
--no-shutdown \
99+
--address=0.0.0.0:3030 \
100+
sqlite /data/my-database.db
101+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "ClickHouse"
3+
description: "Connect SQL Studio to a ClickHouse server."
4+
icon: "server"
5+
---
6+
7+
# ClickHouse
8+
9+
Connect to a ClickHouse analytics database. ClickHouse support is currently partial.
10+
11+
## Usage
12+
13+
```bash
14+
sql-studio clickhouse [URL] [USER] [PASSWORD] [DATABASE]
15+
```
16+
17+
## Arguments
18+
19+
| Argument | Description | Default | Env Var |
20+
|----------|-------------|---------|---------|
21+
| `URL` | ClickHouse server address | `http://localhost:8123` | `URL` |
22+
| `USER` | Username | `default` | `USER` |
23+
| `PASSWORD` | Password | _(empty)_ | `PASSWORD` |
24+
| `DATABASE` | Database name | `default` | `DATABASE` |
25+
26+
## Notes
27+
28+
- All arguments have sensible defaults, so you can connect to a local ClickHouse instance with just `sql-studio clickhouse`.
29+
- SQL Studio uses `rustls` for TLS connections.
30+
31+
## Examples
32+
33+
```bash
34+
# Connect to a local ClickHouse with defaults
35+
sql-studio clickhouse
36+
37+
# Connect to a remote ClickHouse
38+
sql-studio clickhouse https://ch.example.com:8443 admin secret mydb
39+
40+
# Using environment variables
41+
export URL="https://ch.example.com:8443"
42+
export USER="admin"
43+
export PASSWORD="secret"
44+
export DATABASE="mydb"
45+
sql-studio clickhouse
46+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "CSV"
3+
description: "Open a local CSV file in SQL Studio."
4+
icon: "spreadsheet"
5+
---
6+
7+
# CSV
8+
9+
Open a local CSV file. SQL Studio uses DuckDB under the hood to query CSV files, giving you full SQL access to tabular data.
10+
11+
## Usage
12+
13+
```bash
14+
sql-studio csv <FILE>
15+
```
16+
17+
## Arguments
18+
19+
| Argument | Description | Env Var |
20+
|----------|-------------|---------|
21+
| `FILE` | Path to the CSV file | `FILE` |
22+
23+
## Examples
24+
25+
```bash
26+
sql-studio csv ./data.csv
27+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "DuckDB"
3+
description: "Open a local DuckDB database file in SQL Studio."
4+
icon: "harddrive"
5+
---
6+
7+
# DuckDB
8+
9+
Open a local DuckDB database file. DuckDB is an in-process analytical database, ideal for working with large datasets.
10+
11+
## Usage
12+
13+
```bash
14+
sql-studio duckdb <DATABASE>
15+
```
16+
17+
## Arguments
18+
19+
| Argument | Description | Env Var |
20+
|----------|-------------|---------|
21+
| `DATABASE` | Path to the DuckDB database file | `DATABASE` |
22+
23+
## Examples
24+
25+
```bash
26+
# Open a DuckDB file
27+
sql-studio duckdb ./analytics.duckdb
28+
29+
# Open with a custom timeout for large queries
30+
sql-studio --timeout 30secs duckdb ./analytics.duckdb
31+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: "libSQL"
3+
description: "Connect SQL Studio to a remote libSQL (Turso) server."
4+
icon: "server"
5+
---
6+
7+
# libSQL
8+
9+
Connect to a remote SQLite database via the libSQL protocol (used by [Turso](https://turso.tech)).
10+
11+
## Usage
12+
13+
```bash
14+
sql-studio libsql <URL> <AUTH_TOKEN>
15+
```
16+
17+
## Arguments
18+
19+
| Argument | Description | Env Var |
20+
|----------|-------------|---------|
21+
| `URL` | libSQL server address | `URL` |
22+
| `AUTH_TOKEN` | Authentication token | `AUTH_TOKEN` |
23+
24+
## Examples
25+
26+
```bash
27+
# Connect to a Turso database
28+
sql-studio libsql libsql://my-db-myorg.turso.io my-auth-token
29+
30+
# Using environment variables
31+
export URL="libsql://my-db-myorg.turso.io"
32+
export AUTH_TOKEN="my-auth-token"
33+
sql-studio libsql "$URL" "$AUTH_TOKEN"
34+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "Local libSQL"
3+
description: "Open a local SQLite database using the libSQL driver."
4+
icon: "harddrive"
5+
---
6+
7+
# Local libSQL
8+
9+
Open a local SQLite database file using the libSQL driver instead of the standard SQLite driver. This can be useful if you need libSQL-specific features.
10+
11+
## Usage
12+
13+
```bash
14+
sql-studio local-libsql <DATABASE>
15+
```
16+
17+
## Arguments
18+
19+
| Argument | Description | Env Var |
20+
|----------|-------------|---------|
21+
| `DATABASE` | Path to the SQLite database file | `DATABASE` |
22+
23+
## Examples
24+
25+
```bash
26+
sql-studio local-libsql ./my-database.db
27+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "Microsoft SQL Server"
3+
description: "Connect SQL Studio to a Microsoft SQL Server database."
4+
icon: "server"
5+
---
6+
7+
# Microsoft SQL Server
8+
9+
Connect to a Microsoft SQL Server (MSSQL) database using an ADO.NET connection string.
10+
11+
## Usage
12+
13+
```bash
14+
sql-studio mssql <CONNECTION>
15+
```
16+
17+
## Arguments
18+
19+
| Argument | Description |
20+
|----------|-------------|
21+
| `CONNECTION` | ADO.NET connection string |
22+
23+
## Connection String Format
24+
25+
```
26+
Server=tcp:localhost,1433;Database=mydb;User Id=sa;Password=YourPassword;TrustServerCertificate=true
27+
```
28+
29+
## Notes
30+
31+
- SQL Studio uses the Tiberius driver with `rustls` for TLS.
32+
- Set `TrustServerCertificate=true` for local development with self-signed certificates.
33+
34+
## Examples
35+
36+
```bash
37+
# Connect to a local MSSQL instance
38+
sql-studio mssql "Server=tcp:localhost,1433;Database=sample;User Id=sa;Password=YourStrong@Passw0rd;TrustServerCertificate=true"
39+
```

0 commit comments

Comments
 (0)