Build an Interactive Python Web App with Streamlit
A step-by-step guide to building and deploying an interactive Python web app using Streamlit, including updated hosting options for 2026.
What is Streamlit?
Streamlit is an open-source Python library that lets you build and share interactive web apps and data visualisations in Python with ease. It has built-in support for popular data science libraries like matplotlib, pandas, and plotly, making it easy to create interactive charts and graphs that update in real-time based on user input.

Streamlit is quite popular among data scientists, machine learning (ML) engineers, and developers who want to quickly turn scripts into shareable apps. Due to its rising popularity, Streamlit was acquired by Snowflake in March 2022. Just before the acquisition, Streamlit announced the launch of their cloud-hosted service. In this guide, we'll deploy a simple stock quote app on Streamlit Cloud, as well as other hosting platforms like Railway.
Streamlit Community Cloud is still free, but now supports public apps only. Private app hosting has moved to Snowflake (paid). Railway has also removed its permanent free tier — new users get a one-time $5 trial credit (30 days), after which the Hobby plan costs $5/month. See the hosting comparison below for free alternatives.
What You'll Build
In this guide, we'll build a simple stock quote app that uses the Polygon API to retrieve real-time stock information. Sign up for a free individual user account with Polygon, and generate an API token. If you'd prefer to use the Yahoo Finance API instead of Polygon, there's a ready-made alternative covered in the yfinance companion post.
Prerequisites
- A free GitHub account (for connecting to hosting platforms)
- A free Polygon.io account and API key
- Python 3.11+ installed locally (optional — you can edit files directly on GitHub)
Part 1 - Deploy on Streamlit Community Cloud
Streamlit Community Cloud is the easiest way to get your app live. It's free, deploys directly from GitHub, and auto-updates whenever you push code changes. The limitation is that apps must be public - anyone with the URL can access them.
First, fork my sample app repository, connect your Streamlit account to GitHub, and deploy your app using the forked repository in a few clicks. In fact, if you just want to create a simple Hello World app, all you need are two files - streamlit_app.py and requirements.txt. The former would have the following lines of code, while the latter would just include streamlit as a dependency.
import streamlit as st
st.write('Hello World!')I'll assume that you have forked my repository. I'm using the polygon-api-client library to retrieve the stock data. Here's my streamlit_app.py file.
import os, streamlit as st
from polygon import RESTClient
# Set up the Streamlit app
st.subheader("Stocks App")
symbol = st.text_input("Enter a stock symbol", "AAPL")
with st.sidebar:
polygon_api_key = st.text_input("Polygon API Key", type="password")
# Authenticate with the Polygon API
client = RESTClient(polygon_api_key)
col1, col2 = st.columns(2)
if col1.button("Get Details"):
if not polygon_api_key.strip() or not symbol.strip():
st.error("Please provide the missing fields.")
else:
try:
details = client.get_ticker_details(symbol)
st.success(f"Ticker: {details.ticker}\n\n"
f"Company Address: {details.address}\n\n"
f"Market Cap: {details.market_cap}")
except Exception as e:
st.exception(f"Exception: {e}")
if col2.button("Get Quote"):
if not polygon_api_key.strip() or not symbol.strip():
st.error("Please provide the missing fields.")
else:
try:
aggs = client.get_previous_close_agg(symbol)
for agg in aggs:
st.success(f"Ticker: {agg.ticker}\n\n"
f"Close: {agg.close}\n\n"
f"High: {agg.high}\n\n"
f"Low: {agg.low}\n\n"
f"Open: {agg.open}\n\n"
f"Volume: {agg.volume}")
except Exception as e:
st.exception(f"Exception: {e}") Connect to your GitHub account, and authorise access to Streamlit. From your Streamlit Cloud account, click New app to create a Streamlit app.

Select the main branch of the forked repository, and the default streamlit_app.py main file, and click Deploy.

Before or after deployment, head over to Settings and add a POLYGON_API_KEY environment variable (instead of the TRADIER_TOKEN variable displayed in the screenshot below). Secrets are stored encrypted and are never exposed in the UI or logs. You can also click the Advanced settings option in the previous screen and specify the environment variable.

To run secrets locally without hardcoding your API key, create a
.streamlit/secrets.toml file in your project root and add POLYGON_API_KEY = "your_key_here". Access it in code with st.secrets["POLYGON_API_KEY"]. Add .streamlit/secrets.toml to your .gitignore so it never gets committed.You may see the Your app is in the oven message for a while, but your app should get deployed to a ***.streamlit.app domain shortly. Specify the stock symbol (e.g. AAPL) and click Get Quote to retrieve the stock quote information. Voila! You have now deployed a fairly simple yet interactive app using Streamlit.

Instead of Streamlit Cloud, you can also deploy the app to other web hosting platforms of your choice. In the next section, I'll deploy the same app on Railway.
Part 2 - Deploy on Railway
Railway is a modern app hosting platform that makes it easy to deploy production-ready apps quickly. Sign up for an account using GitHub, and click Authorize Railway App when redirected. Review and agree to Railway's Terms of Service and Fair Use Policy if prompted. Launch the Streamlit Apps one-click starter template (or click the button below) to deploy the app instantly on Railway.
This template also deploys a Streamlit app that uses the Yahoo Finance API for stock ticker information - see this post for more details. Accept the defaults and click Deploy; the deployment will kick off immediately.

Once the deployment completes, the Streamlit apps will be available at a default xxx.up.railway.app domain - launch this URL to access the app. If you are interested in setting up a custom domain, I covered it at length in a previous post - see the final section here.
Hosting Platforms Quick Comparison
Here's how the main options stack up in 2026 for hosting public Streamlit apps:

Retrieve Stock Information using Yahoo Finance API
If you'd rather avoid setting up a Polygon account, the streamlit-yfinance repository uses the yfinance library which requires no API key. The same Railway template above deploys this version by default. Launch the same starter template (or click the button below) to deploy the app instantly on Railway.