DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Databases
  4. Chirper: twitter clone WebAPp with .NET front-end and Cassandra NoSql back-end

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

Chaker Nakhli user avatar by
Chaker Nakhli
·
Jan. 30, 12 · Interview
Like (0)
Save
Tweet
Share
6.65K Views

Join the DZone community and get the full member experience.

Join For Free

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.

Installation

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:

<Keyspaces>
 <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'/>
...
 </Keyspace>
</Keyspaces>


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.

Design


Front-end

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.

Back-end

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


Conclusion

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/

Database twitter Web application Clone (Java method) NoSQL

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Submit a Post to DZone
  • HTTP vs Messaging for Microservices Communications
  • The Path From APIs to Containers
  • How To Handle Secrets in Docker

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: