I have a leaflet app up and running using plain Leaflet, HTML, CSS and JS. Currently, it's just in a folder with an index.html file, a main.js file, and a folder with all my data. The data is geojson data. I ultimately want the data I'm working with to be inaccessible to users when I put it online. I'm looking for a big picture, outline of how I should solve this problem.
I'm considering using something like MongoDB to store my data, but there are no precedents or tutorials online on how to do exactly this with Leaflet. It also seems to require a lot of changes to my code and trying to add express and node(?) to my app. Any ideas or links to examples would be greatly appreciated.
You are thinking in the wrong direction with MongoDB as this does not protect your data in any additional way.
It is not possible to serve a plain HTML web page, instead the data is hidden - as anyone can find access in the HTML source code.
What you need is a third-party provider that supports OAuth, for example:
They will issue you a JWT as shown in the Huawei documentation below, then on the server side you need to validate the token and decide whether to provide the data.
Even then, authorized customers may obtain and distribute your data.
I know this stuff because as a hobby developer I wrote 2 web games and I'm using these 4 services (there are more) to authenticate users.
This is my server-side Java code sample for verifying Huawei Account Kit: