- #1
- 4,509
- 2,835
I wrote this in response to a recent thread start here which is now deleted, but this is close enough to a common question that I don't think has been answered (recently) here, so here goes...
A variety of services exist to create websites such as Wordpress.com, Squarespace and Shopify where you do not have complete control over the site: these are out of scope here.
If you want to build a website where you have complete control of its content and functionality there are (at least) four distinct ways to do this relevant in 2023:
A variety of services exist to create websites such as Wordpress.com, Squarespace and Shopify where you do not have complete control over the site: these are out of scope here.
If you want to build a website where you have complete control of its content and functionality there are (at least) four distinct ways to do this relevant in 2023:
- A standalone single page application (SPA).
- As this runs in the browser it is written in JavaScript (or another language that compiles to JavaScript e.g. TypeScript).
- In 2023 most SPAs are written using a front-end framework such as React, Vue or Svelte, although very simple applications (typically those with little user input) can be hand coded.
- Searching can again be implemented by hand or handled by a library such as Fuse or Lunr. In either case this requires the whole search database to be downloaded by the user and is therefore only feasible for small databases.
- The website can be hosted at low cost on any web hosting service, and in many cases can be hosted for free using services such as GitHub Pages or Netlify.
- The solution can cheaply scale to millions of users using a content delivery network (CDN).
- Advantages: easy, cheap and performant.
- Disadvantages: limited to small amounts of data.
- A static web site.
- It is possible to create every page you want individually by hand or by using an editor such as Dreamweaver, but in 2023 this usually consists of multiple pages generated from templates.
- (JavaScript) code is only required for implementing things like searching and feedback forms.
- Most such sites are built by a static site generator such as Hugo, Gatsby, Jekyll or Eleventy which can run on your local computer and the files are then uploaded to a web host or CDN.
- Again the solution can be hosted at low cost and cheaply scale to millions of users using a CDN.
- For limited amounts of data, searching can again be implemented in the browser. For larger amounts of data a service such as Algolia can be used, however this does not scale cheaply.
- Advantages: easy, cheap and performant; can handle enormous amounts of data.
- Disadvantages: not suitable for significant amounts of user interaction (e.g. a shopping cart).
- A web server application.
- This runs on a web server and can be written in many languges including Python, Node JS, Java or Ruby, but the most accessible (due to the low cost of hosting services) is PHP.
- Open source applications can be used or adapted for many use cases, perhaps most significantly WordPress which is behind millions of websites and MediaWiki which powers Wikipedia (however note that both WordPress and MediaWiki come with a heavy technical debt and should be approached with caution).
- Because every user interaction requires a 'round trip' to the web server and rebuilding of the page in the browser from scratch performance can be slow, particularly for mobile devices.
- Whilst small numbers of users can be handled by a cheap web host, as usage increases the costs and technical support required increase.
- If the requirements are simple the code can be written from scratch: more complicated applications either use or adapt an existing application, or are based on a framework such as Laravel or Symfony (PHP), Django or Flask (Python), or Express (Node JS).
- Advantages: easy and cheap for relatively small numbers of visitors.
- Disadvantages: slower than other solutions; cost and support resource requirement escalate with larger numbers of visitors; security needs to be managed for any non-trivial user interactions.
- A modern API driven web application.
- In 2023, modern applications consist of a front-end application running in the user's browser communicating with a back-end server via an API (pronounced 'ay (as in say) pee eye').
- Decoupling the front and back ends provides a number of advantages including the near instant response of an SPA and the practically unlimited scalability of a web server. If you want to build the next Amazon or Google, this is the way to go, although it is still possible to start from scratch leveraging modern frameworks such as React or Vue for the front-end and Laravel for the back-end, hosted on a cheap web host.
- A decoupled back end means that you can also develop native applications for mobile devices.
- Third party APIs can easily be integrated such as FirebaseUI for user registration and login.
- Advantages: easy and cheap for relatively small numbers of visitors; easy integration of third party services; potentially high performance and unlimited scalability.
- Disadvantages: cost and support resource requirement escalate with larger numbers of visitors; security needs to be managed for any non-trivial user interactions.
Last edited: