Over a million developers have joined DZone.

Chirper: twitter clone WebAPp with .NET front-end and Cassandra NoSql back-end

DZone 's Guide to

Chirper: twitter clone WebAPp with .NET front-end and Cassandra NoSql back-end

· Database Zone ·
Free Resource

Chirper is the first open-source non trivial web application example with .NET/NoSql integration. Chirper implements a simple twitter clone that, unlike twitter:P , uses Cassandra as its only database. It would’ve been probably cooler to code Chirper it in Ruby or in Python but, unfortunately, this is already done.

Chirper’s front-end is written in C# / Asp.net MVC 2.0. The back-end is based on Cassandra using the Aquiles library. The source code is freely available under the terms of the Apache License, Version 2.0.


Before going into Chirper’s design details in the next sections, you might want to play a bit with it first. For this, you will need to: (1) configure the database store with Chirper’s schema, and (2) setup Chirper in your favorite webserver that supports Asp.net.

Cassandra configuration

Simply edit Cassandra’s storage-conf.xml file and add a Chirper keyspace as follows:

 <Keyspace Name='Chirper'>
  <ColumnFamily Name='Users' CompareWith='UTF8Type'/>
  <ColumnFamily Name='Tweets' CompareWith='UTF8Type'/>
  <ColumnFamily Name='Following' CompareWith='UTF8Type'/>
  <ColumnFamily Name='Followers' CompareWith='UTF8Type'/>
  <ColumnFamily Name='TimeLine' CompareWith='UTF8Type'/>
  <ColumnFamily Name='UserLine' CompareWith='UTF8Type'/>

We will go through the data schema in more details below. If you don’t have already a Cassandra node at hand don’t worry, it’s easy to set up. Here is how I did.

Installing the webapp

Just download the Chirper’s latest binary and unzip it somewhere on your hard drive. From your webserver configuration console create a new webapp based on the unzipped Chirper folder. The exact webapp creation steps depend on your webserver. Here are the instructions for IIS7.

The alternative would be to check-out the source code and run (or debug) Chirper from visual studio, using the development web server.



Chirper is still work in progress. However, it has already the most important features: tweeting, following other users, displaying timeline and userline, dispalying followers list etc. The front-end is really simple, nothing much to say here. Here are the main components:

  • Two MVC controllers are handling all the user actions: one controller for authentication and registration (similar to the one presented here) and another controller for everything else. The views are kept very simple too.
  • The model consists essentially of two classes: User and Tweet. Follower and Following are just users with a time-stamp.
  • A repository class abstracts all the web application logic from the back-end operations. This is really helpful in case we might want to mock the db store for testing.


Chirper’s schema is really straightforward and very similar to the one implemented in Twissandra. Basically, we have two main families: Users and Tweets. Four other families are introduced to join theses main families in order to implement timelines and followers lists.

Users family

All Chirper users are recorded in this family. Rows are keyed by user name. Each column name/value represents a user’s property: Name, DisplayName, Location, Password etc.

Users Family

Tweets family

This family holds all Chirper tweets (or chirps :) ).  The rows are keyed by tweet id (a UUID). As for users, the columns represent the tweet properties.

Tweets family

Timeline and Userline families

A timeline (resp. userline) is simply a set of time-stamp/tweet id pairs held in rows keyed by user ids. The timestamps correspond to when the tweet was tweeted. In the userline family, the tweets are those tweeted by the user  used as row key. In the timeline family, the tweets are tweeted by the followed users.

User tweets family

Following and Followers families

The following (resp. followers) family joins users with their following (resp. followers) users.

User Following/Followers family


It was surprisingly easy to interface a .NET webapp with Cassandra. I had to write a few helper functions around the Aquiles connector but it did the job very well. Chirper’s schema is NOT designed to scale. It was kept very simple for the purpose of demonstration. I am currently looking for some help on Chirper’s web design, if you feel like contributing, please drop a comment here. It would also be nice to host a running instance of Chirper on the web (as Twissandra and Retwis do). If you can help on this please contact me.

Source: http://www.sinbadsoft.com/blog/chirper-twitter-clone-webapp-with-net-front-end-and-cassandra-nosql-back-end/


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}