
Show HN: Shunter – a Node.js application to read JSON and translate it into HTML - rowanmanning
https://github.com/nature/shunter
======
aikah
What problem does it solve ? is it XSLT for JSON ?

~~~
andrewmee
I don't see it solving one problem so much as lots of them.

With a decoupled front-end you can make applications which are much more
flexible for dealing with change. Imagine swapping out the entire backend
application, or completely re-writing the front-end - you can easily do either
since the integration between the two is formalised and documented by the json
contracts.

That also means a new front-end developer can clone down a Shunter application
and start modifying templates with confidence it's not going to break anything
without having to run the backend, services, mock db, etc. Great for working
in big teams, or ones that aren't co-located.

It can also run a single unified front-end across multiple backend
applications (for example if your rails application wants to share a common
layout etc. with your Wordpress-driven blog section, or whatever ecommerce
backend is driving your 'shop').

~~~
pcowans
In terms of a concrete example of what we actually use it for,
[http://www.nature.com/srep/](http://www.nature.com/srep/) is using Shunter,
as is
[http://www.nature.com/search?journal=srep&q=physics&subject=](http://www.nature.com/search?journal=srep&q=physics&subject=).
Behind the scenes they're completely different apps, but they use the same
implementation of the visual language so there's a consistent UI.

------
pavlov
After reading the docs, I'm still not quite sure what Shunter does.

I do understand the use scenario. I've done some sites with this same model
using Prismic.io as the backend. It's a nice customizable CMS-style system
that provides JSON APIs, which a Node.js app then translates into HTML
(basically just filling out templates with data selected from the JSON). This
has worked well and I've been really quite happy with Prismic.

So it looks like I could be using Shunter for this scenario, but I'm not sure
what the benefit would be over my hand-rolled Node apps. Can someone
illuminate?

~~~
dotcode
This probably indicates that we need to do a bit of work on our documentation
:) You're right about the general purpose - however Shunter also handles
front-end assets: images, CSS, and JavaScript, as well as making it easy to
extend the rendering engine.

In terms of benefits of using Shunter over a home-rolled solution, the same
question could/should be asked of any framework. Shunter is very well tested,
has been used in production on a large site for a number of years, and is used
to serve hundreds of thousands of requests. It will also be supported by a
large development team for the foreseeable future.

~~~
pavlov
Thanks! I'll keep it in mind and will try Shunter next time I do one of the
Prismic-backed sites.

~~~
dotcode
Cool - let us know if we can help in any way :)

------
fiatjaf
You put this in the front of your JSON API and BAM don't have to write
anything else?

~~~
rowanmanning
With small changes to the API, it's possible. Shunter requires a certain
`Content-Type` header to be sent in order to trigger the rendering process.
But largely yes, if your back-end can serve JSON already you should be able to
make it play well with Shunter quite easily

