Turning Node.js Apps Up To Eleven With Serverless
Table of Contents

Turning Node.js Apps Up To Eleven With Serverless

Summary

  • For many reasons, Node.js is the king of the cloud;
  • There are few serverless set-ups that you may choose under different circumstances;
  • From running an Amazon API Gateway with an AWS Lambda connected to your database to more complex workflows;
  • Should you require a personalized solution, feel free to contact us.

JavaScript is the Rodney Dangerfield of programming languages — it doesn’t get no respect

The truth is, Node.js broke the mold and made JavaScript a top programming language. New tools built on top of Node.js have taken some pain out of developing modern web applications, and if you are not on the JS hype train, it’s time to hop on.

Why? The thing about enterprise software is that it’s pretty much built for anything except for, well, being enterprise-sized. The truth about Node.js is that it has an edge over the old favorites: ASP.NET, ASP.NET Core or Spring. Firstly, it uses available resources available much better than the old favorites: ASP.NET, ASP.NET Core, or Spring apps. The thought behind Node was to make it handle multiple connections at the same time. These two strengths make it well suited to the world of the Cloud.

Of course, as some will point out, your old apps will work fine as long as you keep throwing more money at them; no matter how they are built. If you like to be efficient, though, we have a solution for you. Recently, the serverless approach is all the rage, and for several good reasons.

Firstly, our apps become more reliable, as there are fewer parts they all share. If everything stops working for you, then either there was a mass catastrophe, or you are a token of bad luck. Secondly, by using cloud providers, you only pay for the time your services are actually working, which is never 100% of the time. Lastly, you don’t have to maintain, or pay for, your company’s servers; let’s call it “Marie Kondo programming”. Throw out what does not spark joy.

Serverless

The number of services available for you on AWS, Azure, or GCP can quickly make you lose your head. Luckily, we have asked our Cloud Competency Leader, Maciej Gos, to boil everything down to reusable patterns that you can pick up.

After deciding what your needs are, building everything is not much more complicated than piecing complicated jigsaw puzzles together. If you require any clarification after this section, feel free to call us or email us – we will be happy to explain everything in detail.

The Minimum Viable Product

If you prioritize quick iterations, and don’t want to bother with anything more than you have to, this is the choice you want.

The setup is simple and straightforward, so your teams can focus primarily on the agile development. As your users navigate over to your web app, they will go through the API Gateway, which acts as the front door, to your Lambdas. From there, they will be communicating with a database directly. The name of the game in this case is simplicity, and a short time to set up

Of course, you might soon find your set-up to not be enough, may want to improve it, or you already have a product which already has a high number of users. There are some aspects that we have sacrificed here for the sake of keeping it simple. Let’s lay out how a more complete solution would look like in the next section.

Improving the MVP

What you see above is a more comprehensive blueprint, than the previous one. This is something that you eventually will shift towards. All the additional money spent goes towards making everything more reliable.

Here, in this blueprint, Amazon Simple Queue Service (SQS) before the app code. We want to make sure, that the stream of data to your web app does not overload it. This small change made the setup more reliable than it was.

The last thing that benefits you is setting a limit on the number of connections to your DB at the same time. They are just like humans: there is a limit to how many things we can do at the same time. If we wanted to do too many things at once, we would have failed miserably.


What if I serve clients from across the world?

In this case, any delays, even those as small as 10 milliseconds (ms), are your enemy. Even if they are something seemingly unnoticeable, decreasing them improves your clients’ overall perceptions – that’s money for nothing!

To achieve that, we can run our code on the Edge; that’s just Cloud Architect’s fancy way of saying closer to your users. Lambda@Edge does wonders when it comes to the response time. If you can reduce the time your visitors have to wait for your page to load by 10 milliseconds only, then your revenue will go up significantly - up to a yearly salary of Bing’s engineer. For comparison, an average blink of an eye is 30 times longer than 10 milliseconds.

Summary

Cloud provides us with an easy way to create an architecture for your service without worrying about much of what you traditionally had to keep an eye on. Modernizing your servers, employing dedicated staff, and electricity costs were only some of the aspects that no longer will cause you a headache. 

Furthermore, what we showed you today on the blueprints will mostly be enough. Should you feel as if you need a personalized cloud design, feel free to contact Maciej Gos, ITMAGINATION’s Cloud Competence Leader.

Extra: Something For The Azure Crowd 

The thing about Cloud providers is that they offer almost the same services under different names. Azure, therefore, offers similar solutions to the ones offered by AWS. If Microsoft’s Cloud is your cup of tea, then we have prepared an additional scheme for you. The services do somewhat of the same job, so there is not much to say about them here. If you understood all the previous blueprints, you understand this one as well.

Read More

This post is part of a series exploring full-stack JavaScript development, check out our other posts here:

The Complete Guide To JavaScript, Node.js, And TypeScript In Enterprises & Startups

The Complete History of JavaScript, TypeScript, and Node.js

5 Reasons Why Startups Love Node.js

How Node.js Changed the World of Corporate Software Engineering

Battle-Tested JavaScript Frameworks - Part 1

Battle-Tested JavaScript Frameworks – Part 2, Web3.

Battle-Tested JavaScript Frameworks – Part 3, Data Science.

Liked the article? subscribe to updates!
360° IT Check is a weekly publication where we bring you the latest and greatest in the world of tech. We cover topics like emerging technologies & frameworks, news about innovative startups, and other topics which affect the world of tech directly or indirectly.

Like what you’re reading? Make sure to subscribe to our weekly newsletter!
Relevant Expertise:
No items found.
Share

Join 17,850 tech enthusiasts for your weekly dose of tech news

By filling in the above fields and clicking “Subscribe”, you agree to the processing by ITMAGINATION of your personal data contained in the above form for the purposes of sending you messages in the form of newsletter subscription, in accordance with our Privacy Policy.
Thank you! Your submission has been received!
We will send you at most one email per week with our latest tech news and insights.

In the meantime, feel free to explore this page or our Resources page for eBooks, technical guides, GitHub Demos, and more!
Oops! Something went wrong while submitting the form.

Related articles

Our Partners & Certifications
Microsoft Gold Partner Certification 2021 for ITMAGINATION
ISO-IEC 27001:2013 ITMAGINATION ISO 9001 ITMAGINATION
© 2024 ITMAGINATION, A Virtusa Company. All Rights Reserved.