The problem is that D1 can only be accessed via Worker binding or API.
Worker binding cannot be shared to Container (where the app runs) and using the API makes application vendor specific.
D1 is sqlite behind the scenes which doesn't expose any network access out of the box. Luckily there is LibSQL open-source alternative and Hrana protocol designed for network accessible sqlite-like database.
I wrote a small wrapper on Worker binding that expose D1 as LibSQL/Hrana so that any compatible client can talk to the D1.
As a result, you can deploy full Docker-based app with relatively standard persistence layer, so you can easily move somewhere else in the future.
The downside is that every call to the DB is another Worker call, so it's just a fun proof-of-concept.
michaloo•1h ago