Have you checked out https://nextcloud.com for solving everything?
NextCloud's engine doesn't seem to be very friendly/lightweight in this regard as it's been built specifically for their frontend :/ I was hoping there was some library that accomplished the same thing while being more lightweight/having friendly bindings.