Made something similar to this a while ago (albeit, a lot simpler, replaces transfer.sh for me, and is self-hosted: https://github.com/antoniomika/Sharer). Mine is based on Firepad (https://firepad.io/) but both use Firebase as the underlying data source/RTDB.