Has anyone migrated an older Python dashboard to Streamlit?

I am interested in how developers approach older Python dashboards that were originally built using scripts, notebooks, or custom interfaces.

These tools can be useful for years, but maintaining dependencies, sharing results with colleagues, and adding interactive features can eventually become difficult.

In a software legacy modernization project, would you keep the existing Python logic and build a new Streamlit interface around it, or would you restructure the application first?

I would also like to know how you handle session state, authentication, data loading, and compatibility with existing workflows during a migration.

If you have done something similar, what worked well, and what problems did you run into?

Welcome to the Streamlit community, and thanks for your thoughtful question! :balloon: My understanding is that for legacy Python dashboards, many developers keep the core business logic (data processing, analysis) and wrap it with a new Streamlit interface, rather than rewriting everything from scratch. This approach leverages existing, battle-tested code while modernizing the UI and adding interactivity. Streamlit’s architecture is well-suited for this, as it allows you to call existing Python functions directly and incrementally enhance the app with widgets, charts, and layouts. For session state, Streamlit provides st.session_state to persist variables across reruns, which is essential for multi-step workflows and user-specific data. Authentication can be handled using Streamlit’s built-in OIDC support (st.login, st.logout), and data loading is often optimized with caching decorators like st.cache_data and st.cache_resource to avoid redundant computation and database hits. Compatibility with existing workflows is maintained by modularizing the legacy code and exposing it as functions or classes that Streamlit can call as needed. According to the Streamlit Concepts documentation, this modular, incremental migration is a common and recommended pattern.

It seems likely that the main challenges encountered are: (1) managing session state for multi-user or multi-step workflows (solved with st.session_state), (2) handling authentication and secrets securely (solved with Streamlit’s secrets management and OIDC integration), and (3) ensuring that data loading is efficient and doesn’t break existing logic (solved with caching and careful refactoring). Problems can arise if the legacy code is tightly coupled to a specific UI or has side effects that don’t fit Streamlit’s rerun model, so some restructuring may be needed for stateful or interactive features. For best results, developers recommend isolating pure data logic from UI code, using Streamlit’s session state and caching features, and testing each migration step. For more details and best practices, see the Streamlit App Development Concepts and Advanced Concepts.

Sources: