Search code examples
architecturehostingcdnrestful-architecture

General query regarding web application architecture, especially front end


Our application (initially accessible via web, later via mobile app and/or desktop apps) has an application server, which serves and internal API that'll be driven by all end points (React for web, iOS/Android for mobile in the future. etc). This application server will be accessible to those endpoints at app.<mydomain>.com - Currently this is implemented via a Django-REST-framework powered backend hosted on heroku.

We also have a landing page which will be served by www.<mydomain>.com.

My question is really about the server serving the landing page. Obviously it will be serving static content only, the landing page content, and the static react application JS that'll engage app.<mydomain>.com when it has to make requests and get data.

Obviously in this case I do not need a scripting engine on the backend. What do you recommend I use to serve up the landing page content and the static react app code? Simply apache server? anything else? Our app is U.S. only at this point, does it make sense to deploy via CloudFront or any other CDN?

I'd appreciate any advice.


Solution

  • Static content is best served by a fast http server. My personal preference is nginx because of its simple config and great performance but apache will do as well.
    It is as simple as uploading your htmls to the server. That being said, there are several things to keep in mind. Spend some time configuring cache headers for different file types. Automate the deployment process e.g. have Ansible deploy your web content after you push to repo, or turn it imto a docker container. This should be more then enough to handle many thousands of requests a day. If your scale is bigger, then CDN is a valid point of improvement along with scaling of your web servers and further improvements to caching and compression. Bonus point: your ngnix can also act as a very effective reverse proxy fronting your rest backend. You can easily setup load balancing and ssl - so that your rest can focus on just speedy business operation.
    Happy hacking.