cserver
30 DEC 2023
Because node_modules
is huge. It's incredibly, unreasonably, unbelievably huge. Recently, I discovered a simple project—a small web API based on the koa framework and the PostgreSQL database—it contained 242 items in the node_modules
folder, and all that was for a tiny web service, nothing more than a couple of endpoints. These 242 folders with I-don't-know-how-many files are read every time the website starts, with an insane amount of code being executed while the service runs on the V8 JavaScript engine, translated into real CPU instructions.
And this very website used to run on Node.js, too: 35 folders in node_modules
containing 1739 JavaScript files.
That was the moment when I decided to dust off my knowledge of C and create something reasonably small and manageable to serve a website for Markdown files, Mustache templates, and generated Atom feeds. Ideally, I should be able to add a file with an article to the folder containing articles, and the cserver
will process the page template, update related feeds, and display the article on the main page, logging page requests for analytics.
That's how this project started; it's open source and available on Github.