Find file
Fetching contributors…
Cannot retrieve contributors at this time
170 lines (101 sloc) 6.39 KB

Sortis - A twitter client for power users, and a springboard for developers

Sortis is a twitter client for managing the tweets you've favorited. More importantly, it's a springboard to create your own twitter based applications (and learn tech along the way).

Tech: NodeJS, AngularJS, ExpressJS, Redis, Twitter Rest Api's

License: MIT

It's for developers

This app isn't deployed anywhere for use by the public. It is meant to be deployed by you, the developer. Sortis is a single user application that you can deploy to the NodeJS provider of your choice (I've included instructions for deploying to Nodejitsu and Heroku). You own the code and the data. Extend this app as you see fit. Make your own twitter mashups. Publish your code for others to learn, fork, extend and deploy.

Sortis can be set up freely on cloud based offerings and trial accounts. You can run this entire app locally too if you don't want to subscribe to any (potentially) for-pay services.

What Sortis does out of the box

I favorite quite a few tweets on twitter for different reasons. Things I want to read later, pairing sessions that I've scheduled, interesting projects that I've bookmarked...the list goes on. It suffices to say that the ability to just favorite a tweet wasn't enough anymore. Sortis, uses the tweets I've favorited as an "inbox" that I can then sort through, tag, search and archive.

Here is the inbox, this view uses Twitter's Rest Apis to retrieve tweets you've favorited:

Tweets can be sorted, tagged, and categorized. Once a tweet is sorted, the tweet is unfavorited from Twitter and stored entirely in your app (using Redis). Here is a screen shot of the sorted screen:

Instructions for deploying your own Sortis

Go to and install NodeJS

Go to and install Redis

Then clone this repo:

git clone

And cd into the directory (all instructions below assume you are in the sortis directory:

cd sortis

Run Locally

Using a command prompt where node is available, run the following command to install all Sortis dependencies:

npm install -g grunt
npm install -g grunt-cli
npm install (you may need to prefix this with sudo if you're on Mac/Linux)

Register for a Twitter developer account:

Under My Applications (, create a new application:

Set up the application with the following settings. Anywhere you see amirrajan, replace that with your own twitter handle:

Once your twitter account is set up, create a .env file by duplicating env.sample then update just the four Twitter-related values, plus the 'callBackUrl'. Here is the full .env file:


Here are the values you need to update:


Values are located on the detail page of Twitter:

Make sure the redis server is running, by running this command:


At this point you'll should be able to run the app locally:


To view the app, go to http://localhost:3000, the code has a lot of comments. Crack it open and read :-) (start with \server.js)

Running the app "in the cloud"

Securing the app with a two-phase auth

Given that this app is hard wired to your twitter account, it's best that you run the app with enableAuth set to true. With authorization enabled, you'll need to provide a password and an authorization code to access the site. If you get the password correct, a text message will be sent (via Twilio) to a mobile device you've specified in .env.

Register a free account with Twilio

Sign up with a free Twilio account:

Update your .env file:

password=[set a password (plain text)]
mobile=[this will be your mobile number example: +15555551234]
twilioAssignedPhoneNumber=[phone number twilio assigns you: +15555554240]
twilioAccountSid=[value provided by Twilio]
twilioAuthToken=[value provided by Twilio]

Values are located here and here:

Once you've set these values up, try running the app locally with authorization enabled. After entering your password, you should receive a text message on your devise.

Signing up and running Sortis on Heroku

From, click Documentation, then click the Getting Started button, then click Node.js from the list of options on the left...which will take you here:

Install Heroku toolbelt from here:

Sign up via the website (no credit card required).

Login using the command line tool:

heroku login

Create your heroku app:

heroku create

Add redis to your app

heroku addons:add redistogo:nano

The Redis connection in Heroku is provided by an enviornment variable process.env.REDISTOGO_URL

Git deploy your app:

git push heroku master

Set the environment variables on the server:

heroku config:set consumerKey=XXXXXXXXXXXXXXXX
heroku config:set consumerSecret=XXXXXXXXXXXXXXXX
heroku config:set accessToken=XXXXXXXXXXXXXXXX
heroku config:set accessTokenSecret=XXXXXXXXXXXXXXXX
heroku config:set callBackUrl=[root url for your heroku app]
heroku config:set password=XXXXXXXXXXXXXXXX
heroku config:set mobile=+15555555555
heroku config:set twilioAssignedPhoneNumber=+15555555555
heroku config:set twilioAccountSid=XXXXXXXXXXXXXXXX
heroku config:set twilioAuthToken=XXXXXXXXXXXXXXXX
heroku config:set enableAuth=false

Open the app (same as opening it in the browser):

heroku open

And your app should be up on Heroku.