These days data is ubiquitous, we generate loads of data each day, consciously and unconsciously.
I'm not the biggest fan of giving away my personal data, but I still like to analyze my spent time by tracking some stats. This also applies for my coding activity.
That's why I was looking for an open source tools which helps with tracking and analyzing my coding time.
I found a great open-source, privacy-friendly tool called Wakapi which can help with those tasks.
Wakapi
Wakapi is a Wakatime compatible open-source backend for collecting and visualizing coding statistics. It can be self-hosted fairly easily be running the provided Docker image.
The compatibility with Wakatime is a big bonus since Wakatime provides many plugins for data collection from your favorite IDE or text editor. I'm pretty sure you can find an integration for your most loved tool here.
Let's see how one can run Wakapi with Docker.
Running with Docker
First we will create a Docker volume to make sure our data is not lost when the container is stopped/removed:
docker volume create wakapi-data
To make sure user passwords are hashed properly we generate a salt:
SALT="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1)"
Then we run the Docker image:
docker run -d \
-p 3000:3000 \
-e "WAKAPI_PASSWORD_SALT=$SALT" \
-v wakapi-data:/data \
--name wakapi \
ghcr.io/muety/wakapi:latest
Source
Create account
After the Docker container is up and running, we need to create an admin account.
Navigate to your Wakapi frontend e.g. if run locally http://localhost:3000/login and sign up there.
The first registered account will become the admin account for this Wakapi instance. After you are logged in you can obtain your personal API key in the top right corner: (Don't worry the API key in the screenshot is from a local instance ;))
If you do not want any other users to create an account on your instance, you can set WAKAPI_ALLOW_SIGNUP
environment variable to false.
Configure the plugin
After the account creation is done, you need to install the Wakatime plugin for your desired IDE. Once the installation is done you need to configure it to use your own Wakapi instance by creating a config file under ~/.wakatime.cfg
with the following content:
[settings]
# Your Wakapi server URL
api_url = http://localhost:3000/api/heartbeat
# Wakapi API key, obtained from the web interface in the previous step
api_key = 406fe41f-6d69-4183-a4cc-121e0c524c2b
Analyze your activity
After the Wakatime plugin is configured properly, it should send data from your IDE/editor to your Wakapi backend where your statistics are waiting for you to be analyzed.
Wakapi provides filters for different time-windows and statistics for editor usage, time spent on projects, time spent coding in a certain language.
Wrap up
I think it is quite useful to visualize your coding activity. It provides insights into how you spend your days and might help optimizing your daily schedule.
Shout-out to Ferdinand Mtsch for creating this amazing open-source tool and thanks to Wakatime for open-sourcing their plugins.
Header image by Isaac Smith
Top comments (0)