Spartan Stats is my first real open source project that I’m releasing. It is a web app which allows you to track a basketball teams stats in real time and has a live view for authorized visitors to see game stats and scores.
This was an idea that came about near the beginning of Covid. Once things started to start up again my sons basketball team which I help coach was allowed to have games, but there were no spectators.
We tried live streaming some games and that worked ok but internet wasn’t always good and other challenges. Around the same time one of the coaches started keeping track of our players stats during games on a sheet of paper. I thought it would be great to have a solution which we could use to capture stats and show people who couldn’t be at the game what was happening.
It wasn’t until this past December though that I finally started to work on it. I had been going through some career changes and life changes all at the same time so never felt like I had the time to dedicate to a side project. When I went on Parental leave it felt like a perfect time. I felt more comfortable in my new role at work, things were settling down at home, and I had some more time.
Things were slow at first as I was learning new things to set things up. After talking with some people I decided to use Google Firebase as the database as it includes a lot of what I was looking for. After I had a decent start I ended up not working on it again for a while, or just slowly making little additions or changes. More recently I spent some more time at night and on weekends getting most of the main functionality working.
This past weekend Noah’s team had our Provincial Tournament it felt like a great time to try things out and see how it works in its intended use. For the first two games I didn’t share with anyone except my wife Jen and that helped uncover some bugs, but for the most part things worked well and my stats matched what the other coach had on paper. So the next day I shared the link with our parent group and some of them were able to follow along as the game was happening.
It’s a private system so people need to sign up and then be approved before they can see anything. Most people end up with the role of Visitor. Some like coaches who will be entering stats can have the role of Statistician. There is also an Admin role to approve new users and manage peoples roles.
Once signed in visitors can see a list of seasons and then the games recorded for those seasons. Each game has the game score, box score with the player and team average stats, and a play by play view that has a timeline of events that took place during the game.
Entering stats is pretty easy. Players are listed out, you click on the one who did something and then click a button for what they did.
If any one is interested there is also a limited functionality demo version set up at https://demo.spartanstats.com you can log in with the email
firstname.lastname@example.org and password
You can view and download the code used from spartanstats.com
There is still work to be done but the basics are there. I’m excited about this and it will be something I can be continually working on to add or improve things and learn along the way.
I hope that along the way it is also maybe helpful to other people. I found it hard to find good examples of using some of the features of Firebase, like setting up a role based authentication system. I may post some follow up posts explaining my approach and code to make this all work.
I’d be really interested in hearing from people who find this useful either in using it or just as an example Firebase app.