Static site vs dynamic web server
2024-06-05 12:48:00 +07:00 by Mark Smith
It's true that dynamic web servers are super cheap these days. So why not use one instead of rendering your website as static files?
Here are a few reasons off the top of my head:
- Easily move your site around, avoid lock in and price gouging, just pick up all your files and leave, everywhere supports static sites
- Long term stability, no npm installs that fail after years of not installing your site, no libraries out of date, no upgrades needed, your website is just files (see note below)
- Security, virtually no way to hack your site because there literally isn't any code that gets executed
- Automation and collaboration, Github powered workflows, since it's all just files, it's super easy to collaborate around a github repository, setup workflows using many available pre-built ones or create your own, your website isn't stuck inside a database, also great for automating pulling content from various sources and generating your website using static site generators
- Publish and work offline, if you manage your site using a version control system like Git, then you can always create new content, even if/when your internet connection gets cut off / goes down, just sync up when you are next online
- You can still integrate with dynamic servers if you need to for some things, use serverless function for example, or entire custom web servers, just put them on a subdomain, essentially you can mix and match
These would be the first things that spring to mind for me.
Full disclosure, I develop a static site generator, so I'm biased :)
Note: Ok yes if you use a static site generator it's possible that you could run into npm install / up upgrade issues. On the other hand, in an emergency, you literally can just pickup all your files, leave, and get them up online at a different host without any difficulty. So keeping your existing site online is much easier. You don't need to mess about with a database. Then you have time to fix any problems with the static site generator. #