SUMMARY Today, I launched this website. Written in Rust with a focus on static error detection and handling. Read more about the techniques here.
2023-11-18 rust website type checking templates
Many web frameworks and web servers lack proper error detection. They defer error checking to run time, using dynamic typing. This is error-prone, as a developer has to check all page end points if errors can occur. I stumbled upon exactly this: changing some types, and as a result a template that was rarely used did not render properly anymore. No biggie normally, but this was the password reset page. So that turned out very inconvenient.
So what if doing all the checking dynamically (on page load), we would do all the checking of page data sources and templates statically? This implies during web server start, all data sources are checked, and all templates that are loaded are type checked. Once loaded, the guarantees are high that pages will not contain any template errors.
Using a newly written web server in Rust, I tried to achieve exactly this. Does that mean there will be no errors on the web server? The web server still contains a scripting module that is not tied into the type system of the remainder of the web server. Some typing errors can still occur there. And embedding templates in each other makes it hard to type check those embedded templates. Also, not all errors are related to typing. But I still hope that using this system I can produce sites easier, faster, and with fewer errors.
The website you are reading now is hosted on this new architecture. I also filled it with new content, so I hope you will enjoy the site.