In the early days of the internet all web pages were static: they displayed the same content to every user. Over time dynamic, database-backed websites emerged powered by programming languages like Python, Ruby, PHP, and Java emerged.

Today most websites are dynamic. If a site has a login system, accepts payments, forms or really interacts in any way with the user, then you are talking about a dynamic site.

But while most websites are dynamic, I’d argue the overwhelming majority don’t need to be: there are distinct disadvantages to running a dynamic website related to security, cost, and loading speed.

Here is a brief comparison of the pros and cons of static vs dynamic websites:

Static Website Pros:

  • fast—no lengthy load times when displaying the page
  • cheap—often cheaper to host static files on Netlify, S3, etc than a hosted environment
  • simpler for a developer to setup
  • easy to integrate forms, payments, login via API calls

Static Website Cons:

  • updates-requires a developer to update content, not a nice CMS as provided by WordPress and others

Dynamic Website Pros:

  • dynamic content generated for each user
  • easy to update with a CMS like Wordpress
  • more powerful with features like login, payments, etc.

Dynamic Website Cons:

  • expensive—setting up, maintaining, and scaling a database is costly
  • complex—much more steps involved to setup and deploy vs a static site

Toss Ups

  • security-a static site has no database of its own however if forms, payments, or logins are involved then 3rd party API calls must be used which have risk
  • page loading-static sites are generally faster however proper caching on a dynamic site as well as the use of CDNs can have a major impact on speed

In recent years, static site generators have emerged to bridge the gap between static and dynamic websites. Popular among developers (I’m using one to power this website), they have not crossed over into the mainstream.

A static site generator lets you build a powerful, server-based website locally on your computer but pre-builds the site into static files for deployment.

One advantage is developers can use dynamic templates which are extremely powerful. For example, with a dynamic template I can write the code for the footer (bottom part of the page) once and it will be inserted into all subsequent pages. On a static site, you must manually type the code into each page which is time-consuming, error-prone, and hard to update.

A growing number of third-party services are also emerging to provide static websites with dynamic-like functionality such as forms for collecting emails for newsletters, live messaging, search, comments, and more. The recent term JAMStack is now used to refer to static apps that use client-side JavaScript for dynamic website-like functionality.

The missing piece for static site generators to truly crossover into the mainstream is a CMS for non-developers, but there are several static CMS solutions available and more on the horizon.

In my opinion, it’s only a matter of time before static site generators take over. Web pages that are essentially static should be deployed as such; dynamic web pages should be reserved for the true cases where only truly dynamic solution will do.