Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Turso 3 min read Case study easyNovice

How DatoCMS solved tag invalidation with Turso

DatoCMS's Content Delivery API attaches cache tags to every response and sends invalidated tags to the frontend via webhook, but Next.js limits a cache item to 64 tags. To work around it, the DatoCMS Next.js starter stores query-identifier/cache-tag pairs in a single two-column Turso table and tags each page with only the query ID (a SHA1 digest). On invalidation, it looks up the affected queries, invalidates them, and deletes their rows. The writeup mainly promotes the starter and Turso's free plan, with only a brief sketch of the mechanism.

Related posts

  • Write that blog… with Turso!

    Turso mediumAdept

    WriteThatBlog!, an aggregator of engineering blog posts tagged by writing pattern, is a single static HTML page on GitHub Pages that queries a replicated Turso database directly from the browser over HTTP, with no backend functions or proxies. A read-only auth token is deliberately embedded in the page because the data is public anyway. The schema is one five-column table, and content is managed with a small shell script around `turso db shell` that returns the ROWID, which makes later updates and deletes trivial.

  • Use Turso as your Unkey cache store

    Turso mediumAdept

    Turso can serve as the backing store for Unkey's `@unkey/cache` middleware library through its `LibSQLStore` adapter. Setup takes four steps: install `@unkey/cache` and `@libsql/client`, create a `cache` table with key, value, freshUntil and staleUntil columns, pass a libSQL client to `LibSQLStore`, and register it in a cache namespace with fresh (60s) and stale (15m) windows. Pointing the client at an Embedded Replica (`file:local.db` with a `syncUrl`) keeps the cache next to the app to cut read latency.

  • Incident 2023-12-04: Data leak and loss in some free tier databases

    Turso mediumAdept

    A migration bug introduced on November 20 left 0.07% of Turso free-tier databases with an empty backup identifier, so they all pointed at a shared S3 prefix (s3://bucket//) instead of per-database paths. When scale-to-zero databases on fly.io couldn't be resumed and were recreated from backup, they restored from this shared location, leaking data across tenants. The fix re-ran the migration and restored each affected database from its correct December 1 backup, discarding later writes. Remediation includes control- and data-plane checks that backups match their database, stricter allowed configurations with self-healing, safer migrations and better security reporting channels.

  • Timeseries indexing at scale

    Datadog Engineering mediumAdept

    Datadog replaced its timeseries index, which auto-generated materialized indexes from a log of slow queries, with an inverted index that unconditionally indexes every metric;tag pair, much like search engines map words to documents. The original Go service used SQLite for index definitions and the query log and RocksDB for Tagsets, Metrics and Indexes. It worked for predictable programmatic queries, but unpredictable user queries fell back to full scans, causing timeouts and manual index toil. The next-gen design drops SQLite, keeps RocksDB, and answers tag filters by intersecting posting lists of timeseries IDs. The two generations are compared on performance and reliability.

  • Build your own Web Analytics Dashboard with Turso and Bolt

    Turso mediumAdept

    Bolt can generate a Next.js 14 web analytics dashboard backed by a Turso database when you feed it the database schema and a detailed requirements prompt. The walkthrough covers dumping the schema with the Turso CLI, then writing a prompt that specifies libsql-stateless-easy, shadcn/ui, server-side rendering and date-range filtering, and finally wiring up the database URL and auth token in .env. Follow-up prompts refine the output, for example adding country flags and device styling. When Bolt can't fix an error itself, the suggested remedy is to give it more context, such as the framework's latest documentation.

The quest for software engineering knowledge.

Look:
Layout: