can I add authentication on top of it to restrict docs access to logged-in users?
If you want in-app authentication, remember we are a static site generator so at the end of the day we have to produce static html files, and at build time we can't know which user it is. You can use a client-side authentication where your HTML first render a profile placeholder and then the profile data gets loaded with an auth request. You can also render a full-screen spinner on the static page, and then use React client-side to auth the user.
See also: https://github.com/facebook/docusaurus/issues/958#issuecomme...