MCPcopy Index your code
hub / github.com/muety/wakapi

github.com/muety/wakapi @2.17.4 sqlite

repository ↗ · DeepWiki ↗ · release 2.17.4 ↗
2,217 symbols 7,496 edges 303 files 148 documented · 7%
README

A minimalist, self-hosted WakaTime-compatible backend for coding statistics.

Website | Features | How to use | Issues | Contact

[!IMPORTANT] Due to limited time available on the maintainers' part, we temporarily do not accept pull requests. Please refrain from submitting contributions for the time being.

🚀 Features

  • ✅ Free and open-source
  • ✅ Built by developers for developers
  • ✅ Statistics for projects, languages, editors, hosts and operating systems
  • ✅ Badges
  • ✅ Weekly E-Mail reports
  • ✅ REST API
  • ✅ Partially compatible with WakaTime
  • ✅ WakaTime integration
  • ✅ Support for Prometheus exports
  • ✅ Lightning fast
  • ✅ Self-hosted

⌨️ How to use?

There are different options for how to use Wakapi, ranging from our hosted cloud service to self-hosting it. Regardless of which option choose, you will always have to do the client setup in addition.

☁️ Option 1: Use wakapi.dev

If you want to try out a free, hosted cloud service, all you need to do is create an account and then set up your client-side tooling (see below).

📦 Option 2: Quick-run a release

$ curl -L https://wakapi.dev/get | bash

🐳 Option 3: Use Docker

# Create a persistent volume
$ docker volume create wakapi-data

$ SALT="$(cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1)"

# Run the container
$ docker run -d \
  --init \
  -p 3000:3000 \
  -e "WAKAPI_PASSWORD_SALT=$SALT" \
  -v wakapi-data:/data \
  --name wakapi \
  --restart unless-stopped \
  ghcr.io/muety/wakapi:latest

Note: By default, SQLite is used as a database. To run Wakapi in Docker with MySQL or Postgres, see Dockerfile and config.default.yml for further options.

If you want to run Wakapi on Kubernetes, there is wakapi-helm-chart for quick and easy deployment.

Docker Compose

Alternatively, you can use Docker Compose for an even more straightforward deployment. See compose.yml for configuration details.

Wakapi supports Docker Secrets for the following variables: WAKAPI_PASSWORD_SALT, WAKAPI_DB_PASSWORD, WAKAPI_MAIL_SMTP_PASS. You can set these either by having them mounted as a secret file, or directly pass them as environment variables.

Example
export WAKAPI_PASSWORD_SALT=changeme
export WAKAPI_DB_PASSWORD=changeme
export WAKAPI_MAIL_SMTP_PASS=changeme

docker compose up -d

If you prefer to persist data in a local directory while using SQLite as the database, make sure to set the correct user option in the Docker Compose configuration to avoid permission issues.

🧑‍💻 Option 4: Compile and run from source

# Build and install
# Alternatively: go build -o wakapi
$ go install github.com/muety/wakapi@latest

# Get default config and customize
$ curl -o wakapi.yml https://raw.githubusercontent.com/muety/wakapi/master/config.default.yml
$ vi wakapi.yml

# Run it
$ ./wakapi -config wakapi.yml

Note: Check the comments in config.yml for best practices regarding security configuration and more.

💡 When running Wakapi standalone (without Docker), it is recommended to run it as a SystemD service.

💻 Client setup

Wakapi relies on the open-source WakaTime client tools. In order to collect statistics for Wakapi, you need to set them up.

  1. Set up WakaTime for your specific IDE or editor. Please refer to the respective plugin guide
  2. Edit your local ~/.wakatime.cfg file as follows.
[settings]

# Your Wakapi server URL or 'https://wakapi.dev/api' when using the cloud server
api_url = http://localhost:3000/api

# Your Wakapi API key (get it from the web interface after having created an account)
api_key = 406fe41f-6d69-4183-a4cc-121e0c524c2b

Optionally, you can set up a client-side proxy in addition.

WakaTime integration

You can use WakaTime and Wakapi in parallel, that is, have your coding activity tracked in both systems. This can be configured either on the client-side (preferred) on a system-wide- or per-project basis or using Wakapi's relay functionality (Settings → Integrations) to forward heartbeats to WakaTime.

Example:

[settings]
api_key = defaults-to-this-api-key-when-not-defined-below
[api_urls]
.* = https://wakapi.dev/api|wakapi-api-key
.* = https://api.wakatime.com/api/v1|waka-api-key

See wakatime-cli usage for details.

🔧 Configuration options

You can specify configuration options either via a config file (default: config.yml, customizable through the -c argument) or via environment variables. Here is an overview of all options.

YAML key / Env. variable Default Description
env /

ENVIRONMENT | dev | Whether to use development- or production settings | | app.leaderboard_enabled /

WAKAPI_LEADERBOARD_ENABLED | true | Whether to enable the public leaderboard | | app.leaderboard_scope /

WAKAPI_LEADERBOARD_SCOPE | 7_days | Aggregation interval for public leaderboard (see here for allowed values) | | app.leaderboard_generation_time /

WAKAPI_LEADERBOARD_GENERATION_TIME | 0 0 6 * * *,0 0 18 * * * | One or multiple times of day at which to re-calculate the leaderboard | | app.leaderboard_require_auth /

WAKAPI_LEADERBOARD_REQUIRE_AUTH | false | Restrict leaderboard access to logged in users only | | app.aggregation_time /

WAKAPI_AGGREGATION_TIME | 0 15 2 * * * | Time of day at which to periodically run summary generation for all users | | app.report_time_weekly /

WAKAPI_REPORT_TIME_WEEKLY | 0 0 18 * * 5 | Week day and time at which to send e-mail reports | | app.data_cleanup_time /

WAKAPI_DATA_CLEANUP_TIME | 0 0 6 * * 0 | When to perform data cleanup operations (see app.data_retention_months) | | app.optimize_database_time /

WAKAPI_OPTIMIZE_DATABASE_TIME | 0 0 8 1 * * | When to perform database vacuuming (SQLite, Postgres) or table optimization (MySQL) | | app.import_enabled /

WAKAPI_IMPORT_ENABLED | true | Whether data imports from WakaTime or other Wakapi instances are permitted | | app.import_batch_size /

WAKAPI_IMPORT_BATCH_SIZE | 50 | Size of batches of heartbeats to insert to the database during importing from external services | | app.import_backoff_min /

WAKAPI_IMPORT_BACKOFF_MIN | 5 | "Cooldown" period in minutes before user may attempt another data import | | app.import_max_rate /

WAKAPI_IMPORT_MAX_RATE | 24 | Minimum number of hours to wait after a successful data import before user may attempt another one | | app.import_hosts_whitelist /

WAKAPI_IMPORT_HOSTS_WHITELIST | - | List of whitelisted hostnames for data import (wildcards allowed, empty list means allow all) | | app.inactive_days /

WAKAPI_INACTIVE_DAYS | 7 | Number of days after which to consider a user inactive (only for metrics) | | app.heartbeat_max_age /

WAKAPI_HEARTBEAT_MAX_AGE | 4320h | Maximum acceptable age of a heartbeat (see ParseDuration) | | app.warm_caches /

WAKAPI_WARM_CACHES | true | Whether to perform some initial cache warming upon startup | | app.custom_languages | - | Map from file endings to language names | | app.avatar_url_template /

WAKAPI_AVATAR_URL_TEMPLATE | (see config.default.yml) | URL template for external user avatar images (e.g. from Dicebear or Gravatar) | | app.date_format /

WAKAPI_DATE_FORMAT | Mon, 02 Jan 2006 | Go time format strings to format human-readable date (see Time.Format) | | app.datetime_format /

WAKAPI_DATETIME_FORMAT | Mon, 02 Jan 2006 15:04 | Go time format strings to format human-readable datetime (see Time.Format) | | app.support_contact /

WAKAPI_SUPPORT_CONTACT | hostmaster@wakapi.dev | E-Mail address to display as a

Extension points exported contracts — how you extend this code

Handler (Interface)
(no doc) [31 implementers]
routes/handler.go
IDiagnosticsService (Interface)
(no doc) [9 implementers]
services/services.go
IDiagnosticsRepository (Interface)
(no doc) [13 implementers]
repositories/repositories.go
DataImporter (Interface)
(no doc) [3 implementers]
services/imports/importers.go
SendingService (Interface)
(no doc) [2 implementers]
services/mail/mail.go
AliasResolver (FuncType)
AliasResolver returns the alias of an Entity, given its original name. I.e., it returns Alias.Key, given an Alias.Value
models/alias.go
ProjectLabelReverseResolver (FuncType)
ProjectLabelReverseResolver returns all projects for a given label
models/project_label.go
Metric (Interface)
(no doc) [2 implementers]
models/metrics/metric.go

Core symbols most depended-on inside this repo

T
called by 602
models/shared.go
Get
called by 403
services/services.go
Add
called by 201
models/leaderboard.go
Log
called by 129
config/sentry.go
WriteHeader
called by 98
middlewares/logging.go
Request
called by 88
config/sentry.go
Set
called by 59
lib/concurrent_map.go
IsDev
called by 56
config/config.go

Shape

Method 1,369
Function 529
Struct 252
Interface 38
TypeAlias 20
FuncType 7
Class 2

Languages

Go96%
TypeScript2%
Python1%

Modules by API surface

services/services.go149 symbols
repositories/repositories.go119 symbols
config/config.go54 symbols
routes/settings.go41 symbols
models/summary.go41 symbols
models/user.go40 symbols
services/heartbeat.go38 symbols
routes/login_test.go37 symbols
services/user.go33 symbols
repositories/heartbeat.go28 symbols
mocks/user_service.go28 symbols
routes/webauthn_test.go26 symbols

Dependencies from manifests, versioned

codeberg.org/Codeberg/avatarsv1.0.0 · 1×
filippo.io/edwards25519v1.2.0 · 1×
github.com/KyleBanks/depthv1.2.1 · 1×
github.com/Marlliton/slogprettyv0.1.3 · 1×
github.com/ajstarks/svgov0.0.0-2021102423504 · 1×
github.com/alexedwards/argon2idv1.0.0 · 1×
github.com/alitto/pond/v2v2.7.1 · 1×
github.com/becheran/wildmatch-gov1.0.0 · 1×
github.com/cespare/xxhash/v2v2.3.0 · 1×

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add wakapi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact