Few months after my last post (already 2 years ago!) I landed my first job. My free time started running very low together with my energies, even though I was in full remote 9 to 5. At that time I understood how much draining and inefficient the “GNU/Linux and FOSS” thing is. The “Linux is free if your time has no value” infamous quote has made its way to my brain once fully protected by fallacies and a big ego, probably because I had experimented myself the truth of that claim.
Thanks to SQLite VFS abstraction, it is possible to implement your own file system on which SQLite parks data and structures. Inspired by Phiresky's sql.js-httpvfs which uses HTTP Range requests to lazy load blocks of storage from a static web server, I changed few lines of code to point the VFS read() calls to a database seeded by peers as a torrent. A 300 MiB db with 2 million records can be queried from seeders for full text searches in less than 1 MiB traffic with the BitTorrent protocol, all inside the browser, in a static website.
Since IPFS, a p2p network for storing and retrieving files, has a javascript implementation that runs on browsers, it can be used in torrent websites to retrieve a small database from peers instead of the server. A .sqlite file, 13 MB in size containing around 135,000 records, can be retrieved in 8 seconds from the IPFS network using a 100 Mbit connection. Since the database object is small enough to be cached by the browser, subsequent visits take zero.