Hybrid architecture media server, media service and Streamlit client app using FastAPI and Python

Hi,

Media Explorer App GitHub Repo

I previously posted about a simple media server app. Well I re-implemented it!

Now I have something that (from a single codebase) can be deployed (1) locally or in Streamlit Cloud, or (2) with an embedded FastAPI image server, or (3) as a distributed app comprising a Streamlit client + remote FastAPI image server. It was an experiment to use some software architectural concepts to tidy up the original application and enable flexible deployments.

The image server capability isnโ€™t as important to me as the application structure, which I want to adopt in other apps Iโ€™m building or need to clean up because theyโ€™ve got too big and inflexible.

I hope some of you may learn a few things from this app in terms of application architecture and design, FastAPI (how easy it is!), using Streamlit forms, callbacks, session state including initializing and making widget values sticky between implicit and explicit reruns, custom styling/themes, controlling layout, and launching external threads and server processes from a Streamlit app.

Let me know what you thinkโ€ฆ shoot me a DM or post questions in GitHub.

Cheers,
Arvindra

5 Likes

This is so cool @asehmi ! Thank you for sharing this

2 Likes

ๅคชๆฃ’ไบ†่€ๅ…„

1 Like

Interesting. what is the role of Media service adapter and adapter factory? Are these libraries typically used to connect when ever we want to use FastAPI?

The adapter factory allows the media client to connect to the media service in multiple different ways providing different deployment options to suit your use case (1. monolithic front end app + service, 2. front end app + embedded server/service API, and 3. front end app + remote server/service API). The diagram explains this.