That could be nice with D1.
D1, unfortunately, doesn't support loading extensions into SQLite.
fly.io, and their sqlite solution, does however!
I've been using fly.io to run cr-sqlite in the cloud and act as a sync server for non peer to peer use cases. Eventually I'll have finished up a re-write of strut.io[1] atop vlcn/cr-sqlite which'll serve as a good end to end example of how to make applications with this sort of architecture.
Some discussion about this setup on the fly.io forums: https://community.fly.io/t/litefs-many-tens-to-hundreds-of-t...