David.dev




Back to Polka and new "Windows" interface


Here we got again for my week end project I am back to polka 💃🏻 a very lightweight NodeJS framework. 

The design is also new: the windows 95 user interface that I used several months ago is back too! 

Why move from Django to NodeJS/Polka ? Well I had some free time 😁 but I also thought to use the super lightweight CMS I did back when I tried polka and started this site.  

The speed difference is remarkable here are the Apache benchmark results:

1000 Request, 100 concurrent

Requests per second:    18.65 [#/sec] (mean)  Django 

Requests per second:    182.42 [#/sec] (mean) Polka

 ab -n 10 -c5 (10 requests, 5 concurrent)

Requests per second:    8.51 [#/sec] (mean) Django

Requests per second:    52.08 [#/sec] (mean) Polka

but speed is the sole consideration. The ease of deployment of NodeJS code is just not comparable with Python.  I still like Python and Django (and who knows this site might even go back to it 😱) but I want to note (mostly for myself, in the future) some lessons learned:

 

1) Articles format matters: HTML or Markdown ? This is one of the issues with django: the tinymc module to have a decent editor is not working with some important functionality like drag and drop photos.  Additionally, I think that all this markdown parsing in Django slows down the whole deployment (some packages are very outdated, others need to be properly setup). I would say that markdown is fine for a static site that doesn't get updated very often. For a dynamic website you should store the articles in HTML format. 

2) The admin panel you write on your own is the most flexible It might not be the most features rich but you are in full control, always.

3) Writing MySQL queries is a learning experience by itself. I have now added search and pagination to this site without having to rely on any "magic" which is useful in django but you won't really understand all that is going on.

4) Full Stack can be modular With Polka + EJS (embedded javascript) templates  + bootstrap for CSS you are covered. Simple yet effective. No need to separate frontend with backend, this is fast enough. 

5) Speed of deployment in NodeJS is fantastic all you need is node installed and pm2. This is it. No fancy apache config, modules etc. 

6) You need an admin panel to write the articles. No markdown articles unless you have few updates because in most cases the hassle to write something will slow down your willingness to update it. Jamstack websites in Hugo, NextJS, Svelte etc. are very cool, fast and secure but if you have regular updates with one click your article will be live. 

So far I am very happy with the solution and might post some short code tutorials in the future. 

 

Last Update:2021-10-03 22:01:16