I have a JSON API that includes some discusssions. I want to build a static html site on another server, pages that are built from data on that API. I am more comfortable using Rails than Node. The API is done in Node. The idea is that I periodically call the JSON api to get the data, and dynamically build the html pages on the Rails server. This way the web pages would be super fast, wouldn't have to call the JSON API. One technology that looks like it would do the job is http://middlemanapp.com/, but I haven't used it before.

Anybody done this before and have any suggestions?

My preference is to use Rails, and Heroku.

  • You can use persist connection from a client to server, i.e. so called websockets. Jan 9, 2014 at 10:39
  • care to eleborate @majioa?
    – kurtybot
    Jan 10, 2014 at 23:10

2 Answers 2


Your strategy sounds fine. Though, to be exact, you don't want Rails, which is framework for building dynamic web sites, you want static site generator that uses ruby. Middleman seems to be exactly that.

I don't have experience with Middleman, but I have used nanoc for the same job. It worked fine and got exactly the benefits you described.

Yet another choice would be Jekyll. It is used by Github Pages for example, which makes me think it probably has good community support.

Any of those should be fine for you. The best choice probably comes down to personal preference.

  • +1 so how would i serve the site and generate the static pages dynamically. heroku doesn't support file writing.
    – kurtybot
    Jan 10, 2014 at 23:09
  • I think I misunderstood you. Static site generators create static sites. Serving them would be super fast, because it's just serving files. On the downside, the site is updated only when generator is rerun. If Heroku doesn't support file writing, you really can't use this. If you only want to avoid querying the JSON API on every request, you can implement some caching.
    – simoraman
    Jan 11, 2014 at 11:09

The good replacement of the JSON could be the so called websockets, they allow you sending, and receiving the messages between client and server, or two client, or two servers in a persist connection. You can also read about it on Wiki.

There are set of websocket modules for ruby: em-websocket, faye-websocket, websocket. They utilizes useful Rack, EventMachine technoligies.

Here is a document on how to use the websocket on Heroku.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.