Luciano Mammino

+ Follow
since Aug 03, 2021
Luciano likes ...
jQuery Python TypeScript
Dublin, ireland
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Luciano Mammino

Akash Rajvanshi wrote:Hello, I'm a beginner DevOps engineer. I work on nodejs for side projects. what are the some must known node patterns for API and security?

Hello Akash,
Really great question!

I am not sure it makes sense to talk about particular "code" patterns when it comes to API and security. But,  in the context of Node.js, I would recommend to get familiar with the following resources:

 - A good web framework (my favourite is Fastify, but there is plenty of choice)
 - Libraries for managing user authentication and various authentication protocols (Passport.js is probably the most famous, but Fastify has also plenty of official or community-driven plugins)
 - Libraries for writing your API documentation (OpenAPI/Swagger). Most frameworks offer some kind of support to this, natively or through plugins
 - Input validation libraries (have a look at for instance)

Let me know if this helps

Jon Greenwood wrote:Hi Mario and Luciano

Do you consider the underlying platform when it comes to Node.js Design Patterns and if so, does your book adapt/implement or advocate certain design approaches when using AWS serverless Lambdas running a Node environment?

Many Thanks


Hello Jon,
this is a great question.

In the book Node.js Design Patterns we don't have a dedicate section to serverless, but i personally believe that all the patterns we explore in the book can be used with no change in a serverless context.

I think a serverless context works pretty much like a normal Node.js runtime. The only interesting difference is that you might be a little more constraint in terms of resources (less CPU/memory) and that you will have to "complete" the execution within a certain time limit.

There are some patterns that can be particularly useful (given that serverless encourages you to write small functions) like the middleware pattern. I am one of the main authors of Middy (, also mentioned in the book. Middy is a good example of how the middleware pattern can be used in the context of AWS Lambda.

I hope this answers your question.

Best regards

Seymour Wanderson wrote:78dabbd4e2bb...

im trying to read my greenpass certificate, it is base45 encoded that will lead to a cwt compressed by zlib, in python works just fine with "zlib.decompress" but i im trying to do it with javascript and i can't, i have a simple script in javascript that lead to that hex result (i had to use hexadecimal otherwise, will appear a bunch of weird characters(if i used utf-8), this was what i got

I've seen it here, but with pako gives me an error, so im trying to use zlib

Here is the info about how QR code greenpass certificate is encrypted,

Apreciate any help

Hello Seymour, you could try something like this:

Rebecca Peltz wrote:Is there a pattern to create an NPM library using Node.js that can be imported with and used in vanilla JavaScript?

Hello Rebecca,
I am not sure i would call it "a pattern" but in general, if you don't use functionality that is available only in the Node.js standard library, you can easily publish npm modules that work both on browsers and Node.js.

I have done something similar in the past, so if you need an example you can check out this one:

I hope this answers your question.
Hello Salil. Yes, all the code examples contained in the book are available on GitHub and can be accessed for FREE. Here's the link
As per building web applications using serverless i think both Java and JavaScript/node.js are excellent choices and i would recommend picking the language that you are more familiar with (unless you are looking for excuses to learn the other ;p).

In a serverless ecosystem there might be benefits in using JavaScript because there are generally better performances in terms of bootstrap time, even though it seems that quarkus and Graalvm are helping to bridge this gap.
I think most of the patterns you commonly use with Java (or other OO languages) can be ported to JavaScript and Node.js quite easily. Although, even if that's the case, I wouldn't recommend doing that just because it might feel more familiar (if you come from Java). In fact, because Node.js has a very flexible module system and being JavaScript a dynamically typed language with closures and a prototype-based object model, the traditional OOP patterns often find different incarnations. Just to give an example, you would rarely need dependency injection and the dependency injection container. Furthermore, being the whole language so dynamic and based on async programming, it creates the need and the opportunity for a number of new interesting patterns that are novel when compared to traditional OOP patterns.

In the book we explore traditional design patterns (and how they can be expressed in the context of Node.js) but also many novel patterns that make sense only in JavaScript/Node.js.

I hope this makes sense even if a bit abstract. I am more than happy to try to go deeper on the topic if you have more specific questions.
Hello everyone, i am honored to be here and to have Node.js design patterns featured in this thread. Happy to answer any of your questions related to the book.
Hello everyone, i am looking forward to discussing here my book Node.js Design Patterns (

I am sure your opinion will be incredibly valuable and i hope you will enjoy sharing some knowledge about Node.js

8 months ago