My perfect stack

Hello world!

In my free time, I like to learn and test various technologies and here’s what currently makes up my “perfect” tech stack, along with an explanation as to why this combination works well for me.

Backend languages

Golang : Golang has a great developer experience (DX) as it’s easy to learn, and provides high performances. Golang executable can compile without dynamic libraries, this creates large executables that are useful when creating minimized container images.

Python : Python has also a great developer experience. It’s easy to learn, and has a great time to market. There are lots of libraries available across multiple domains such as machine learning, data analysis… The drawback of python is its limited performance. To prevent this, each heavy compute component should be separated into a microservice. This means that it could then be scaled using a Kubernetes service or HAProxy/ELB to load balance the service across multiple cloud instances.

Backend frameworks

With Golang, Gin : I really like minimal frameworks. They also provide a great DX. With MVC Frameworks such as Rails or Laravel, you can save some time at the start of a project or when building simple CRUD/REST APIs. However, once your project becomes more complex, you may struggle to deal with the system. MVC is a great design pattern, yet you may easily implement it with a lightweight framework without this drawback.

With Python, Flask : The same philosphy as Gin, but in Python!

Databases

MongoDB : I believe that 90% of web apps should be using a document based db instead of a relational one. If we use relational databases it’s just because of habit or ignorance about NoSQL databases.

Sometimes, relational database are a good choice. For example, for a catalog containing articles across many categories. Here, datas are relationnal by nature. It’s logique to create a table for articles, an other one for categories, and a last one for link between them. But most web apps are more document-oriented.

With MongoDB, We have all that we require within one document without any need of complex queries. The philosophy is opposite to that of relational database. In MongoDB, you can use complex aggregations operations with pipelines, which allows you to retrieve all the data of a specific type from multiple documents at once. But you don’t have to do this every time you create a page. In SQL, you have to use joins everytime you create a page.

In a recent development with MariaDB, I needed to use CTE (Common Table Expression) to handle hierarchical data, but not everyone knows recursives queries and it creates code that’s difficult to maintain. In contrast, with MongoDB you can directly create your hierarchy in JSON format.

MariaDB : I know that I am going against the trend. But if you need a relational database, in most cases MariaDB is a better choice than PostgreSQL. PostgreSQL uses more CPU, more memory and is slower in most cases.

But then, why this trend around PostgreSQL? PostgreSQL is better at handling databases with complex relationships. In this specific case, it performs better than MariaDB. By generalization, most people think PostgreSQL is better thant MariaDB. But in most cases, this is false.

We often see the same kind of generalization in the tech world. For example NGINX is very good at serving static files. But the trend has decided that NGINX is the best webserver and it should also be used to serve dynamic pages.

Frontend frameworks

Svelte : The choice for the frontend is more complex. First of all, do we really need a framework? With Vanilla Javascript, handling the DOM is painful. For example, with the slightest change, you have to recreate the callbacks. So, yes, a framework is necessary. But which one? I spent years finding a suitable front framework according to my criteria.

Angular is nice conceptually. But it is complex to implement and leads to the creation of weighty apps that are difficult to maintain.

React is simpler and easier to learn. Unfortunately, it creates as many problems as it solves.

For me Svelte is currently the best option. It may not be as easy to learn as React. But we find all the logic of Angular, with so much more simplicity. Svelte makes it easy to create well-built applications.

The problem today is that the Svelte team is looking to push SvelteKit, their fullstack framework. For simplicity, it is preferable to use Vite to create your project.

npm create vite@latest <MyApp>

This command will interactively ask for your framework (here, Svelte) and language (for example, TypeScript). This way, you will only have what you need to use Svelte.