Architecture guidelines for a “single page web-app”

I’m going to start a side project to build a “single page” web application. The application needs to be real-time, sending updates to the clients as changes happen.

Are there any good resources for best-practice approaches wrt the architecture for these kinds of applications. The best resource I’ve found so far is the trello architecture article here: http://blog.fogcreek.com/the-trello-tech-stack/

To me, this architecture, although very sexy, is probably over-engineered for my specific needs – although I do have similar requirements. I’m wondering if I need to bother with a sub/pub at the server side, could I not just push updates from the server when something happens (e.g. when the client sends an update to the server, write the update to the db, and then send an update to the clients).

Tech-wise, I’m probably looking to build this out in Node.JS or maybe Ruby, although the architecture guidelines should to some extent apply to any underlying server technologies.

I would definetly look towards client side MVC for this such as Backbone.js. It’s very lightweight but will give your application some much needed structure. I highly recommend the Peepcode screencast as the fastest way of learning more about Backbone.

A nice architectural benefit of client side MVC like this is the fact that you can more easily move towards exchanging data with your server side e.g. structured JSON over REST.

Backbone.js supports this out of the box – you can serialise your models between the client and server as JSON, which can free us from thinking in terms of request/response.

Something like Node.js on the server side appeals under this model where you will possibly have a lot of short lived potentially asynchronous requests to push and pull data.

One alternative…. A model like Comet can be a simple way to achieve web pub/sub and there are some server side frameworks that support this.

1

I would probably go with a MV* javascript framework for the front end. I myself am building a single page web application and after investigating a number of solutions, I ended up going with Backbone.js. I found while this solution did not provide the most out of the box functionality, it did provide me with a core foundation to start with and is a lot more flexible than other solutions I looked at (which was important to me).

Other popular solutions are Ember.js and Knockout.js which do provide more out of the box functionality however you have to follow their conventions to make use of thT functionality (which may or may not work for you).

This is a no brainer IMO. AngularJS for the front end because it’s awesome. NodeJS/express/SocketIO for a dynamic and sexy backend with pub/sub goodness and a minimum of fuss. And as a bonus, you can use one language for the front and the back!

Check out my implementation of same https://github.com/hackify/hackify-server for an example

One caveat, some folks are recommending a NodeJS alternative to socketio called sockjs but I haven’t checked this out so I can’t recommend it

Sounds like what you’re looking at is Apache 2.2 with PHP or Tomcat application server with a simple servlet which handles requests. It’s the carpenter’s equivalent of hammer and nails. Nothing complicated but it gets the job done. If you ever needed to expand functionality, you could always do so since Tomcat can support jsp and jsf if you ever needed it to.

For what concerns the front end, I’d be comfortable simply using jQuery ($.post, $.load, $.ajax) since it’s quite handy doubling as a means to add functionality to your page in combination with jQuery UI

If you want real-time client updates, then you will either have to implement the long-blocking “AJAX” calls, or preferably use the modern websockets. These allow you to push updates to a connected client which will be handled by a bit of javascript.

I understand the current state-of-the-art (or latest fad) is AngularJS by Google. Its partly designed to make writing SPAs easier.

If you want something close to the mean stack (node.js, mongo…) for building a single page application that needs to be reactive, I’d pick meteor. Especially if you are building a prototype and starting from scratch.

Rails with an angular frontend would be an ok choice imho, but you will have an harder time “sending updates to the clients as changes happen”, as you would need to install specific gems, string together some long-polling or sockjs library…

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật