19 comments

[ 3.3 ms ] story [ 38.6 ms ] thread
(comment deleted)
I have a side project where I want to figure out how to host a database on github. If there was a javascript API for doing git business on github, then could just update the database to and fro. It would be messy of course but it wouldn't matter. Because you would have a dynamic app up on github for free (or 7/month if you wanted your secret sauce to stay secret).
Just speculating, but could you update an SQLite DB with JS and use an API to commit the change? Or would that be ineffective since the API keys would be publicly available? I'm assuming the db access would be infrequent, like a blog that used Disqus for comments.
GitHub's API can do low-level modifications of git repositories. It probably supports JSONP.
Not sure if you meant having an HTML/JS app served from GitHub with database capabilities, but maybe you'd want to check out something like StackMob? (Disclaimer, I work at StackMob, but appearing here as a fellow developer)

You can commit your HTML/JS files to GitHub and StackMob will serve those pages for you via the GitHub integration StackMob has. What that enables you to do is actually use StackMob's REST API for its backend services (datastore, versioning, custom server side code) via AJAX since there's no cross-domain AJAX problems (pages and ajax calls are going to/from your stackmob.com hosted pages)

I use it to host my fiancee and I's wedding site and I use the datastore to hold guest information, people can register/login etc. The data is stored on Stackmob via the AJAX calls by using the JS SDK StackMob provides.

Example javascript:

var user = new StackMob.User({ username: 'asdf', password: 'asdf', acquaintance: 'bride', ...}); user.create(); //this fires off the ajax call to StackMob and saves your data in the datastore on that end.

It's free at a certain usage level (I'd imagine your personal use would be within the free threshold) if you wanted to give it a go.

https://www.stackmob.com/devcenter/docs/StackMob-Hosted-HTML...

Is it sustainable for GitHub to host (static) sites for free?
Github already hosts lot of code and allows free downloads. By hosting a static site, we essentially are hosting an HTML file which can be downloaded. Unless the site is of very High traffic, it is already sustainable for Github.Consider for example the amount of users who download Bootstrap from Github everyday.
re: high traffic. A buddy and I hosted the static parts of our privacy activism page youropenbook on github pages (it was initially all static). This was during the privacy scandal of spring 2010 and as our traffic really ramped up we sent a message to the github folks to see if they minded at all.

They gave the go ahead.

We served millions of pageviews, had a significant impact on the debate at the time, and github pages took it like a champ.

Do people basically hotlink the Bootstrap CSS, for example? I just presumed most fork it into their own project (or, say as a submodule) and then host it on their own server.
This will effectively limit you to making requests to services that provide an API that supports JSONP. If you're going to do something like this, why not just use Heroku or something similar? Unless you're relying solely on external APIs, you're going to need some server space sooner or later.

Github is good for static pages, like blogs, but I don't think a web application will work that well.

If you're willing to limit yourself to browsers that support CORS it's not an issue. I would personally get a VPS from prgmr.com but for an experiment GitHub is fine.
I moved my blog to it some time ago and it's been excellent so far. I do kind of think this is out of scope for GitHub, and will probably move to S3 at some point.

I did switch from Jekyll to Octopress though (Octopress is a nice framework around Jekyll that automates the annoying manual bits involved with Jekyll). So far it's been great though!

If you have written a JavaScript library and it's hosted on GitHub, I wonder if you can somehow include the `master` branch in your `gh-pages` branch as a submodule. Do you get me? If the core repo is clean JS, but where your demo site might want to include that JS, plus some extra pages.
this is github pages. it is neither new nor unknown. move along please.

first four paragraphs are a personal anecdote, and the last 2 are a regurgitation of the official github pages documentation, which the author links to.