Nodejs May Be a Good Fit for Fintech Apps

nodejs may be a good fit for fintech apps

A lot of tech giants make use of Nodejs one way or the other. I mean a lot of tech giants had to migrate from technologies such as ruby on rails, PHP, ASP.NET C#, etc. to Node.js.


With a reduction in the number of servers, reduced page load time, and ease of maintenance, these are but few reasons why a lot of tech startups and tech giants are rapidly adopting Node.js

Most programmers know JavaScript

Being that JavaScript is the longest running language, I mean a lot of developers know it, I can safely say that 99% of developers have at some point in their career used JavaScript once or twice.

The concerns for Fintech apps?

nodejs may be a good fit for fintech apps - The concerns for Fintech apps?
Photo by Christina Morillo

Lately there have been a lot of concerns if JavaScript can be used to build financial apps, taking into account that PayPal was rewritten in Node.js.
Here is the problem, unlike most programming languages, JavaScript stores all numbers in a 64-bit double-precision floating point format, instead of choosing to have different types of numbers, they came up with the “one number type” to rule them all and use everywhere.

They wanted a number system that could be compact, easy to store and equally represent 2^23=9007199254740992 digits. Here is the thing, nothing is free in life, the decision to use only one number type was one area where they could not have their cake and eat it too. Sad to say numbers irrespective of the type, are all represented as floats, and floats are inherently inaccurate.

What exactly is the problem with floats?

nodejs may be a good fit for fintech apps- What exactly is the problem with floats
Photo by Andrea Piacquadio

When floats are stored, the actual number itself is not stored, really? Yes! Instead, instructions are stored for setting up a math problem that will allow the computer to solve it in order to determine the rough coordinates of where the original number existed. This allows you to free up a ton of space, but what it means is that your calculations may be off by a small amount.

Is there a solution to this problem?

nodejs may be a good fit for fintech apps - Is there a solution to this problem?
Photo by Pixabay

Well, It seems like the only solution is not to use JavaScript if number accuracy is important.
BUT WAIT A LITTLE, BEFORE YOU START DELETING YOUR CODE!!! THERE A LITTLE TWIST TO THIS.

I feel like your best bet is to look elsewhere. Mathjs seems to be giving this problem their best shot, just as how boys will be boys, floats will always be floats and there will never be enough space in this little amount of data to represent accurately, all the numbers it wants to.

I Think There’s Good News

nodejs may be a good fit for fintech apps - I Think There's Good News
Photo by Andrea Piacquadio

You may ask, what exactly is the good news? Alright, here is the good news; Nodejs is built on Chrome’s V8 Engine written mostly in C++ that can be directly extended in Node.js.

Now, here is the catch, write the functions that handle all the calculations in C++ and then call them in JavaScript, it’s that simple, Isn’t it? Nodejs can still send your data back and forth between the database, front-end, etc. just make sure the calculations are handled in C++ and please pass those numbers as strings as they go through Nodejs.

Here is another concern: JavaScript is loosely typed

nodejs may be a good fit for fintech apps - Here is another concern: JavaScript is loosely typed
Photo by luis gomes

As we all know JavaScript is a loosely typed language, that in itself comes with its own advantage, however it comes with a tradeoff which we’ll touch on shortly.

A lot of business-critical applications for the Banking and Financial sector needs to be heavily fault tolerant, secure and easily maintainable. Now the problem with any dynamically or loosely typed language is that it is very hard and in some cases almost impossible to spot issues and bugs before runtime, that is not all, the possible combinations of control flow also cannot be predicted without deploying the application, which is a very clear no-no, because a crafty developer can hide a backdoor deep within the control-flow of the program which can be easily detected in a static typed language.

But JavaScript is single threaded, right?

nodejs may be a good fit for fintech apps- But JavaScript is single threaded, right?
Photo by Markus Spiske

Apart from how JavaScript treat or handle numbers, it is a single threaded language and this is an advantage in some sense, however, this advantage comes with a price – a single long task of processing and calculations will block the main thread for all the users.

This is not a problem if it doesn’t have a solution, right? Of course, there is a solution to this. You just have to make use an API gateway that just redirects requests to different services written in other languages like C++ to do the heavy lifting.

The verdict – Nodejs can be used for FinTech Apps!

nodejs may be a good fit for fintech apps
Image from Pixabay

Amongst other things that Node.js is good at, it very good at one thing – saturating an I/O pipe. Since it is single-threaded, it makes it really good at just using up one core on a multi-core CPU. However, there are various meta-solutions that will start up as many Node.js instances to match your core count, so that way you can use all of your available CPU cores.

If your web application is streaming lots of data to lots of users, the ability of Node.js to maximize I/O is a good thing. It makes perfect sense that Netflix could benefit from web servers running Node.js.

In case of PayPal, it more likely that they are not carrying out any financial calculations in Node.js, due to how JavaScript handles numbers, they would have serious rounding error problems. However, they could benefit from having Node.js web servers that can call microservices written in Java/C#/C/Go/C++/What-have-you to do the important calculational stuff, and then sending those results back to the clients as fast as possible.

You could conceivably get away with fewer web servers that way and focus on scale-out issues in your services and persistence layers.

Yes Node.js can be used in build FinTech apps. Node.js is really good at saturating an I/O pipe, and that is a useful thing, I can assure you.

3 thoughts on “Nodejs May Be a Good Fit for Fintech Apps”

  1. Nice. Saw from Facebook
    Too many Images really
    A single image at the top for description is okay.
    If and only Images are required, use then, else, neglect!

    1. Qudusayo,
      Thanks a lot for the suggestion, we really do appreciate!
      We’ll work on that going forward to make sure our content meets the demands of our esteemed readers.

      Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *