Streamlit Tutorials: A Guide from First App to Deployment

A map of the Streamlit tutorials: build a first app, draw charts, cache slow work, keep values with session state, lay out and assemble a dashboard, and put it online.

Streamlit turns a Python script into a web app: call functions like st.title, st.slider and st.line_chart, then start it with streamlit run app.py. These tutorials go from that first script to a deployed dashboard. Each one has code you can copy and screenshots of the result, written for Streamlit 1.67.

Grid of six Streamlit app screenshots: a running log, four chart libraries compared, a temperature chart, a push-up tracker, a KPI dashboard and a savings calculator

Which Order Should I Learn Streamlit In?

Step Question Tutorial
1. Start How do I make an app with widgets and charts? Build Your First Streamlit App
2. Chart st.line_chart, Matplotlib, Plotly or Altair? Charts in Streamlit
3. Speed up Why does my data reload on every click? Streamlit Caching
4. Remember Why does my counter keep resetting? Streamlit Session State
5. Assemble How do I build a dashboard with KPI cards and filters? KPI Dashboard
6. Share How do I put the app online? Deploy a Streamlit App

Streamlit Layouts, Uploads, and Multipage Apps

Once the basics work, pick the tutorial for what your app needs next:

You want to Tutorial
Arrange a sidebar, columns and tabs Streamlit Layout
Let people upload their own CSV Streamlit File Uploader
Split the app into pages Multipage Apps
Build a chat interface for an LLM Streamlit Chatbot
Size and analyze experiments A/B Test Calculator

If you haven't settled on Streamlit yet, Streamlit vs Dash vs Shiny vs Gradio vs Panel builds the same app in all five.

How a Streamlit App Runs

Streamlit runs your script from top to bottom, and runs the whole script again whenever someone changes a widget. A widget call such as goal = st.slider(...) returns the current value, so simple apps need no callbacks.

That rerun model is the reason for the two features people meet next:

Tool Scope Use it for
Local variable One run of the script Anything cheap to recompute
st.session_state One browser tab's session Counters, user choices, multi-step forms
st.cache_data All users, by default DataFrames, query results, API responses
st.cache_resource All users, by default Database connections, ML models, API clients
st.query_params Whoever has the URL Shareable filters and views

st.cache_data returns a fresh copy on every call, while st.cache_resource returns the same object, so changes to it affect everyone.

Which Chart Function Should I Use?

Call Best for
st.line_chart, st.bar_chart, st.area_chart, st.scatter_chart Quick charts straight from a DataFrame
st.pyplot Static Matplotlib or Seaborn figures
st.plotly_chart Hover, zoom, selection events and many chart types
st.altair_chart Declarative charts with linked selections

Start with the built-in call and switch when you need something it can't express. The chart comparison draws the same data all four ways. For a number with a change arrow and a sparkline, use st.metric, shown in the KPI dashboard.

Common Streamlit Problems

Problem Fix Details
python app.py shows no app Run streamlit run app.py First app
st.button goes back to False It is True for one run only; store the result in st.session_state Session state
Page shows the old value after a click Update it in an on_click callback Session state
A cached list keeps growing Use st.cache_data instead of st.cache_resource Caching
ModuleNotFoundError after deploying Add the package to your dependency file Deployment

Where Can I Host a Streamlit App?

Streamlit Community Cloud is the quickest free option and deploys from a GitHub repository, but apps sleep when idle. Render suits small production apps that need a custom setup, and Docker works when the app has to run on your own infrastructure. The deployment tutorial covers all three and their limits.

Similar Topics