Typically, an application will have three layers. I am new to Streamlit and went through some documentation and a book. However the book only talked about displaying traditional data sources in UI. I am looking for some pointers how I write a Python service behind UI that can call a back-end database and display results.
e.g. Streamlit UI → Services (middle tier) → Database
Can I please get some pointers to an example app either in gallery or documented somewhere?
Hi Franky,
these data source examples talk about Streamlit connecting to datasource (or two tier). I am looking for docs that can explain a pattern on how to code a middle tier. For example use FastAPI in between Streamlit and a datasource. Is this not possible with Streamlit?
The usual pattern is that you decide what API you want, then you implement it (using FastAPI or not, that is just an implementation detail) and deploy it.
Now you can call the API from any client that is able to reach your API server, Streamlit shouldn’t make it any different.
Okay thanks that makes sense. The use case as I could see is two tier rapid web app with Streamlit as front end and a data source as backend. Wanted to make sure if a three tier application is possible for scalability or what ever the reasons.
Do you know if there are applications that employ Streamlit as front end in a three tier app? In gallery or elsewhere.
I regularly use a remote FastAPI server as a gateway to my business logic which in turn interfaces to a DB (or some persistence mechanism). Streamlit is the UI and calls my FastAPI endpoints for all operations (typically CRUD operations).
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.