Single page applications · Web Development

Any recommendations/gotchas for building Single Page Applications (SPA)?

Valerie Lanard Senior Software Engineering Manager at Salesforce

September 8th, 2015

I'm in the process of building a Single Page App for the first time, and wondering if anyone can share what has worked well for you with SPAs (vs traditional multi-page apps) or any gotchas worth being aware of. Were there complexities you didn't expect? How did you handle SEO? Any best practices or recommendations you've come up with?  Thanks!

Rahul Architect Director of Architecture at Fidelity Investments

September 8th, 2015

SPA is the way to go today because of speed, availability of frameworks, ecosystem and community support. I would always lean to angularJS.
However SEO is a pain - (although it can be mitigated by phantomJS / Serverside cache technology) for SPA.

Anonymous

September 9th, 2015

@ Paul Cuciureanu:
I'm pretty sure Valerie Lanard can be her own CTO. Did you check out her background before writing that? Be careful with the biases.

Aleksandra Czajka Freelance Senior Software Engineer, Developer, Web Developer, Programmer - Full Stack

September 8th, 2015

Valerie,

Have you determined that your project specifically requires for your technology to be a one page app? If not, then there is no good reason to do it. If your functionality is really hefty, this single page will get too cumbersome and difficult to support. But it all depends on what your requirements are for the project.

Best,
Aleks

Troy Gardner Chief Technology Officer, Chief Brewing Officer at Cloud9 Brewing Systems

September 8th, 2015

It's easier these days with javascript advances like React.js and websockets, which can like a chat application (which is really what facebook is) change any element of the page at any time, deleting/rewriting anything. If you run javascript on the server (e.g. node.js) you can generate a full page on the server for non-javascript clients (search engine bots) then progressively enhance to fancy javascript for people on mobile/etc. For SEO detect the user agent and show whatever basic html optimized for seo.

Vincent Edwards

September 8th, 2015

I think a big gotcha is SEO.  If not done right, there's nothing for google to sink its teeth into.  Also, if not done on the right framework (javascript framework in particular) the code could get messy underneath.

Jeff Hoang

September 8th, 2015

I recommend you look into an isomorphic app using reactjs, nodejs and express. 

Rohit Paliwal COO @ Uvaca, Inc.

September 8th, 2015

Since you mentioned that you're already building a SPA, I'm going to assume that you have already done your due diligence regarding whether or not SPA is the best approach for you, else I'm with Aleksandra that just because SPAs are the flavor of the month does not mean that they are the best for your solution.

Having said that, SPAs do have some advantages especially if you're targeting both web (HTML) and mobile app solutions since you can build an API and front-end(s) are SPA and native app respectively. They also offer more seamless experience in many cases, but not always since your app becomes heavier. 

SEO is an issue. Isomorphic Reactjs is a potential solution, as is server side rendering via phantomjs just for SEO. However, you should also evaluate what parts/content you need SEO on and if your app can be split into server side rendered for SEO content, such as landing page and other free/static content, and SPA for non-SEO content such as post-user-authentication protected content, which will make SEO for SPA a non-issue.




Valerie Lanard Senior Software Engineering Manager at Salesforce

September 9th, 2015

Paul C, in the future you might want to check someone's bio before making an outdated gender assumption, speaking of keeping up.

Paul Cuciureanu Tech Lead at Ubisoft, Community Architect

September 9th, 2015

@Valerie, @Jonathan - I removed my comment

There was no gender bias - I'm surprised it got interpreted as such. Your CTO could most definitely be a woman

Good luck with your projects!

Mike Whitfield Sr. Software Engineer, EPAM, Google

September 9th, 2015

Keep this thread clean, please.  No one said a thing about gender.  You're just as likely to have been biased based on the general FD audience.  It's a little scary, and I think that kind of remark (even if as a casual joke about how tough it is to be a woman in software sometimes) discourages participation.  It says a lot about you as a businessperson and a potential leader, actually, so I'd recommend apologizing for degrading the integrity of what you're really trying to accomplish here for the sake of others (see Jonathan's piggyback).

I'm a millennial, so I'm more of an authority on the matter (see how dumb that sounds?), sheesh.