DEV Community

VeilAnalytics
VeilAnalytics

Posted on

SQL Analytics in the Browser Without Uploading Your Data Anywhere

SQL Analytics in the Browser Without Uploading Your Data Anywhere

Every time you use a data tool that asks you to "upload your file," your data leaves your machine.

It goes to a server, gets processed, gets stored (often indefinitely in logs), and becomes subject to that company's data retention, breach risk, and subpoena exposure.

For personal finance spreadsheets, HR data, client lists, or internal business data — this is a real problem that most people don't think about until something goes wrong.

There is now a better way: SQL analytics that runs entirely inside your browser tab.


🧠 How In-Browser SQL Actually Works

Modern browsers can run WebAssembly (WASM) — compiled binary code that executes at near-native speed inside the browser sandbox. This means a full SQL engine can run client-side.

DuckDB-WASM is exactly this: DuckDB, the fast columnar analytical database, compiled to WebAssembly. It runs completely inside your browser with:

  • No network requests for computation
  • No backend server
  • No data ever leaving your device
  • Full SQL support: JOINs, GROUP BY, window functions, CTEs

The architecture looks like this:

Your Browser Tab
├── DuckDB-WASM (SQL engine, runs in Web Worker)
├── Your CSV/Parquet file (loaded from local disk, stays local)
└── Results displayed in your browser

                ↕ Network traffic: ZERO (after initial page load)

No backend servers. No uploads. No logs on someone else's machine.
Enter fullscreen mode Exit fullscreen mode

🔧 What You Can Query

In-browser DuckDB handles all standard analytical SQL:

-- Aggregate across a million-row CSV
SELECT 
  category,
  SUM(revenue) as total_revenue,
  COUNT(*) as order_count,
  AVG(revenue) as avg_order
FROM 'sales_data.csv'
GROUP BY category
ORDER BY total_revenue DESC;

-- Join two local files
SELECT 
  c.name,
  c.email,
  COUNT(o.id) as order_count
FROM 'customers.csv' c
JOIN 'orders.csv' o ON c.id = o.customer_id
GROUP BY c.name, c.email
HAVING COUNT(o.id) > 5;

-- Window functions work too
SELECT 
  month,
  revenue,
  SUM(revenue) OVER (ORDER BY month) as cumulative_revenue
FROM 'monthly_sales.csv';
Enter fullscreen mode Exit fullscreen mode

📂 Supported File Formats

DuckDB-WASM can query:

Format Example Notes
CSV sales.csv Auto-detects delimiter and types
TSV export.tsv Tab-delimited
Parquet data.parquet Fastest — columnar format
JSON records.json Arrays of objects
XLSX Via conversion Load with js-xlsx first

⚡ Performance in the Browser

You'd expect browser execution to be slow. It's not.

For analytical queries (aggregations, joins, filters), DuckDB-WASM typically handles:

  • 1M rows → under 500ms
  • 10M rows → 2-5 seconds
  • Dataset Size Limits: Modern browsers enforce a 32-bit WebAssembly address ceiling (~2GB to 4GB memory buffer in Chrome/Firefox). For files up to ~1GB–2GB (or Parquet files up to 10M+ rows), in-browser processing is instant. For massive multi-gigabyte files, running DuckDB in-process via local Python/CLI is recommended.

🛠️ Using It Yourself

Option 1: Use VeilAnalytics (No Code Required)

VeilAnalytics provides an out-of-the-box natural language interface on top of in-browser DuckDB. You:

  1. Open the app (no login required)
  2. Drop your CSV or upload from disk
  3. Ask your question in plain English: "What's the total revenue by region for Q3?"
  4. Get results instantly

Your file never leaves your browser. There are no servers processing your data.

Option 2: Build Your Own with DuckDB-WASM

If you're a developer, you can integrate DuckDB-WASM into any web application:

<!DOCTYPE html>
<html>
<head>
  <script type="module">
    import * as duckdb from 'https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@latest/dist/duckdb-browser-mvp.mjs';

    const MANUAL_BUNDLES = {
      mvp: {
        mainModule: 'https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@latest/dist/duckdb-mvp.wasm',
        mainWorker: 'https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@latest/dist/duckdb-browser-mvp.worker.js',
      }
    };

    const bundle = await duckdb.selectBundle(MANUAL_BUNDLES);
    const worker = new Worker(bundle.mainWorker);
    const logger = new duckdb.ConsoleLogger();
    const db = new duckdb.AsyncDuckDB(logger, worker);
    await db.instantiate(bundle.mainModule);

    const conn = await db.connect();

    // Handle file upload
    document.getElementById('fileInput').addEventListener('change', async (e) => {
      const file = e.target.files[0];
      const buffer = await file.arrayBuffer();
      await db.registerFileBuffer(file.name, new Uint8Array(buffer));

      // Query it immediately
      const result = await conn.query(`SELECT * FROM '${file.name}' LIMIT 10`);
      console.log(result.toArray());
    });
  </script>
</head>
<body>
  <input type="file" id="fileInput" accept=".csv,.parquet" />
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

The file is loaded from your local disk directly into the browser's memory — no fetch request, no upload endpoint, no server.


🔒 The Privacy Guarantees

When you run analytics in-browser with DuckDB-WASM:

  1. No upload API call — the file never leaves your device
  2. No server logs — there's no server to log anything
  3. No cookies/tracking needed for the computation
  4. Works offline — after the initial page load, it can function without internet
  5. Browser sandboxed — WASM runs in an isolated sandbox, can't access other files or network

Verify this yourself: open your browser's Network tab and run a query on a local file. You'll see zero outbound requests to any analytics server.


🆚 How This Compares

Tool Data Uploaded? Privacy Cost
Google Sheets ✅ To Google servers ❌ Low Free
Excel Online ✅ To Microsoft ❌ Low Subscription
ChatGPT File Upload ✅ To OpenAI ❌ Low $20/mo
Tableau Online ✅ To Salesforce ❌ Low $$$$
VeilAnalytics (in-browser DuckDB) ❌ Never ✅ Maximum Free
DIY DuckDB-WASM ❌ Never ✅ Maximum Dev time

The Bottom Line

Browser-native SQL analytics isn't just a privacy feature. It's also:

  • Faster to start — no account, no upload, instant
  • Cheaper to operate — no backend infrastructure costs
  • Simpler architecture — static frontend, zero servers
  • More scalable — computation runs on each user's device

If your use case involves sensitive files and analytical SQL queries, in-browser DuckDB is worth understanding. The technology is mature, fast enough for most real-world datasets, and provides privacy guarantees that no server-based tool can match.


VeilAnalytics — In-browser SQL analytics with natural language queries. Your data stays in your browser. Always.

Top comments (0)