<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sharefun2023</title>
    <description>The latest articles on DEV Community by sharefun2023 (@sharefun2023).</description>
    <link>https://dev.to/sharefun2023</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4038465%2F0efe338c-5e60-4e6d-ae98-f674cfd4a893.png</url>
      <title>DEV Community: sharefun2023</title>
      <link>https://dev.to/sharefun2023</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sharefun2023"/>
    <language>en</language>
    <item>
      <title>Building a Client-Side SQL Formatter with Vanilla JS and Web Workers</title>
      <dc:creator>sharefun2023</dc:creator>
      <pubDate>Mon, 20 Jul 2026 15:35:46 +0000</pubDate>
      <link>https://dev.to/sharefun2023/building-a-client-side-sql-formatter-with-vanilla-js-and-web-workers-888</link>
      <guid>https://dev.to/sharefun2023/building-a-client-side-sql-formatter-with-vanilla-js-and-web-workers-888</guid>
      <description>&lt;p&gt;Most SQL formatters process queries server-side. That means every time you click "Format", your SQL gets sent to a random backend — with no guarantee of what happens to it.&lt;/p&gt;

&lt;p&gt;I wanted something different: &lt;strong&gt;a formatter where your data never leaves your browser.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://sqlformat.io" rel="noopener noreferrer"&gt;sqlformat.io&lt;/a&gt;&lt;/strong&gt; is built with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vanilla JavaScript&lt;/strong&gt; — no framework, no build step&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/sql-formatter-org/sql-formatter" rel="noopener noreferrer"&gt;sql-formatter&lt;/a&gt;&lt;/strong&gt; — the formatting engine&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Workers&lt;/strong&gt; — formatting runs off the main thread so the UI stays snappy even on 1000+ line queries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare Pages&lt;/strong&gt; — zero-cost hosting with global edge caching&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User pastes SQL
  ↓
Main thread sends to Web Worker
  ↓
Worker calls sql-formatter with dialect-specific options
  ↓
Formatted SQL sent back to main thread
  ↓
Rendered with syntax highlighting (no library needed — just regex + &amp;lt;span&amp;gt;)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key insight:&lt;/strong&gt; the sql-formatter library alone is ~50KB gzipped. Running it in a Web Worker means the main thread never blocks, and the user can keep typing while large queries format in the background.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why No Server?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Privacy&lt;/strong&gt; — zero bytes leave the user browser&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline&lt;/strong&gt; — works after the page loads, no internet needed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scale&lt;/strong&gt; — no server costs, no rate limits, no API keys&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speed&lt;/strong&gt; — no round trip, instant formatting&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Web Workers are underrated&lt;/strong&gt; — they turn a potentially laggy text processor into a buttery-smooth UX&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SQL dialects are deceptively complex&lt;/strong&gt; — MySQL vs PostgreSQL vs BigQuery all have different quoting rules, and the formatter needs to handle inline comments and dollar-quoted strings that span multiple lines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regex-based syntax highlighting works surprisingly well&lt;/strong&gt; for SQL — you do not need a parser, just a few well-placed regex patterns for keywords, strings, numbers, and comments&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Try it: &lt;a href="https://sqlformat.io" rel="noopener noreferrer"&gt;sqlformat.io&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Source: &lt;a href="https://github.com/sharefun2023/sqlformat.io" rel="noopener noreferrer"&gt;github.com/sharefun2023/sqlformat.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>I Got Tired of Slow SQL Formatters That Upload My Queries — So I Built a Free One</title>
      <dc:creator>sharefun2023</dc:creator>
      <pubDate>Mon, 20 Jul 2026 15:35:08 +0000</pubDate>
      <link>https://dev.to/sharefun2023/i-got-tired-of-slow-sql-formatters-that-upload-my-queries-so-i-built-a-free-one-129o</link>
      <guid>https://dev.to/sharefun2023/i-got-tired-of-slow-sql-formatters-that-upload-my-queries-so-i-built-a-free-one-129o</guid>
      <description>&lt;p&gt;I write a lot of SQL every day. And every online formatter I tried had the same problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Uploads queries to their server&lt;/strong&gt; — privacy nightmare when you are working with production schema&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tiny text area&lt;/strong&gt; — cannot handle 500+ line queries without lag&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3 ads&lt;/strong&gt; before you even see the formatted output&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I built &lt;strong&gt;&lt;a href="https://sqlformat.io" rel="noopener noreferrer"&gt;sqlformat.io&lt;/a&gt;&lt;/strong&gt; — a no-BS SQL formatter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client-side only&lt;/strong&gt; — everything runs in YOUR browser via Web Worker. Zero bytes leave your device&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;15+ SQL dialects&lt;/strong&gt; — MySQL, PostgreSQL, SQLite, BigQuery, Snowflake, T-SQL, and more&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No signup, no ads, no upload&lt;/strong&gt; — ever&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant&lt;/strong&gt; — paste, click Format, done&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;I got tired of copy-pasting production queries into random websites and wondering where they ended up. With sqlformat.io, you can disconnect your internet after the page loads and keep formatting offline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extra Tools Included
&lt;/h2&gt;

&lt;p&gt;It is not just a formatter — the site has several free SQL tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Diff&lt;/strong&gt; — compare two SQL queries side by side&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minify/Compress&lt;/strong&gt; — strip whitespace for embedding in code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate&lt;/strong&gt; — syntax check across dialects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ER Diagram&lt;/strong&gt; — visualize table relationships&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SQL to JSON&lt;/strong&gt; — convert query results&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Generator&lt;/strong&gt; — generate test data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explain Visualizer&lt;/strong&gt; — MySQL/PostgreSQL EXPLAIN output as a tree&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;p&gt;Vanilla JS + &lt;a href="https://github.com/sql-formatter-org/sql-formatter" rel="noopener noreferrer"&gt;sql-formatter&lt;/a&gt; library, hosted on Cloudflare Pages. All formatting runs in a Web Worker so the UI stays responsive even on huge queries.&lt;/p&gt;




&lt;p&gt;Open source: &lt;a href="https://github.com/sharefun2023/sqlformat.io" rel="noopener noreferrer"&gt;github.com/sharefun2023/sqlformat.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would love feedback from folks who format SQL daily!&lt;/p&gt;

</description>
      <category>sql</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
