The Stats Tracker API was a freelance project I undertook for a local browser-game development company.
To provide more in depth reporting to their customers they wanted a small client side library they could inject into their games that would track certain events; it would then send these events to an API which would present them to the end user via custom reports – so the project was broken down into 3 parts
API
An exposed API that would log the events from the game, this had to be versatile enough to accommodate data packets of various lengths and structures as the packet structure could not be identified until the event had begun to be processed
Administration Area
The owners of the Stats Tracker needed the ability to manage clients and games within the system. For this an administration area was created which would allow for the administrators to manage Clients, Games, Events for those games and define the parameters that those events would pass in. This would provide the foundation for the structure which the API packets would send.
Client Area
Clients using the system needed access to their own area with a locked down and limited view of their own products, but no more. As this was a multi-tenanted system it was vital that clients did not have access to other clients games or reporting.
The reporting section itself also needed to be able to provide custom views and timescales for the data collected and display it in a visual format. For this I made use of a charting library
Tech Stack
ASP .Net Core MVC
.Net Core as I’ve mentioned on this blog is incredibly versatile – and given the scope of the system I wanted more out the box than PHP provided. MVC provided a fantastic framework to build the API and accept packages and .Net Core Identity allowed the flexibility that was needed in order to build the Adminsitration and Clientside areas. Then because of the cross platform nature I knew that when the app was handed over it could be hosted anywhere. Razor syntax and view models also meant that web pages could be built with relative ease to serve the client facing system’s requirements.
Chart.Js
Chart JS is a free but powerful open source charting library making full use of HTML 5, although the documentation is lacking, Chart.Js can very easily be integrated into custom reporting to provide good looking visual graphs
Entity Framework
From the offset this project had very clear defined objects within the system. Entity Framework provides a fantastic interface between the database and the service layer of your system so that both the API and GUI can communicate with the database without needed to write the SQL yourself. However, in some cases with reporting I needed to write custom SQL in order to optimize queries, and EF allows this alongside it’s usual functionality.
MySQL
Not as bloated or expensive as SQL Server, MySQL provides a very clean straight forward and cheap alternative as a database provider; whats more is that there is Entity Framework support with MySQL so that it can be integrated easily into a Microsoft Tech Stack. Which means for the first time I was able to integrate MySQL with ASP .Net hosted on a Unix Server .
Recent Comments