sdrplay-fm-radio/docs/architecture.md

1.8 KiB

Microservice architecture

A bit of an oxymoron isn't it? If it needs an architecture diagram to explain it then how micro can it be? The reality is that this microservice is actually several smaller services in a trenchcoat pretending to be one thing. I suppose that makes it just a service.

flowchart TB
    subgraph microservice["✌ 'Microservice' ✌"]
        subgraph rest[REST Interface]
            flask[Flask]
            swag[flasgger]
            flask-->swag
            swag-->swaggerui[Swagger UI]
        end

        subgraph hw[Hardware Interface]
            soapy[SoapySDR]
            subgraph plugins[Vendor Plugins]
                soapysdrplay[SoapySDRPlay]
                soapyrtlsdr[SoapyRTLSDR]
            end
            soapy<-->plugins
        end

        flask<-->soapy

        subgraph radio[DSP Chain]
            demod[fm_demod.py]
            ffmpeg
        end
        mediamtx["RTSP Relay\n(MediaMTX)"]

        plugins-->|IQ samples|demod
        demod-->|PCM audio|ffmpeg
        ffmpeg-->|RTP stream|mediamtx

        subgraph proxy[Reverse Proxy]
            caddy[Caddy]
            l4[Caddy Layer 4 Plugin]
            %%le[Let's Encrypt]
            style l4 stroke-dasharray: 3 3,opacity: 0.5
            caddy-.->l4
            %%le-->caddy
        end

        flask<-->|HTTP:5000|caddy
        swaggerui<-->|HTTP:5000|caddy
        mediamtx-.->|RTSP:8554|l4
    end
    style microservice opacity: 0.2

    %%rtlsdr[RTL-SDR Driver]-->soapyrtlsdr
    %%sdrplay[SDRPlay Driver]-->soapysdrplay

    subgraph client[Client]
        control["REST Client\n(Browser)"]
        rtsp["RTSP Renderer\n(VLC)"]
    end
    style client opacity: 0.2

    caddy<-->|HTTPS:443|control
    l4-.->|RTSPS|rtsp
    mediamtx-->|RTSP:8554|rtsp