selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

Hackatime logo

Self-host Hackatime

b35748e4b827c9a46543144a77957226d6620cf8

WakaTime-compatible coding time tracker

BetaOpen SourceMIT
Docker ComposeCompose file & guide
docker compose up -d
Updated6 days ago
LanguageRuby
Setup difficultyAdvanced
ThemeDark mode
Stars
216
Port
3000 (HTTP web server)
Requires
PostgreSQL
Docker
ghcr.io/hackclub/hackatime
Hackatime dashboard showing coding time tracking overview

What is Hackatime?

Hackatime is a free, open-source coding time tracker created by Hack Club as a privacy-focused alternative to WakaTime. It works with the existing WakaTime plugin ecosystem, supporting over 70 editors including VS Code, JetBrains IDEs, Vim, Neovim, and more. The tracker automatically records coding time when you type and stops during breaks, providing granular insights into languages, projects, and individual files. All data belongs to the user and can be exported as JSON at any time. The project offers a REST API compatible with the WakaTime specification, OAuth 2.0 for integrations, and features like leaderboards for members. It can be self-hosted using Docker Compose with PostgreSQL, giving users complete data sovereignty. The hosted version at hackatime.hackclub.com is free with no premium tiers.

Should you self-host Hackatime?

Hackatime scores 52/100 on selfhost.directory (how scoring works) and ranks #69 of 166 in Developer Tools. It has 216 GitHub stars.

There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.

Setup is advanced: plan for several services and some ongoing maintenance. An official Docker image is available. It is MIT-licensed and written mostly in Ruby.

Its closest alternative on selfhost.directory is ActivityWatch (80/100, 19 401 stars). It scores higher overall, so compare the two before you pick. See Hackatime vs ActivityWatch side by side.

Features

  • Automatic time tracking
  • Badges
  • Data Export
  • File-level insights
  • Language statistics
  • LeaderboardsMarked as 'coming soon' on the website
  • OAuth 2.0 provider
  • Plugin privacy settings
  • Privacy-first tracking
  • Project and GitHub integration
  • REST API
  • WakaTime API compatibility
  • WakaTime data import

Hackatime README

How to install Hackatime

Install Hackatime with Docker Compose

Docker and Docker Compose
Environment variables
DATABASE_URL, SECRET_KEY_BASE, ENCRYPTION_PRIMARY_KEY, ENCRYPTION_DETERMINISTIC_KEY, ENCRYPTION_KEY_DERIVATION_SALT, HCA_CLIENT_ID, HCA_CLIENT_SECRET, and many more (see .env.example)

Set it up...

$ git clone https://github.com/hackclub/hackatime && cd hackatime

Set your config

$ cp .env.example .env

Edit your .env file to include the following:

# Database configurations - these work with the Docker setup
DATABASE_URL=postgres://postgres:secureorpheus123@db:5432/app_development

# Generate these with `rails secret` or use these for development
SECRET_KEY_BASE=alallalalallalalallalalalladlalllalal
ENCRYPTION_PRIMARY_KEY=32characterrandomstring12345678901
ENCRYPTION_DETERMINISTIC_KEY=32characterrandomstring12345678902
ENCRYPTION_KEY_DERIVATION_SALT=16charssalt1234

Start the containers:

$ docker compose up -d
$ docker compose exec web /bin/bash

We'll now setup the database. In your container shell, run the following:

app# bin/rails db:create db:schema:load db:seed

Run the Vite build with SSR (server-side-rendering):

app# bin/vite build --ssr

Now, let's start up the app! Run this outside your container's shell:

app# bin/dev

You can now access the app at http://localhost:3000/

Development setup documented in DEVELOPMENT.md. Production deployment uses the Dockerfile with Kamal or manual docker build/run.

How to configure Hackatime

  • DATABASE_URLPostgreSQL connection URL

    PostgreSQL connection URL

  • ENCRYPTION_DETERMINISTIC_KEYDeterministic encryption key (32 characters)

    Deterministic encryption key (32 characters)

  • ENCRYPTION_KEY_DERIVATION_SALTKey derivation salt (16 characters)

    Key derivation salt (16 characters)

  • ENCRYPTION_PRIMARY_KEYPrimary encryption key (32 characters)

    Primary encryption key (32 characters)

  • GITHUB_CLIENT_IDGitHub OAuth client ID

    GitHub OAuth client ID

  • GITHUB_CLIENT_SECRETGitHub OAuth client secret

    GitHub OAuth client secret

  • HCA_CLIENT_IDHack Club Account OAuth client ID

    Hack Club Account OAuth client ID

  • HCA_CLIENT_SECRETHack Club Account OAuth client secret

    Hack Club Account OAuth client secret

  • HKA_REVOCATION_KEYKey for Revoker integration

    Key for Revoker integration

  • MAIL_HACKCLUB_TOKENHack Club mail token

    Hack Club mail token

  • MAXMIND_ACCOUNT_IDMaxMind account ID for GeoLite2

    MaxMind account ID for GeoLite2

  • MAXMIND_LICENSE_KEYMaxMind license key for GeoLite2

    MaxMind license key for GeoLite2

  • POOL_DATABASE_URLPgBouncer connection URL for connection pooling

    PgBouncer connection URL for connection pooling

  • POSTGRES_DBapp_developmentPostgreSQL database name

    PostgreSQL database name

  • POSTGRES_HOSTdbPostgreSQL host

    PostgreSQL host

  • POSTGRES_PASSWORDPostgreSQL password

    PostgreSQL password

  • POSTGRES_USERpostgresPostgreSQL username

    PostgreSQL username

  • PUBLIC_URLPublic URL for the portal service

    Public URL for the portal service

  • RAILS_ENVproductionRails environment (development/production)

    Rails environment (development/production)

    values: development, production, test

  • S3_ACCESS_KEY_IDS3/R2 access key ID for ActiveStorage

    S3/R2 access key ID for ActiveStorage

  • S3_BUCKETS3/R2 bucket name

    S3/R2 bucket name

  • S3_ENDPOINTS3/R2 endpoint URL (e.g., Cloudflare R2)

    S3/R2 endpoint URL (e.g., Cloudflare R2)

  • S3_SECRET_ACCESS_KEYS3/R2 secret access key

    S3/R2 secret access key

  • SAILORS_LOG_SLACK_SIGNING_SECRETSlack signing secret for Sailors' Log notifications

    Slack signing secret for Sailors' Log notifications

  • SECRET_KEY_BASERails secret key base for session encryption

    Rails secret key base for session encryption

  • SENTRY_DSNSentry DSN for error tracking

    Sentry DSN for error tracking

  • SKYLIGHT_AUTHENTICATIONSkylight authentication token for performance monitoring

    Skylight authentication token for performance monitoring

  • SLACK_CLIENT_IDSlack OAuth client ID for sign-in and profile status

    Slack OAuth client ID for sign-in and profile status

  • SLACK_CLIENT_SECRETSlack OAuth client secret

    Slack OAuth client secret

  • SLACK_SAILORS_LOG_BOT_OAUTH_TOKENSlack bot OAuth token for Sailors' Log

    Slack bot OAuth token for Sailors' Log

  • SLACK_SIGNING_SECRETSlack signing secret for request verification

    Slack signing secret for request verification

  • SLACK_USER_OAUTH_TOKENSlack user OAuth token

    Slack user OAuth token

  • SMTP_ADDRESSSMTP server address

    SMTP server address

  • SMTP_PASSWORDSMTP password

    SMTP password

  • SMTP_PORTSMTP server port

    SMTP server port

  • SMTP_USER_NAMESMTP username for outgoing emails

    SMTP username for outgoing emails

FAQ

Can I self-host this?

Yes, the entire codebase is open source on GitHub. You can spin up your own instance for complete data sovereignty.

Is my code private?

Hackatime only receives metadata (file names, project names, timestamps, language). It never sees your actual source code.

More in Time Tracking

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…