Writing a “medium.com clone”

At the end of the last year we, at Linagora, decided to contribute to the Open Government Toolbox Hackathon with Open-PaaS project by providing a medium.com like platform where users can create articles, vote, launch discussions, … The current article shows how we built this new module by reusing the components provided by the Open-PaaS platform (named OP next).

At the heart of this new module, named linagora.esn.article, there are… articles! To keep it simple, an article contains a title, a body, can be commented, can be liked and users can vote with +1, 0, -1. Let’s go more into details now.

Building comments thread

When we started to develop OP almost three years ago, the first idea was about developing a so-called Enterprise Social Network (ESN), you know, Facebook, but for work. This meant mainly dealing with collaborations, ‘walls’, activity streams, comments, i.e. blah blah blah.

The first collaboration type we implemented was the community one. A community is an entity with a title, a description, a list of members and has a least an “activity stream”. The activity stream name is self explanatory: we record everything users are doing in this stream, then we are able to build and display the activity as a timeline. In the case of a community, the discussions between users are implemented using an activity stream. These are not standard discussions from newest to oldest like you can have in a messaging application, but this is an ‘intelligent’ display where old messages with newest responses are displayed before old messages with old responses for example (we can also imagine display a message with most likes first, etc.).

On the frontend side, this is ‘just’ using an Angular component (line 24 in the snippet below):

I like it!

As other resources in any good social network, an article may be liked. Here we reuse the like component already available in OP. To keep it simple, a like is a link of type ‘like’ between resources: a source (the user who likes the article) and a target (the article).
To be as generic as possible, we use Tuples. A Tuple has an id and a type:

User Tuple = {objectType: ‘esn.user’, id: ‘UserId’}
Article Tuple = {objectType: ‘esn.article’, id: ‘ArticleId’}

And so we are able to like anything in OP (in the screenshot above, we can like comments, of course).

Let’s vote!

What will be nice in a civic centric platform like the OGP one will be to be able to vote on article, because it is not really the same as liking something. Guess what? A vote is also a link of type ‘vote’ between a user and an article, but this one is pondered with a weight: A user can vote for (+1), against (-1) or “don’t care” (0. Which is better than nothing, well it is another debate…).

That’s it!

Building such new collaborative module with OpenPaaS for the OGP toolbox in just some days really shows the potential of the platform, its power of its core components and architecture.