DEV Community

Cover image for I built a free, privacy-first WakaTime alternative (using Go & MongoDB) for VS Code & Neovim with Zero Latency
Rtarun3606k
Rtarun3606k

Posted on

I built a free, privacy-first WakaTime alternative (using Go & MongoDB) for VS Code & Neovim with Zero Latency

I built a free, privacy-first WakaTime alternative (using Go & MongoDB)

I admit it: I love coding stats (maybe sometimes).

There is something satisfying about seeing exactly how many hours I spent in VS Code this week, or realizing that my "quick script" actually took 4 hours of debugging.

For years, WakaTime has been the gold standard for this. It’s a great tool, but I had two problems:

  • Privacy: I wasn't comfortable sending my detailed file names and coding activity to a third-party server.
  • Cost: I wanted historical data (past 2 weeks) without paying a monthly subscription.

So, being a developer, I did the only logical thing: I spent 3 weeks building my own version.

Meet TakaTime.

TakaTime banner Image

It is an open-source extension for VS Code and Neovim that tracks your coding activity and syncs it to your own personal MongoDB.

The Architecture: Speed is Everything

My biggest fear was creating a plugin that slowed down my editor. Neovim users (myself included) are obsessed with speed. If saving a file takes even 100ms longer because of my plugin, it’s getting uninstalled.

To solve this, I used a Hybrid Architecture:

  • The Editor Plugin (Thin Client):

    • VS Code: A lightweight TypeScript extension.
    • Neovim: A pure Lua plugin.
  • Job: These plugins do almost nothing. They just detect a "Save" event or a "Keystroke" and pass a tiny message to a background process.

  • The Core (Heavy Lifter):

    • Written in Go (Golang).
    • It runs as a background binary process.
    • It handles the database connection, the caching, the debouncing, and the API calls.

Because the editors communicate with the Go binary asynchronously, the main thread is never blocked. You can mash :w or CTR+S (Save) as fast as you want, and your editor won't freeze.

High-Level Architecture TAKATIME

Zero-Latency Flow Takatime

The "Heartbeat" Logic

You can't just upload to the database every time you press a key. That would crash your network and spam your DB.

Instead, I implemented a Debounced Heartbeat system.

Event: You type code.

Cache: The Go binary records the timestamp and file name in memory.

Check: If the last upload for this file was less than 2 minutes ago, do nothing.

Upload: If it's been >2 minutes, push a "Heartbeat" to MongoDB.

This reduces database writes by 99% while still keeping your stats accurate.

The Stack: Why MongoDB Atlas?

I needed a database that was:

  • Free (forever).
  • Easy to access from anywhere (Cloud).
  • NoSQL (flexible schema for different file types).

MongoDB Atlas was the perfect fit. Their free tier offers 512MB of storage. Since text-based heartbeat data is tiny, that 512MB is enough to store years of coding history for a single user.

The best part? You own the data. I don't see it. You just paste your connection string into the plugin, and it talks directly to your cluster.

Setting it Up (It takes 2 mins)

I wanted the onboarding to be as smooth as possible.

1. For VS Code Users

I published the extension to the Marketplace. It automatically downloads the correct Go binary for your OS (Windows, Mac, or Linux) when you first install it.

Link : Download For VS Code

Vscode takatime demo

2. For Neovim Users

I built a Lazy.nvim compatible plugin.

return {
  "Rtarun3606k/taka-time.nvim",
  lazy = false,
  config = function()
    require("taka-time").setup()
  end,
}
Enter fullscreen mode Exit fullscreen mode

Link For neovim nvim takatime

result nvim

The Payoff: GitHub Profile Stats

Collecting data is useless if you can't see it.

I built a CLI tool (packaged with the binary) that generates a markdown report. You can run this using a GitHub Action to automatically update your Profile README every night.

Create the Workflow

Create a file in your repo at .github/workflows/takatime.yml and paste this content:



name: Update TakaTime Stats

on:
  schedule:
    - cron: "0 0 * * *" # Runs every midnight UTC
  workflow_dispatch:      # Allows manual trigger

jobs:
  update-readme:
    runs-on: ubuntu-latest
    permissions:
      contents: write # Needed to download releases

    steps:
      - name: Download Taka-Report Binary
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          # Downloads the latest stable binary
          gh release download --repo Rtarun3606k/TakaTime --pattern "taka-report-linux-amd64" --output taka-report
          chmod +x taka-report

      - name: Generate Report & Update Profile
        env:
          MONGO_URI: ${{ secrets.MONGO_URI }}
          GIST_TOKEN: ${{ github.token }}
          TARGET_REPO: ${{ github.repository }}
        run: ./taka-report -days=7
Enter fullscreen mode Exit fullscreen mode

It looks like this:

Result of github

What's Next?

This project was a massive learning experience in cross-platform systems engineering. And building this taught me more about processes, threads, and CI/CD than any lecture could.

The project is Open Source and I'd love your help!

  • Web Dashboard: I'm planning to build a React-based web dashboard to view historical trends.
  • More Editors: IntelliJ/JetBrains support is on the roadmap.

If you like the idea of owning your data, give it a try!

Repo: github.com/Rtarun3606k/TakaTime

Happy Coding!

Top comments (8)

Collapse
 
tarun_nayakarpesuecb profile image
TARUN NAYAKA R PESU-EC-B.Tech 2023 •

interesting, Finally, a privacy-focused alternative! I've been looking for something like this. Great work.

Collapse
 
rtarun3606k profile image
Rtarun3606k • • Edited

Thank you!! hope you enjoy using this

Collapse
 
sunil_kulkarni_d8ea0ed84b profile image
Sunil Kulkarni •

Great Project Tarun, what is the maximum dashboard time interval that it displays?

Collapse
 
rtarun3606k profile image
Rtarun3606k •

For now we can view up to yesterday, 7 days ,1 month , All time. In next version we will consider adding this feature thank you !!!

Collapse
 
microsoft_learnstudenta profile image
Microsoft Learn Student Ambassadors PESU •

How heavy is the background process? Does it consume a lot of RAM?

Collapse
 
rtarun3606k profile image
Rtarun3606k •

It's extremely lightweight! Since it's a compiled Go binary, it sits around <10MB RAM and only wakes up when you save.

Collapse
 
sujay_bhat_1f35fb460fb55f profile image
Sujay Bhat • • Edited

Does this work for other editors like IntelliJ or PyCharm yet? or just VS Code/Vim?

Collapse
 
rtarun3606k profile image
Rtarun3606k •

Right now just VS Code and Neovim, but JetBrains support is definitely on the roadmap! Let me know if you want to contribute.