Return to Blog Home

Codewars API & Graphing

Source Live

Codewars API & Graphing

With a new Codewars A​PI, things get a lot more realtime!

Recently a new Codewars API for listing clan members was added, this allowed me to replace manually fetching each page of a users allies page - which only returned 15 users at a time - with this new endpoint, returning 100 users per request!

Aside from the obvious improvement from using a stable API endpoint that doesn't require a user to obtain credentials, this endpoint also had CORs support, allowing others to use this without having to create their own server.


Just in case though, my script still allowed users to fetch the stats using the allies page, and actually fell back to doing so if the API method failed or gets stuck in a loop of some kind.

Graphing

The last large feature that was missing from my Codewars Leaderboard Frontend was graphing, so after picking up Recharts, I implemented it primarly on the Leaderboard page, allowing the graph to be enabled - showing the top ten users by default, because showing all crashes every browser.

Now only was this nice to look at, but it also provided insight into users that didn't have data available at the beginning of a selected period.


I additionally added a mini graph to every Hall of Fame entry, showing the winners graphed accordingly.

Future

This was the last of the large features I desired from this, so aside from bug fixes and QOL improvments, I don't expect any large new features to be added.