My Google Reader alternative using windows azure mobile services. Part 1

I’ve been using RSS feed aggregators most of my life and have tried pretty much all available versions / flavors out there. I’ve started by using stand alone RSS aggregators with my favorite being feeddaemon but a couple of years back I decided to switch to Google Reader as I was tired of reading again and again the same stories every time I used a different device. Using Google Reader I was able to keep all my devices in sync and pick up where I left off whichever device I used. Plus there were a number of very cool and fast native windows 8/ windows mobile apps available for all my devices, that used Google Reader API. So I was able to store my feeds centrally but work with a native app locally on my laptop, desktop, tablet and phone. So you can understand my frustration when I learned that Google decided to retire the service.

Since then I’ve been trying to find an alternative, I visited most of the “The best Google reader alternatives” stories and tried most of the suggestions but I couldn’t really find what I was looking for. But most importantly, none of the alternatives could convince me that my data were safe and that what happened with Google wouldn’t happen with them as well. And then it struck me, why don’t I build something my self? and I did. Using Windows Azure Mobile Services I was able to build an RSS aggregation service in absolutely no time that I can literally use from any device out there. So in this series will show you how you can take advantage of most of the Windows Azure Mobile Services features to build your own Google Reader alternative.

Creating a Windows Azure Mobile Service

So first thing I did was to create a new WAMS called CloudReader. There are plenty of resources available on how to start your first Windows Azure account and create your first Windows Azure Mobile Service so I won’t go into much detail on that part and instead go ahead assuming that you’re pretty familiar on how to do that.

Data ModelGTakeout

Then I had to design my service data model. To do that I had to think about the kind of data I would store. In my case I wanted to implement the KISS principle so I’ve decided to only have 3 different data types

  • FeedGroup. Represents a folder/container of feeds that helps better organize my feeds
  • Feed. Represents the feed I’m following
  • Post. The posts I’ve downloaded and read.

Fortunately Google Reader allows you to export your data through the Google Takeout service, so I was able to see all the data Google is storing and have a better idea on what data I would use in my service.

Finally the model I came up with, looked something like this:

image

Now, building the data model any other way I would have had to use some db initialization SQL script or use SSMS (SQL Server Management Studio) to design my data model in the database and I would then have had to migrate the database to SQL Azure using some tool like for example SQL Azure Migration Wizard. Then I would have had to build some data access mechanism using Linq or Entity Framework, build repositories, implement IoC, dependency injection and write a bunch of server side code just to access the database let alone expose it as a service to my clients.

WAMS_DataUsing WAMS all I had to do was create three tables by going to the DATA tab and clicking the create table button at the bottom. Just by following the simple wizard not only I was able to create an initial database schema but also create the data access layer and expose everything through, an automatically generated by WAMS, rest service.

To Create the rest of the schema I had taken advantage of the dynamic schema feature WAMS offers. When dynamic schema is enabled on your mobile service, new columns are created automatically when JSON objects are sent to the mobile service by an insert or update operation. So all I had to do was to create a new CloudReader.Model portable class library (we’ll discuss the project type choice in a next part) where I introduced 3 POCO classes that corresponded to each of my table and when I my application was ready the insert operations on these objects would create the necessary db schema.

   1:  namespace CloudReader.Model
   2:  {
   3:      public class FeedGroup
   4:      {
   5:          public int Id { get; set; }
   6:          public string Text { get; set; }
   7:          public string Title { get; set; }
   8:      }
   9:  
  10:      public class Feed
  11:      {
  12:          public int Id { get; set; }
  13:          public int? FeedGroupId { get; set; }
  14:          public string Text { get; set; }
  15:          public string Title { get; set; }
  16:          public int FeedType { get; set; }
  17:          public string XmlUrl { get; set; }
  18:          public string HtmlUrl { get; set; }
  19:      }
  20:  
  21:      public class Post
  22:      {
  23:          public int Id { get; set; }
  24:          public int FeedId { get; set; }
  25:          public string Title { get; set; }
  26:          public string Link { get; set; }
  27:          public DateTime PubDate { get; set; }
  28:          public string Author { get; set; }
  29:          public string Description { get; set; }
  30:          public string Content { get; set; }
  31:          public int CommentsCount { get; set; }
  32:          public bool Stared { get; set; }
  33:          public bool IsRead { get; set; }
  34:      }
  35:  }

In the next part of this series I’m going to show you how to start your Google Reader client application that is going to consume your newly created service. For this post series I’m going to use a Windows 8 application as my client but building a windows mobile 8 client app is equally easy.