Streamlit project/ folder structure for medium-sized apps?

Is there a best practice streamlit project layout? I’m playing around with and wonder if there is a common structure people use for medium-sized apps (with tests, modules etc.)?


Hey @cwerner,

My medium-sized Streamlit projects are the same as “most” Python projects like the pyscaffold project, with an additional src/<project>/ui folder where I put most of my functions/.py files that call Streamlit to display input/results for other methods of the package (for a multipage example I may have a .py file per page in ui). Then I have a at project level which acts as the main entry point for the Streamlit app and uses functions in ui module to access the package.

Though there are times I just sprinkle st calls inside my package files but that has a tendency to not be very maintanable.

Also on smaller projects I just have a scripts folder next to src where I put some huge Streamlit scripts ahah.


Thanks! Would you have a GitHub repo to take a look at this? Still a bit confused with setup.cfg, relative imports and folder structure :wink:

Argh right now I don’t, they are all internal projects :frowning: though that would make a good blog post hmmm…if more people are interested I’ll try and write one

but you can follow most of medium-sized Python projects and integrate Streamlit easily in it’s own file (with a main function) and folder when the package is installed. I’m a fan of the output of Audrey’s cookiecutter, and Flask in general :wink:

Keep digging, you’re on the correct path!

1 Like

No worries @andfanilo. Happy to take a look if someone else has something in this regard but I’ll also manage by myself. Always trying to optimise my workflows/ setups … :+1:t2:

Hey @cwerner,

I like OOP so I manage my streamlit projects like this, this has worked pretty well for me for a fairly big sized project. Also I like to keep my graphs separate in a in parallel to
Hope it helps ! :slight_smile:


Thanks @ash2shukla

This looks neat. Especially the page / session state logic… Is this more or less a wrapper/ convenience tooling around the SessionState hack or does this provide more features?

Its just a wrapper decorator because I didn’t like the idea of doing get_state and sync in main file, specially if you are working with some individuals who might find these lines unnecessary and might end up commenting them out eventually breaking your whole application. ( Happened with me :smiley:)