Vitti SQL Formatter
A SQL formatter that applies my personal house style: lowercase
keywords, a vertical "river" layout (clause keywords on the left,
operands aligned to a fixed column), leading commas, aligned
aliases, every WHERE opening with 1=1,
CASE and window functions on multiple lines. The rules
weren't invented for this project — they were reverse-engineered
from 47 real SQL scripts I'd written by hand over
the years. The formatter reproduces how I already write.
One engine (sqlfmt.js, vanilla JavaScript, zero
dependencies), four vehicles: a web app at
identar.lucas.mat.br
with four colour-coded draggable rulers controlling the alignment
columns live; a browser extension (Chrome + Edge,
both submitted, in review) that reformats selected SQL in any web
editor with Ctrl+Shift+Y, 100% local; an HTTP
API at identar.lucas.mat.br/api/format for
automation; and a Claude Code hook that auto-formats
.sql files as I write them. Scope: DML
(select/insert/update/delete,
CTEs, subqueries, window functions); procedural scaffolding passes
through untouched.
Hand-written tokenizer + recursive clause formatter. The web app
and the extension run entirely in the browser —
zero network calls, the SQL never leaves your machine. The API is a
zero-dependency Node server (built on the native http
module), running as a hardened systemd unit bound to
localhost, behind an nginx reverse proxy with limit_req.
The MV3 extension asks for no host permissions: it injects on
demand via activeTab only when invoked. Full style
spec at
RULES.html.