Filesystem backend

Hey,

Would it make sense to have a filesystem-based backend for the entries? The directory structure could possibly be something like

{vault}/{folder}/{entry}

… where entry could be JSON/TOML/CUE -encoded data.

Motivation: simplicity and the possibility to use a simple file-based synchronization/replication method like syncthing. This folder structure would also make it possible to choose which vaults are synchronized between different hosts and which not.

Perhaps why not: Runtime performance would be obviously worse and the codebase for searches et al would be more complicated due to not having SQL.

Possibly the most famous example of such an implemention is https://www.passwordstore.org/ and its performance seems to be fine even with having been written in bash.

That will not work for Vaultwarden/Bitwarden
To much SQL based queries and connections between items.
Also, what would be wrong with sqlite in this case, it is a file, and it has all the entries in there.

Would be rather strange to use a non-sql storage for something like this.

To much SQL based queries and connections between items.

Yeah, if the codebase doesn’t allow this then it doesn’t allow this.

Also, what would be wrong with sqlite in this case, it is a file, and it has all the entries in there.

If you have more than one writers to an sqlite database, doing any change whatsoever, there’s almost zero chance that that will work without conflicts. If you have more than one writers to a directory/file -based database, eventual synchronization will work just fine if they didn’t write in the same files.

When running syncthing between for instance two laptops, there’s a high probability that the writes will sometimes be out of order, causing aforementioned problems. This can be made less probable by having a third always on sync point, which is probably what I’ll end up doing if this thread’s idea doesn’t pan out.

Would be rather strange to use a non-sql storage for something like this.

Well, that’s how https://www.passwordstore.org/ does it.

With rather strange to use non-sql for this was linked to all the complexity in how Bitwarden links all items. When using a non-sql for that would make it very difficult.

Cool that other software tools use file based storage for this, if that was how they were designed, just not for Bitwarden and thus Vaultwarden.

If you want to sync between multiple active systems (which Vaultwarden is also not designed for), then i suggest to use an other database backend like MariaDB, it has multi master setup for example. But that could also cause issues, but it is possible. Not sure if that is also possible with PostgreSQL.