Skip to content
Merged
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
12 changes: 10 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ ClickHouse. No framework, no runtime deps. Quality is held by tests.
to browsers: prefer a PKCE public client; if an IdP requires a
`client_secret` there, lock the redirect URI and treat the file as public
(see README "Configuring OAuth").
4. **The build is esbuild only.** Source files are the tested files; esbuild
bundles `src/main.js` → `dist/sql.html`. Don't add a runtime dependency.
4. **The build is esbuild only; runtime deps are rare and deliberate.** Source
files are the tested files; esbuild bundles `src/main.js` → `dist/sql.html`.
The **one** bundled runtime dependency is **Chart.js** (the Chart result
view) — inlined into the artifact, so the page still makes zero third-party
requests. Adding *another* runtime dependency is a deliberate decision (it
grows the single served file) — don't do it casually. When a feature needs a
library, keep the testable logic pure in `src/core/` (chart axis/role/pivot
math lives in `src/core/chart-data.js`, 100%-covered) and make the library
call an **injected seam** (`app.Chart`, like the fetch/crypto seams) so the
DOM wrapper stays fully tested rather than dropping below the coverage gate.

## How to add a result view / panel / feature

Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Altinity SQL Browser

A zero-dependency, OAuth-gated **SQL browser for any ClickHouse cluster** —
schema explorer, tabbed SQL editor with syntax highlighting, streaming results
with table / JSON / chart views, saved queries, history, and shareable links.
It ships as a **single self-contained HTML file served from ClickHouse itself**
(no Node server, no CDN, no external fonts, no runtime dependencies) — the page
makes **zero third-party requests** and renders in the OS's native UI font.
An OAuth-gated **SQL browser for any ClickHouse cluster** — schema explorer,
tabbed SQL editor with syntax highlighting, streaming results with table / JSON
/ chart views, saved queries, history, and shareable links. It ships as a
**single self-contained HTML file served from ClickHouse itself** (no Node
server, no CDN, no external fonts) — the page makes **zero third-party
requests** and renders in the OS's native UI font. Its only bundled runtime
dependency is **Chart.js** (the chart result view), inlined into that one file.

Refactored from a single-file SPA into a fully modular, test-first codebase
held at **100% test coverage**.
Expand Down Expand Up @@ -196,7 +197,8 @@ Preview the rendered artifacts without touching ClickHouse:
```
src/
core/ pure logic — format, jwt, pkce, sql-highlight, share, sort,
stream, storage, chart-data (no DOM, no globals)
stream, storage, chart-data (roles/autoChart/pivot + Chart.js
config builder; no DOM, no globals)
net/ oauth-config, oauth, ch-client (injected fetch seam)
ui/ dom (hyperscript), icons, + render modules (login, editor, tabs,
schema, results, saved-history, shortcuts, splitters, toast, app)
Expand Down
7 changes: 4 additions & 3 deletions build/build.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Build the single-file SPA: esbuild bundles src/main.js into one IIFE, which
// is inlined (with the stylesheet) into build/template.html → dist/sql.html.
//
// esbuild is the only build-time tool; the runtime ships zero dependencies.
// The output is a self-contained HTML file that installs into any ClickHouse
// cluster's user_files and is served by an <http_handlers> static rule.
// esbuild is the only build-time tool; the sole bundled runtime dependency is
// Chart.js (inlined, not fetched). The output is a self-contained HTML file
// that installs into any ClickHouse cluster's user_files and is served by an
// <http_handlers> static rule — it still makes zero third-party requests.

import { build } from 'esbuild';
import { readFile, writeFile, mkdir } from 'node:fs/promises';
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
"esbuild": "^0.21.5",
"happy-dom": "^15.11.0",
"vitest": "^2.1.8"
},
"dependencies": {
"chart.js": "^4.5.1"
}
}
Loading
Loading