I really love this talk by Mary Rose Cook — she illustrates step-by-step how to code a game loop from scratch in 30 minutes.
I only mention this because this comment primed me for a discussion about game engine design instead of game design.
And rishav_sharan is correct that it's nonetheless lovely, so thank you for linking it.
It's interesting that, being from 2014, it uses a lot of patterns that would be completely imprudent (though still possible) in modern post-2015 Javascript, so on a line-by-line basis more than half the lines are not how I would recommend doing this today, while the approach is still totally perfect.
Hard to believe, though, that that video has so few views/likes/comments, because she really nails it.