· javascript
Running the full server-side Datasette Python app in the browser with service workers and Pyodide
Datasette Lite is my port of the Datasette Python application to run directly in the browser using WebAssembly and Pyodide.
I've released a complete rewrite of Datasette Lite using service workers, and it's now almost indistinguishable from the real server-side application. Let's break down that URL to see what it's doing: https://lite.datasette.io/ ?install=datasette-maplibre &url=https://.../demo.db &metadata=https://.../metadata.yml #/demo/capitals_and_countries%23map=0/4.2/180&color=continent The ?install=datasette-maplibre installs that additional plugin from PyPI.
You can pass &install=... as many times as you like to load more plugins. &url=https://.../demo.db loads that SQLite database from the provided URL. These URLs need to have open CORS headers - I host files like this in Gists, because they provide an easy way to get open CORS headers on a web-hosted file. &metadata=https://.../metadata.yml loads this metadata.yml file.
The metadata file adds HTML descriptions to various tables, and to the Datasette homepage. That URL is doing a lot of work! I wrote more about this trick for building URL-addressable software in URL-addressable Pyodide Python environments last year.




