We decided to invest heavily in Javascript and do away with creepy-uncle-PHP all together in favor of a pure Javascript frontend. That is, all user-facing code is ran in Javascript, in the browser (we're not using NodeJS or a Server side engine). Why?
- We didn't have enough developers to re-implement everything we do in Javascript (form validation, forms, bloody forms) in PHP. It took too long.
- We make a ton of mistakes. Undoing those mistakes was harder than it needed to be.
- Rapid development and testing of features was massively more important than browser support
- PHP was just talking via HTTP to a RESTish API anyway, and behaved like a shifty middleman.
- We had to have all browsers supporting Javascript to do anything useful. Given the proliferation of sites requiring Javascript, and our emphasis on early adopters the benefits outweigh the risk of a user using an old version of a browser or browsing without Javascript.
- Search engines were going to struggle with indexing us
- We had to deal with client-side caching of outdated Javascript
- Once we let go of server-side processing outside the API, development was much faster. This is important when users give feedback that you can factor into features.
- The deployable code boils down to a Javascript blob and some static HTML templates (mustache templates) and a nice, neat API.
- Cheap to serve. Theoretically, the site could be downloaded and ran locally. The major costs are all in providing the API.
The Future
In the future we want to allow search engines to index our Javascript application. This isn't as straight forward as it sounds (even with Google's Javascript indexing). You still need the backend infrastructure to respond to those requests.