Tuesday, February 21, 2012

Hosting a Web-App on github in Seconds

We are in an age, where every possible data about civilization is packed into APIs, often for free. There are APIs, to access a complete city, to access your social life, to access addresses on earth, to access movies, to access music, to access books, to access a hosted database. And in no minutes, one could build an awesome Javascript/AJAX application mashing up any of the APIs.

So, like everyone, I too have created apps based on APIs. The problem for someone like me is to get it online. I don't normally write the apps for money or ads. I write it for the hell of it. I write it, if it can solve a quick problem and be helpful to others, I write it for the joy. And I am just a student, I can't afford to spend my money to host a simple index.html with JS and CSS in it, on a web-server, and pay money each month.

So I was in search for a place in the clouds to put my tiny file. I tried hosting the apps using Google App Engine and others. The problem here is PRE-configuring a kind of virtual space given to us. Often, this is time-taking than building the app itself. 

And then I discovered awesomeness of github. I already use github to host my code. It lets anyone in the world to download those files without any authentication. So the natural idea was how about github hosting that index.html as a website rather than as a file. Though I never actually knew before this, that there is such thing as github pages, it is too trivial an idea to not to pass through my head. I searched for github hosting, and had been lead to discover github pages. 

The most amazing thing about hosting on github is you can get your app running, literally in SECONDS. It is as easy as forking a repo.
> Create a repo named username.github.com
> Commit your website to a file named index.html and push it to the master
Within a maximum of ten minutes http://{username}.github.com magically shows your web-app live. You can even host multiple web-apps and point it your own domain. Check out this minimal documentation for using github pages to get your app live. And if you want more custom templates, there is an awesome tool called Jekyll written by github folks.
  
Now, does github go down, NOT more than 1.28 minutes in a day. Does github respond slower, NO. Does github charge money, NO. does it take hours to set it up, NO, shit, in a couple of seconds I say. So, how about hosting your weekend projects on github. Be careful about the code visibility. And I already started hosting my http://instamovi.com on github at http://sravfeyn.github.com. I am gonna point github to the domain once my amazing friend's VPS expires.