Typescript backend stack landing in Hotovo

Here at Hotovo, we are continuously evaluating the most effective technologies in order to better serve our partners. For server side development we have traditionally favoured a Java technology stack, however there’s no such thing as “one size fits all”.

On occasion, our partners have a strong preference for alternative technology stacks. As software experts, we’re happy to oblige. We’ve found there to be a multitude of reasons for technology preferences. More often than not, there’s a historical reason certain businesses favour one stack over another. Of course those are valid points! This is actually what pushes and motivates us to move forward in building professional development teams focused on the technology stack based on preferences.

Have you considered what is the way to cover the requirements if your house is full of Java (Backend) and JavaScript/TypeScript (Frontend) professionals? No, not yet? We did! If you are also interested in this topic, go ahead and continue reading this blog post.

What do we use?

It is not that much of a surprise that our solution of choice is Typescript language and Node.js as the backend runtime environment. This stack became incredibly popular over the last few years and we had dived deeper into it. Why do we prefer it?

Typescript

Typescript is a superset of JavaScript, extending its capabilities and adding options to write type safe code. On the other hand, Typescript allows developers to define what level of type safety they want to apply. 

A hidden benefit of Typescript is the type data provided for many libraries, which speed up the development process by providing accurate code hinting and preventing common mistakes. When compiled TypeScript code is transpiled into JavaScript which is running in the target environment. 

The project is maintained by Microsoft and supported by a strong community of developers. It is considered one of the fastest growing languages, and for developers who are coding in JavaScript switching to the Typescript is nearly instantaneous. 

As a result, you can benefit from the popularity of both languages, where JavaScript is the most widely used language in the StackOverflow survey, while Typescript is ranked 8th. Source: https://insights.stackoverflow.com/survey/2020#technology-programming-scripting-and-markup-languages

(% of developers using the language), insights.stackoverflow.com

Typescript programs can freely interact with JavaScript libraries, which significantly increases the options available. As well, the community maintains a repository with type data for the majority of popular JavaScript libraries and frameworks.

As you can see in Github data Typescript has become the 4th most popular language in repositories after JavaScript, Python and Java.

(Popularity ranking of programming languages used in Github repositories), octoverse.github.com

When comparing the number of libraries and modules available in the package repository, their number is several times higher than in any other language and is still growing rapidly.

Node.js

Node.js is a JavaScript backend runtime which was introduced in 2009 and over the last years it has grown into a mature and stable environment. Node is built on the top of V8 JavaScript engine from Google and native implementations for IO operations. It provides a single-threaded environment with non-blocking asynchronous operations scheduled through an event loop, allowing it to handle a large number of network requests.

Node.js achieved significant popularity over the years and according to the StackOverflow survey is the widely used server environment. Source: https://insights.stackoverflow.com/survey/2020#technology-programming-scripting-and-markup-languages)

NestJS

NestJS is a framework for building well scalable Node.js server-side applications built with TypeScript and fully supporting it. It is based on HTTP Server framework Express or alternatively Fastify. Nest provides a level of abstraction above the common Node.js frameworks and exposes their APIs to the developer. This provides a great deal of freedom when using third party modules. It favors convention over configuration. It offers opinionated guidelines and code conventions. So, instead of having a worry about naming or organizing files and folders, you can focus on building features for your product.

A good reason to choose NestJS over ExpressJS is the fact that when starting a new project in Node.js, it has a clear architecture based on a few simple components (controllers, modules and providers). This is a great baseline for building a microservice architecture.

TypeORM

TypeORM framework is an Object Relational Mapping (ORM) framework. ORM is a type of tool that maps entities with database tables. ORM provides a simplified development process by automating object-to-table and table-to-object conversion. Once you can write your data model in one place, it becomes easier to update, maintain, and reuse the code.

TypeORM is the most mature ORM available in the node.js world. Because it is written in TypeScript, it integrates well with the Nest framework using the integration provided by Nestjs authors.

Conclusion

All pieces together form a well tested base for backend development using Typescript which would suit a proof of concept project, right the way up to an enterprise level solution. 

Are you curious to see the backend Nest.js project in practice? Check out our next blog post where we go into details into details and even provide a sample project.

Cheers,

Jozef

about author

Jozef Radonak

Leader of the web tech stream at Hotovo. Passionate about hiking, web technologies and ...coffee ;)

READ MORE

June newsletter: Features you can’t miss

React 18 features After a long break, the React team …

Inside Nestjs project

Nestjs is an enterprise-grade backend server solution based on Node.js …

newsletter violet

May newsletter: With the right build tool, the work goes smoothly

Comparing next gen build tools Implementation of the support for …