DuckDB is an embedded, single-process OLAP engine. Its extensions make it much more than that, which made me ask: how much of an online shop can DuckDB power?

Illustration of the Teal Deal shop, a cosy storefront with a teal awning and a window full of rubber ducks, generated with AI

DuckDB 2.0 landed recently, including Quack, its client-server protocol. That felt like a good excuse to find out, so I built a toy duck shop, Teal Deal, and used DuckDB for everything:

  • the checkout transaction
  • the clickstream lake and analytics
  • full-text and vector search
  • a graph recommender
  • a SQL engine in the browser
  • a live dashboard

Flip on 🩻 x-ray mode in the shop and it labels which part of DuckDB powers each feature.

To be clear, the goal was not a good architecture, and this is not a recommendation to do it in production. It was a thought experiment made real; with Claude Code as the enabler. So where does “DuckDB everywhere” hold up, and where doesn’t it?

The short answer

Almost everywhere, until you ask it to take lots of writes.

  • ✅ Works: OLTP with real constraints and triggers, one query across tiers, time travel over a Parquet lake, search, vectors and graphs in the browser, and a browser attached to a live server over Quack.
  • ⚠️ Works, if you design around it: concurrent users. It is one writer per file.

The rest of the post follows a duck through the shop: checkout, the lake, search, and the dashboard. Then I’ll expand on the issue with writes.

The browser runs its own DuckDB-WASM, but every write goes through one collector process into oltp.duckdb and the DuckLake lake.

Teal Deal architecture: a browser running DuckDB-WASM talks to a collector, which writes to an OLTP database and a DuckLake lake

Checkout: DuckDB as a real OLTP database

I expected to be apologising for DuckDB here, and I wasn’t. PRIMARY KEY, REFERENCES, CHECK and SEQUENCE are all real. The order flow is a genuine BEGIN ... COMMIT: allocate an order, decrement inventory, write line items. CHECK (stock >= 0) does the job a pessimistic row lock would, so if you try to oversell, the whole transaction rolls back.

2.0 adds triggers, and they earn their keep. One logs every stock change to an audit table. Another restocks a product when an order leaves it under 5, inside the same transaction, so the public demo can’t sell itself empty. One sharp edge: a trigger can’t update its own table, so the restock trigger hangs off order_items instead of inventory.

The lake: one query across tiers, with time travel

Orders live in the transactional store and clicks live in a lake. ATTACH lets a single query span both. The retention cohorts join lake activity to OLTP signup and country in one statement:

ATTACH 'oltp.duckdb' AS oltp;   -- the lake is attached the same way

SELECT c.cohort_week,
       u.country,
       date_diff('week', c.cohort_week, a.active_week) AS weeks_since,
       count(DISTINCT c.user_id) AS active_users
FROM cohort c
JOIN activity a USING (user_id)     -- built from lake_events (DuckLake)
JOIN oltp.users u USING (user_id)   -- the cross-database join
GROUP BY 1, 2, 3;

(cohort and activity are CTEs over the lake events, left out here.) The last JOIN crosses two storage engines, and it reads like any other join. Now I can get retention and funnel numbers without needing a second system.

DuckLake gives you real versioning over the Parquet files. Each commit is a snapshot, and AT (VERSION => n) replays the funnel as of an earlier state: version 2 has 2,078 events, version 4 has 5,343. There is a change feed too. Batched inserts produce lots of small files, and CALL ducklake_merge_adjacent_files('lakehouse') is the documented answer to deal with it.

Search: the same engine in the browser

This is the part I enjoyed most. DuckDB-WASM runs real analytical SQL in the browser, so the exact same engine runs on the server and the client.

  • Full-text search. BM25 (fts) runs client-side with zero round-trips.
  • “Ducks like this” (vector search). A simple but real text embedding: a hashed bag of words over each product’s name and description, stored as FLOAT[16], computed in the browser with plain SQL and no external model. Each product’s neighbours are found once with DuckDB 2.0’s NEAREST join, so the per-keystroke query is just a lookup. That join and array_distance are core DuckDB. The vss extension adds an in-memory HNSW index on top, and the planner uses it (EXPLAIN shows an “Hnsw Index Join”). At 60 ducks it is no faster than a scan and gives identical lists; it is there to show vss at work.
  • “Ducks near …” filter. The spatial extension: each species has a range polygon, and the filter is ST_Contains(range, ST_Point(lon, lat)) for the place you pick. spatial is fetched on demand when a place is picked.

One feature doesn’t run in the browser. The “Since you brought them home” post-purchase recommendations are a hybrid: a DuckPGQ co-purchase graph combined with the embedding similarity above. DuckPGQ gives real CREATE PROPERTY GRAPH and MATCH queries. On 2.0 it needs an opt-in after loading, SET active_grammar_extensions = ['duckpgq'], and then a GRAPH_TABLE (... MATCH (a:product)-[e:bought_with]->(b:product) ...) query returns the right edges. It works in the browser, but in the shop the graph half runs server-side as a round trip to the collector, because it walks the order history and that lives in oltp.duckdb.

The dashboard: a browser attached to a live server

Here is the bit that surprised me. The dashboard’s funnel, retention and daily-activity charts are computed by DuckDB-WASM attached straight to the collector’s live DuckLake connection:

ATTACH 'quack:tealdeal.dorzey.net:443' AS remote (TOKEN '...');

No JSON API. Just SQL against a live server, from the browser, on a 4 second poll. Near real-time analytics with near zero effort.

It comes with caveats:

  • Both pages run Query Farm’s Haybarn build of DuckDB-WASM (2.0.0-rc12), because @duckdb/duckdb-wasm can’t attach to Quack yet.
  • Quack needs real threads, so the dashboard uses the threaded build and has to be served with Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers.
  • The storefront needs no Quack, so it uses the non-threaded build and no cross-origin isolation.
  • Haybarn ships only those two builds, with no fallback for older browsers lacking WebAssembly exception handling.

X-ray mode is honest about all this. Its labels report what actually loaded, so if fts can’t load, search says it fell back to ILIKE.

Where it pushes back: writes

So far everything worked. Then I asked the obvious question: can it serve concurrent users?

Reads, yes. Every browser tab gets its own WASM instance, which is embarrassingly parallel.

Writes to a shared file, no. DuckDB is single-writer. The honest way to run an app on it is to funnel every write through one serialising process.

“But Quack fixes that.” Partly. Quack lets a second process attach to a live connection and read and write while the first keeps running. It does not give you more write throughput. I measured that with 07_stress.py, which hammers the lake from N workers over Quack:

Workers Writes/sec Outcome
8 37 1 worker failed
24 32 4 workers failed

Three times the writers did not mean more throughput. DuckLake uses optimistic concurrency, not a queue, so contention shows up as retried-then-failed writes rather than hanging:

Failed to commit DuckLake transaction. Exceeded the maximum retry count of 10
set by the ducklake_max_retry_count setting. ... Conflict on update!

These are single 10 second runs on my laptop, so please don’t treat them as a benchmark. If you need many concurrent writers, the documented route is DuckLake with Postgres as the catalog. That was beyond the scope of putting DuckDB everywhere.

Is a public DuckDB endpoint a bad idea?

Maybe, but you can build safety in. The dashboard’s Quack token ships in the page, so it is public by definition. Teal Deal runs in a public mode where the collector refuses every Quack write and file read, which makes the public token harmless (hopefully).

The two endpoints that do write, /collect and /order, have per-IP and global rate limits, a body cap and strict validation. The validation matters more than it sounds: without it a client can order a negative quantity and add stock. The tracker is deliberately minimal too: a random per-tab session id in sessionStorage, no cookies, and nothing kept across visits. A real shop, of course, would need proper authentication and authorisation for checkout.

Verdict

“It works” and “it doesn’t” are both the wrong answer. DuckDB everywhere is compelling for read-heavy, single-writer workloads: demos, small apps, analytics-heavy backends. Remote access is largely covered too, as FK-constrained tables, time travel and a browser client all work over Quack.

The write path is the limit. One writer per file is still the design, Quack does not scale it, and concurrent writers need a Postgres catalog.

The code is at github.com/dorzey/teal-deal-shop, and the live demo resets nightly.

What DuckDB features and extensions did I miss in Teal Deal? Let me know!