Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Thursday, May 27, 2010

An Experimental Twitter Clone with Rails

Let's make an experimental Twitter clone web app by Ruby on Rails version 3.

The minimum features of Twitter clone app are below:

  • A visitor can sign up and get an account to become a user
  • A user can post tweets
  • A visitor and a user can see another user's one single tweet or a sequence of tweets
  • A visitor and a user can see public timeline
  • A user can follow another user
  • A user can see "timeline" of the followings' tweets

I cut the following features for ease:

  • A user can see "mentions"
  • A user can leave (unfollow) others
  • A user can send or receive direct messages

But I also would want to add the following internal feature which the real Twitter seems to be using:

  • A timeline is not created just in time, but created when a user of the participants posted a tweet

This feature reduces the load time of reading a timeline.

So what's the difference?

  • It doesn't use any special software but just use Rails3
  • It doesn't use a relational DB for storing tweets
  • It is fast and scales (hopefully)

The Product "twi1"

I named it "twi1" without thinking anything. That's here. http://twi1.heroku.net/

Note that currently it doesn't work because heroku doesn't support writing a file. I should look for another way if I use heroku.

The below screenshots are on my local server.

User's timeline

Public timeline

The public/user timeline is stored as the below.