I think this could be doable with a bit of getting grease on your hands. In other words, if you are not afraid to swing at coding.
But I do see one issue… you would have to run a no-login/public instance of Calibre and/or Calibre-Web. This would be an issue because of the fact that Calibre and Calibre-Web both use two SQLite databases, one for users and one for books. If the user database file does not exist, then the installation assumes that the library(s) is/are public.
If you would like to tackle the above, then please feel free to look me up on Reddit at u/thisiszeev. I would be happy to work with them to at least get Calibre-Web running in Nextcloud as an “external site” from the menu. But bear in mind, the “external site” would be 100% open to the public. This is risky. But as a nice weekend project, you are sure to learn a bit.
In order to really make this work, one would need to really get covered in grease, head to toe, and develop something a bit more substantial. I would say, for now, have the SQLite library databases on the server in a folder within Nextcloud, but I would try and avoid it from being in the www path structure. Like you should be doing for your user folders.
I would then create a “share” either SMB or NFS or SSH to your local machine and setup your Calibre instance on your local machine to use those SQLite libraries and store the various books in the relative folders of each library.
This would allow you to easily manage the libraries from a very powerful GUI that works 1000x better than Calibre-Web and 10000000x than Calibre-Server.
The added advantage is that your plugin can then be used in “admin mode” to afford access to each library on a per-user/group basis. Simple SQLite code for PHP would allow you to read the data from the respective SQLite databases as per the user/group permissions. Thus allowing the user to access the book(s) of his or her choice.
This, however, would be a read-only solution, but it’s a solution for now… Once you are at this point then you would start porting features across.
Again, hit me up on Reddit if you want to discuss the concept in depth. I am currently snowed in with dev work but am happy to guide/assist/point in the right direction, for anyone who wants to do this as a “I-taught-myself-to-code” project.
My resume: Linux Desktop/Server (full range - though I suck at docker), BASH, PHP, MySQL, HTML5, CSS3, enough JS to start Armagedon, and recently added some JQuery to my belt, since I started making extensive use of APIs and JSON. Currently learning Vue.JS and loving it. Next on my bucket list is Rust.