ARTUR: It not only shows its strength, but also shows Google’s optimization efforts are paying off well because “cold start”, so Lambda’s boot, is necessary to run the script. This is why it starts so quickly, and is only getting quicker and quicker, and it’s why it’s so liked - because V8 first runs it, only then does the optimization starts.
This is perhaps the most characteristic feature of this language. It’s very fast, and runs very nicely, has a small RAM usage; at least in comparison to how it used to be, and that's mainly why it's so popular.
MARCIN: We can also write front-end and backend in the same language.
ARTUR: Correct, however Lambda here has nothing to do with it. Again, yes, we can do that, we have different frameworks for each specific purpose. Some frontend ones are Vue, React, Angular – likely the majority of us at least know them, and we also have backend frameworks that require Node.js to run.
Please tell us how this program looks like, what it is about, and what are its results.
ARTUR: We began from me showing everybody how Node looks like, because frontend specialists mainly used Node to run their frontend apps. Most of the programmers came from a React background, so they have mainly built their project in React, and then uploaded it to a server, therefore it had to be shown how Node works, what is it, what NPM (a light package manager) can do in order to show them what can be installed, show them what can be additionally installed access to the hard drive, access to different aspects of the system, to a database, something which isn’t a thing in frontends.
We do not have to access the database, we simply connect the app to API points, so we had to teach them some backend thinking, because on the frontend, when it crashes, then it crashes for one person only.
When the backend crashes, then everybody who uses it will not be able to use it. Therefore we have a slightly bigger crash than only for one user. It had to be done, so I came up with a course for them, which, starting from the lowest level of knowledge, they will go higher and higher, level by level until they reach the level of a full API, an access to a database and a user management system.
We started with a simple API written in Express, which receives files, sends files, locks them behind a password, and does not allow you to download them if you provided a wrong password. We have done everything on files, we saved files that the user sent in a .json file in which we also had meta info such as the password, file size and a few other things. I also demonstrated that this approach is suboptimal, because you can save a password then save another password, because the previous one did not manage to save. There are several problems with such file accesses. Then we showed the transition to a database.
We used MySQL, MySQL 2 library from NPM and we simply transitioned to a database. Of course I built the database; we did not learn how to do it from scratch as it was completely unnecessary for them (I will soon explain why).
Once we did that, we had to move the metadata to the database, so the same app which was, up until this point used by the same user, suddenly received info that it has a database, that files were where they are, metadata were in the database, so it was upgraded.
Later, we switched to a full backend framework at which point we also switched from MySQL to an ORM [Object-relational Mapping]; Sequalize ORM to be precise, so it was another update; a serious one because on top of all, we introduced TypeScript to the codebase thus improving code quality. So that's why it was not necessary [high code quality] when creating this database because if we write these modules correctly, these models will pass [the tests] and will do everything for us.
Of course, we had to learn migrations and seeding, however we did not have to write too much code. And the team did it; they had some homework after I showed them how Nest [Nest.js] works, all the additional libraries, they had to rewrite the previous app using Nest & TypeScript.
After two days, everything was ready, so they started to write a real world app; our internal one. They managed to pull it off quite well, and they’re finishing up now.
MARCIN: I want to add, that the code that we created as a part of our academy is on our ITMAGINATION GitHub account.
If you could tell us what to start with in order to not lose our minds and to use the same solutions that are widely used?
Then it’s good to learn TypeScript. That’s because it gives us typing; it gives us a lot of help in editors, because editors better understand our code which makes programming easier. This is important, especially for large corporate projects. I don’t even start small projects without TypeScript, because I simply know that it can grow bigger.
MARCIN: For better control, right?
After that, databases. If somebody knows Postgres, then you can get PG from NPM, and if I you know MySQL, then MySQL 2. Then I’d learn an ORM – Sequelize, TypeORM, whichever one. I prefer Sequelize because it’s more comfortable for me; I simply used it more often.
Once we do that, look for a “full” backend framework such as Nest.js, Nuxt.js, or Next.js, whichever one you like more. Each of these products is actively used, if not in one corporation, then it’s used in another one. If we want to be a fullstack developer, then we want a frontend framework. The most used ones right now are Vue, React, and Angular, so whichever one. I personally prefer frameworks that are opinionated, so ones that have an opinion in themselves about how should one write code. One of them is Nest.js, and Vue is another. They have some rules how to write code, how it should be structured, and how to split it to layers. So they’re very good to use. This is why I am not particularly fond of React, because wherever you go it’s written in a different way, everybody codes as they please. They are the most used frameworks, however, so it’s good to know then even if not very well; all of them a bit, and one of them better.
MARCIN: Thank you very much Artur. I want to make a final remark, that over at ITMAGINATION we are hiring full-stack, Node, Vue, and React Developers. The links are in the description. Artur, thank you very much for your time.
ARTUR: Thank you very much, it was a pleasure. Cheers.