r/git • • 4d ago

We built a time tracker that uses Git as a database

We've been using Git for version control for years, but recently we decided to try something a bit different: using it as a database for our team's time tracker.

Instead of running a backend and a database, we built a browser extension that stores everything needed for team time tracking in a private GitHub repository.

Here's how it works:

  • Time entries are stored as plain JSONL files, grouped by month and user.
  • Each team member writes to their own branch.
  • Changes are saved locally and synced in the background.
  • Git gives us version history, data portability and a way to recover previous versions of our timesheets.
  • Reports and invoices are generated directly in the browser.

Our whole team at Manticore Search has been using it for about a month now, and so far it's been working well.

The project is called Clockoli. It's free and open source, with no application backend of its own.

Clockoli relies on the GitHub API, but there's no Clockoli backend, and we don't have access to your time entries.

What I like most about this approach is that even if Clockoli disappears tomorrow, your data is still there. You can clone the repo, inspect its history, analyze the data with your own scripts or build your own tools around it.

https://github.com/clockoli/clockoli

0 Upvotes

19 comments sorted by

10

u/DanLynch 4d ago

I admit I didn't study the code enough to know if you're using any GitHub-specific features, but why make this GitHub-specific? Why not support any Git vendor?

Your write-up seems to suggest you consider this tool "vendor neutral" and that it's a virtue, but it also seems like the user is locked into GitHub. Unless the documentation is just wrong about that.

10

u/Rschwoerer 4d ago

no vendor lock-in.

relies on the GitHub API

…

-8

u/snikolaev 4d ago

We started with GitHub because that's what our team uses. We rely quite heavily on its API for authentication, repository access, reading and writing files, managing branches, etc.

You're right that Clockoli itself currently depends on GitHub. What we mean by no vendor lock-in is that you're not locked into Clockoli. Your data is already in your repository, in a documented, human-readable format.

Supporting GitLab, Gitea or Forgejo would be nice, but we wanted to get it working well for our own team first.

4

u/remy_porter 3d ago

But if you did this in pure Git, you'd support them all for free. You don't need to use vendor APIs to store files in Git. That's what Git is for.

7

u/sock_dgram 4d ago

Even after reading the README, I have no idea what this is doing.

How does this interact with Git or Github? How does a repository look like if you use it? There's some talk about timers, but I'd imagine that you are not constantly committing timestamps.

-3

u/snikolaev 4d ago

No commits every second :)

The timer runs locally. When you start or stop it, the changes are saved locally and synced to GitHub in the background.

Each user has their own branch with a JSON file for the active timer and monthly JSONL files for completed time entries.

For team reports, it just reads the files from everyone's branches. No merging needed.

Here's the full data format if you're curious: https://github.com/Clockoli/clockoli/blob/main/docs/data-format-v1.md

4

u/sock_dgram 4d ago

This just sounds bad. There's a reason why most or all issue trackers are not version controlled in the repository they track. Issue tracking is kind of on top of the actual repository, referencing different branches at the same time. If you put some weird timer into the repo, even on a seperate branch, you'd logically have to track issue discussions too. But that's not something that should be in there, in my opinion.

2

u/snikolaev 4d ago

I think there's a misunderstanding here. We use a separate Git repository for time tracking, not the repositories containing the actual source code.

A time entry simply references a URL, which can point to an issue in any repository, a Jira ticket, or anything else. We don't store the issues themselves or their discussions.

Git is just our storage mechanism. The actual projects and their repositories remain untouched.

1

u/sock_dgram 4d ago

Sounds more reasonable.

I'm still not going to use it at work. We use something reliable, like Microsoft Teams, for this purpose ;-)

4

u/wildjokers 4d ago

I don't see any advantage to this over just using a database. The only thing a DB doesn't give you is "team member writes to their own branch" but that doesn't seem to offer any advantage over writing to a DB table.

Also, this requires github, not just git.

-4

u/snikolaev 4d ago

It's not that Git is a better database. The main benefit is that we don't need to run a backend at all. GitHub already gives us authentication, access control, storage and version history for free. And yes, it currently requires GitHub, not just Git.

2

u/wildjokers 4d ago edited 1d ago

The main benefit is that we don't need to run a backend at all.

But you probably already have a DB available that runs anyway right? This introduces vendor lock-in since it requires github. This doesn't really seem to fit this sub, they may enjoy it over in /r/github though.

9

u/efalk 4d ago

You'd be surprised what can be a database. I once saw a directory of zero-length files being used as a name=>timestamp database.

1

u/IamNotIntelligent69 3d ago

It'll be broken by a single touch -- ./{.*,*}, no?

1

u/efalk 2d ago

Yes, it depends on only the app accessing that directory.

2

u/cupcakeheavy 4d ago

this may be one of the first novel things i've seen in a while. While using the git-as-database is nice for this specific application, it would be good to see an abstraction (library) that can be used for other applications too. For example, this may be more interesting to some people who don't track time so granularly, but want more of a Jira-like project management approach. Using the git backend may be a good approach there too, and a separately maintained library could plug in to other use cases

1

u/snikolaev 4d ago

Thanks! I like the idea of extracting the storage layer into a separate library. There must be quite a few team tools that don't really need a traditional backend. A project management tool could be an interesting one.

2

u/wildjokers 4d ago

There must be quite a few team tools that don't really need a traditional backend.

FWIW, postgres has a json datatype and it also indexes json docs: https://www.postgresql.org/docs/current/datatype-json.html

0

u/cupcakeheavy 4d ago

i just made a very interesting query to the AI about what an ACID compliant git-as-database library would look like.