Where Should I Host My Single Page App?

If you are working on an MVP web app these days, chances are you are using a single page app (SPA) framework like Angular, React, or EmberJS. These frameworks are great for a lot of reasons, one being that you can typically host the front-end with just a static file webserver like NGINX or Apache.

Maintaining a webserver is still probably not the best use of your time when you are trying to get your MVP out the door, and hosting a SPA is a little more complex than just a static HTML site. There are a lot of shortcuts out there (such as using Amazon S3) and a few hosted platforms are emerging. Read on to see a comparison of the current solutions, and leave a comment if you know of any others!

Amazon S3 + Cloudfront
Ease of deployment Can be made to work well with grunt/gulp plugins
Avoids writing or maintaining a webserver Yes
Serves files using a CDN Yes
SSL on your own domain Yes
Supports pre-rendering for bots No
HTML5 pushState support Sorta, by making index.html the default 404 error page
Proxies backend to avoid CORS issues No
Price for a basic, production site Depends on traffic, but very cheap
Amazon S3 + MaxCDN
Ease of deployment Can be made to work well with grunt/gulp plugins
Avoids writing or maintaining a webserver Yes
Serves files using a CDN Yes
SSL on your own domain Yes
Supports pre-rendering for bots Not really. Possible to make Googlebot work with EdgeRules.
HTML5 pushState support Yes, and can fix 404 issue with EdgeRules.
Proxies backend to avoid CORS issues No
Price for a basic, production site $15/month + S3 charges (minimal). Call for EdgeRules pricing.
Firebase Hosting
Ease of deployment Has it's own deployment tools that support immutable deploys and rollbacks
Avoids writing or maintaining a webserver Yes
Serves files using a CDN Yes
SSL on your own domain Yes
Supports pre-rendering for bots No
HTML5 pushState support Yes
Proxies backend to avoid CORS issues No
Price for a basic, production site $5/month
Aerobatic
Ease of deployment Easy, git-push deploy using Bitbucket
Avoids writing or maintaining a webserver Yes
Serves files using a CDN Yes
SSL on your own domain Yes
Supports pre-rendering for bots No
HTML5 pushState support Yes
Proxies backend to avoid CORS issues Yes
Price for a basic, production site $10/month for 5 sites
Custom Server on Heroku
Ease of deployment Easy, git-push deploy
Avoids writing or maintaining a webserver No
Serves files using a CDN No
SSL on your own domain Yes
Supports pre-rendering for bots Possible
HTML5 pushState support Possible
Proxies backend to avoid CORS issues Possible
Price for a basic, production site $25/month + $20/month for SSL
Custom Server on Heroku + CloudFront
Ease of deployment Easy, git-push deploy
Avoids writing or maintaining a webserver No
Serves files using a CDN Yes
SSL on your own domain Yes
Supports pre-rendering for bots Potentially possible by adjusting caching based on User-Agent
HTML5 pushState support Possible
Proxies backend to avoid CORS issues Possible
Price for a basic, production site $25/month + traffic-based charges for CloudFront (very cheap)
Custom Server on Heroku + CloudFront
Ease of deployment Easy, git-push deploy
Avoids writing or maintaining a webserver No
Serves files using a CDN Yes
SSL on your own domain Yes
Supports pre-rendering for bots Possible with EdgeRules
HTML5 pushState support Possible
Proxies backend to avoid CORS issues Possible
Price for a basic, production site $25/month + MaxCDN charges (see Amazon + MaxCDN section)

So what’s my recommendation? If don’t need your app to be indexed on Google, show previews on Facebook’s Open Graph, or show cards on Twitter, both Firebase Hosting and Aerobatic are good options. In theory, Googlebot is starting to crawl SPAs, but in practice I have not had good luck with that. The other crawlers seem to be far behind Google, so you’ll likely need pre-rendered pages, anyway.

If you do need to support bots by serving pre-rendered HTML, you are unfortunately at a real loss. I think your best option in that case is to host your front-end on Heroku (using NGINX, Express, Hapi, or some other simple server), and use a service like Prerender.io to serve pre-rendered HTML to bots. See here for how you would set up Prerender.io using NGINX. Alternatively, you can let the Firebase Hosting guys know that you really want pre-rendering support in this PR.