Hakatime is a server implementation of Wakatime. It provides a single API endpoint
(/api/v1/users/current/heartbeats.bulk
) that the Wakatime client can use to send heartbeats containing info
about your coding activity.
It comes together with a simple dashboard which provides a graphical representation of the collected data.
- Total activity view.
- Per project activity view.
- User registration & login.
- Badge generation for a project (using shields.io compatible endpoint).
- API token management.
There is demo instance with fake data here.
Use demo
as username and demodemo
as password to login. You can create an API token and try sending your
data.
After you've generated a new API token from Hakatime's UI, update your ~/.wakatime.cfg
file like below:
[settings]
api_key=<generated_token>
# e.g api_url=https://hakatime-demo.mtx-dev.xyz/api/v1/users/current/heartbeats.bulk for the demo instance.
api_url=<hakatime_instance_url>/api/v1/users/current/heartbeats.bulk
The file's location might be different depending on your system and editor. Please consult the client docs for further information.
You can use the following docker-compose setup for testing locally or an actual
deployment. Change HAKA_CORS_URL
to match the actual external endpoint of your
instance.
NOTE: Deploying on ARM is also possible using mujx/hakatime:latest-arm64
for the arm64
architecture
(builds on every commit) or with mujx/hakatime:latest-arm
(manual semi-regular updates for arm/v7
& arm64
)
or by building the image yourself with the dedicated Dockerfile (Dockerfile.arm
).
version: "3"
services:
server:
container_name: hakatime
image: mujx/hakatime:latest
environment:
# DB settings.
HAKA_DB_HOST: haka_db
HAKA_DB_PORT: 5432
HAKA_DB_NAME: test
HAKA_DB_PASS: test
HAKA_DB_USER: test
# Server settings.
HAKA_CORS_URL: "http://localhost:8080"
HAKA_PORT: 8080
HAKA_SHIELDS_IO_URL: "https://img.shields.io"
HAKA_ENABLE_REGISTRATION: "true" # Toggle after you've created your account.
# Number of hours after which inactive browser sessions will expire (login required).
HAKA_SESSION_EXPIRY: "24"
ports:
- "127.0.0.1:8080:8080"
haka_db:
container_name: haka_db
image: postgres:11-alpine
environment:
POSTGRES_DB: test
POSTGRES_PASSWORD: test
POSTGRES_USER: test
volumes:
- ./docker/:/docker-entrypoint-initdb.d/
- deploy_db_data:/var/lib/postgresql/data
volumes:
deploy_db_data: {}
To start all the services run:
$ docker-compose -f ./docker-compose-deploy.yml up
and navigate to http://localhost:8080 to access the UI.
Requirements:
- GHC (tested with 8.8)
- libpq (for PostgreSQL bindings)
- cabal-install (If building with cabal)
Using nix requires the least amount of manual intervention (installing packages etc)
nix-build release.nix
cabal build
Requirements:
- Node.js
- npm / yarn
cd dashboard
npm install # yarn install
npm run prod # Optimized build for production usage.
npm run dev # Development server with hot reloading.
The server needs a database to store its data, so we will have to create a PostgreSQL instance and initialize
it with the schema found in the docker/ directory. You can use the provided solution using
docker-compose (docker-compose up -d
) or do it manually, depending on your system.
Start the server and point it to the database.
# We assume that the docker-compose setup is used.
# Change these values according to your actual setup.
export HAKA_DB_USER=test
export HAKA_DB_PASS=test
export HAKA_DB_NAME=test
export HAKA_DB_HOST=localhost
export HAKA_DB_PORT=5432
hakatime run
- Point your browser to http://localhost:8080
- Create a new user.
- Create an API token and set up your Wakatime client with it.
hakatime :: v0.1.0
Usage: hakatime COMMAND
Wakatime server implementation
Available options:
-h,--help Show this help text
Available commands:
create-token Create a new auth token
create-user Create a new user account
run Start the Server
Any kind of contribution is greatly appreciated. This could be:
- Bug fixes
- Suggesting/Implementing new features
- UI/UX improvements/suggestions
- Code refactoring