Hello, everybody! Here is a WIP “full-stack” solution to presenting & persisting data with a Streamlit app that also has authentication via an Nginx reverse proxy. This should be secure, but I more than welcome the community to poke holes in this repo if I’ve overlooked anything critical (such as a publicly exposed database).
Context
For my day job, I frequently share sensitive data with trusted third parties via Excel files. Obviously, Streamlit would be a great replacement. Yet, the biggest hurdle I’ve faced is user authentication, since I’m working with dozens of third parties outside my trusted internal network/VPN. I want to show them my analyses, but my IT department won’t let them see it unless they’re authenticated.
And I don’t think I’m the only one. The ability to authenticate has been a pain point in several forum posts.
To help those facing similar constraints as myself (love Streamlit but need enterprise-grade authentication), I am sharing a bare-bones solution that should work (same as linked above). The trick is to configure nginx as a reverse proxy with an authentication layer that then sends you to Streamlit via proxy_pass.
Now once I did this, I realized there’s a bit more magic I can tap into. So I also setup a “full stack solution” with FastAPI, postgresql, and PGAdmin4 for interacting with & persisting information. This is helpful for me, because I build lots of micro-apps across my organization. So I need to save some data down, present it in a certain way, and allow for simple CRUD (which Streamlit is decent enough at). But if all you want is authentication (and don’t care about the API, etc.) then the README has some easy instructions for you.