In this post I’ll show the internals I used during the development of Encestado that I think is worth sharing.
Encestado consisted in a sort of NBA manager. In the game you have a budget for choosing your NBA players for your lineup. Each week you receive points per each player depending on its performance in real NBA games. You could also compete with other users for achieving the top spot in the classification.
I no longer maintain Encestado because of lack of time, but it was a fun pet project that started in a Web Services class during my Master’s in Software Engineering.
Here I’ll share the tech stack I used for the development.
The most important thing was the game logs. Where do I get the data for every player performance during a game? The original idea was to scrap the data from Nba.com using Mechanize. I did a similar thing for retrieving players’ salaries from http://www.espn.com/nba/salaries:
But for the game logs I was lucky to find within NBA.com the JSON service they use internally. If you dig through the inspector in Chrome you’ll find some of the resources I needed for the app. For instance if you’re curious on how Dirk Nowitzki is doing here you could find the related info:
So that was it! I had everything I needed! I created some cron jobs (take a look at Whenever!) to run daily for updating the performance of every player. During one year I hadn’t had any problems (API limits, NBA realising I’m “stealing” their data, etc.)
With docker I had some issues though. When running some cron tasks the containers from docker weren’t being removed, and that was filling my space to the point I had filled my 20GB. So I’ve come up with an additional cron job to clean up the containers that had exited. Here you could see my cron jobs using Whenever:
I hope you enjoyed this and encourage you to build your own app. Happy Coding!