gitgeist: a git-based social network proof of concept


Are you tired of not owning the data or the platform you use for social postings? I know I am.

It's hard to say when I "first" used a social network. I've been on email for about 30 years and one of the early ad-hoc forms of social networks were chain emails. Over the years I was asked to join all sorts of "social" things such as IRC, ICQ, Skype, MSN Messenger, etc. and eventually things like Orkut, MySpace, Facebook, etc. I'll readily admit that I'm not the type of person that happily jumps onto every new social bandwagon that appears on the Internet. I often prefer preserving the quietness of my own thoughts. That, though, hasn't stopped me from finding some meaningfulness participating in Twitter, Facebook, LinkedIn and more recently Google+. Twitter was in fact the first social network that I truly embraced. And it would've remained my primary social network had they not killed their own community by culling the swell of independently-developed Twitter clients that existed. That and their increased control of their API effectively made me look for something else. Right around that time Google+ was being introduced and many in the open source community started participating in that, in some ways to find a fresh place where techies can aggregate away from the noise and sometimes over-the-top nature of Facebook. Eventually I took to that too and started using G+ as my primary social network. That is, until Google recently decided to pull the plug on G+.

While Google+ might not have represented a success for Google, it had become a good place for sharing information among the technically-inclined. As such, I found it quite useful for learning and hearing about new things in my field. Soon-to-be-former users of G+ have gone in all sorts of directions. Some have adopted a "c'mon guys, get over it, Facebook is the spot" attitude, others have adopted things like Mastodon, others have fallen back to their existing IDs on Twitter, and yet others, like me, are still looking.

At this point, I'd be about switching to my 3rd social network and, quite frankly, I'm tired of this game. Despite all the mainstream media broohaha about the security lapses and data abuses of the better known social networks, the fact of the matter is that the general public doesn't actually care about security. And neither do most players in the industry in fact, unless there's a dollar sign at the end of a liability line. [disclaimer: the author apologizes for being jaded about this topic for having led a crypto startup for a few years in the mid-2000s.] Personally, I consider anything happening a social network as public. Any mining, analyses, abuse, etc. is something I assume is happening from the get-go. So, for me, the security and privacy issues don't matter much.

What I do care about, though, is my time. I don't like investing time in a platform only to find out that the entity that's managing it somehow eventually decided it's going to mess with it sufficiently to effectively destroy the benefits I've been deriving from and value I've been feeding into a social network stream and tree running on their platform. This has now happened to me with both Twitter and Google+. So when I see ex-G+'ers advocating moving to Facebook, going back to Twitter or moving on to Mastodon I despair. Seriously, pouring more time into something someone else manages? Again? Oh sure, I get that I can roll out my own Mastodon instance, but who wants to manage yet another type of server or depend on someone else's server or their federation infrastructure? I don't.

Which is what got me thinking about what I'd see myself using. And the more I thought about it, the more I thought that I, and the vast majority of other like-minded people, are already using something that can quite readily give us a social network practically for free: git. Yes, git, the distributed source management tool.

It turns out that git has practically everything that's needed to act both as storage and protocol for a social network. Not only that, but it's very well-known within and used, deployed and maintained in the circles I navigate, it scales very well (see github), it's used for critical infrastructure (see kernel.org), it provides history, it's distributed by nature, etc. It's got *almost* everything, but not quite everything needed.

So what's missing from git? A few basic things that it turns out aren't very hard to take care of: ability to "follow", getting followee notifications, "commenting" and an interface for viewing feeds. And instead of writing a whole online treatise of how this could be done, I asked my colleague Francois-Denis Gonthier to implement a proof and concept of this that we called "gitgeist" and just published on github [https://github.com/opersys/gitgeist-poc].

Our implementation doesn't claim *any* sort of technical merit. It's in fact a quick and dirty "don't look at the baby" implementation. We knew while working on it that we were taking several shortcuts and that a clean implementation would probably require starting back from a clean slate. But, it proves the point that: 1) git can be used as the basis of a distributed social network, and 2) it's realitively trivial to do so.

gitgeist's basic principle is that I run a git repo comprising some git-hooks-enabled scripts, an associated GPG key and a node.js instance. Posts get added to the git repo as indepedent directories, preferably numbered in the historical order of appearance in the poster's feed ("00001-first-post/", "00002-second-post/", etc.) Each directory has a markdown file with the post's content along with a possible "comments/" directory for the comments posted on the post. On instantiation, the public (cloud-accessible) repo is associated with a key used to sign new posts. A git hook insures only properly-signed "posts" can get added.

Most interestingly, though, there's a topmost "following" file containing a list of feeds being followed: effectively other gitgeist repo URLs. When that file is commited, a git hook contacts the remote gitgeist's node.js instance and informs it that it wants to "follow" it. The remote instance checks that this request is properly signed by the original gitgeist instance and, if so, adds the requestor to the followers list. When a new post is added to a gitgeist instance, the corresponding git hook script pings back the follower list instances' node.js servers to notify them that an update was made. The receiving gitgeist instances then resync their copy of the followee's tree.

In this scheme, my gitgeist instance enables me to push my content to others and receive a copy of the content pushed by others to their own gitgeist instances. Should any node in this disappear, I still have my copy of that node's past content. Every instance continues to exist regardless of the rest of the network. The entire network could in fact disappear and I'd still have a copy of the content that I had access to in the past.

To better view the content I get, each gitgeist's node.js instance provides a "private" web page accessible only by the owner of the node that enables them to have access to *their* view of the social network. Through this page, I can access the feeds of all gitgeist instances I'm following. Note that my gitgeist instance doesn't actually serve those 3rd party gitgeist copies back to anyone else. My gitgeist instance just shares my own posts, while still serving as my personal copy of everyone else's posts.

We also added a basic commenting mechanism for appending comments to others' posts. Effectively, posting a comment involves adding a file to the "comments/" directory underneath a post's top-level directory. Presently, posting a comment requires having previously successfully subscribed to a gitgeist instance's feed; because comments are checked for signature before being allowed. But that's just an "ugly baby" implementation detail. We don't generally like the idea of actually pushing to others' git repos directly but it was just easy to implement. Ideally there would be some sort of POST message sent to the node.js instance and/or some sort of OAuth authentication with 3rd party ID providers, including possibly the existing social network providers.

The GUI of the private view of followed feeds is also very basic and bland. Comments, for example, are posted in filesystem order (yuck). There's likely much work to do here in terms of interface design to get a presentation that's more broadly acceptable. There's also some thought that needs to be put in how to organize meta-data and enable other interactions than comments such as "+1"s, "Likes", etc. Further down the road, the whole interface to git itself could be abstracted and users could directly use a web interface and mobile apps to transparently interact with the underlying gitgeist instance.

Again, the present gitgeist implementation is but a proof of concept and we wouldn't recommend rolling this out as-is. What we do want, though, is feedback; the blunt flavor in as much as possible. Is this approach something you'd see yourself using? If so, what suggestions would you have? Would you be interested in helping develop this? etc. To be quite honest, we're not exactly sure how to justify our time working on this. We did it because we thought it needed to be shown, and we're happy to look at taking it further and working with others to do a clean implementation, but, shall we say, we're not seeing the IPO route just yet ;)

Obviously the idea of a distributed data pub-sub model isn't new. Tim Berners-Lee's ongoing Solid work comes to mind as an attempt towards user-centric data ownership by having each user deploy a "pod" of their own. I have no reason to criticize this work or approach and haven't investigated it any further than reading an article or two about it. The approach we took here is to look for existing widely-used technologies and see if we could duct-tape a basic system on top of them. As it turns out, much of what's needed seemed to be already there.

Hopefully putting our work out there is of some use in some quarters. I, for one, would definitely see myself adopting this as my next social platform. If nothing else because I could see it as being my "last" social platform move. A move to something I totally own and control and that doesn't depend on any 3rd party's good will, interest, honesty, consistency, etc. to maintain. Now, let's see if there's a bigger crowd than one for this.