And what few people know, is that Apple already had a platform where all of the “apps” were written with JavaScript + TVML (a proprietary Apple markup language) - the 3rd Gen AppleTV. If I’m not mistaken, you can still write apps for the ATV4 that way.
Plex was ported to the 3rd Gen AppleTV as an unofficial app just by running a server on your computer and redirecting DNS to it.