#​384 — April 15, 2021

Read on the Web

👋 If you've enjoyed our previous package maintainer interviews, we're back with a bumper sized one today in the shape of some Q&A with the creators of Middy, the AWS Lambda middleware system for Node. Enjoy it at the end of this issue :-)
Peter Cooper, your editor

Node Weekly

A Simple Start to ES Modules in Node.js — From next month, every supported version of Node.js will support ES Modules (it’s just Node 10 holding out till then). If you haven’t dipped a toe into the ESM water yet, Kent keeps it simple and straightforward with an example here.

Kent C Dodds

What About Bundling Yarn 1.x with Node.js? Maybe! — Included merely as a look at an interesting, though controversial, proposal. But if npm is packaged with Node, why not Yarn? People seemed to mostly be against it but the question is going to the TSC to resolve, so watch this space..


Spend Less Time Debugging and More Time Building with Scout — Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues in minutes. See for yourself why Scout is a Node developers’s best friend with a free 14-day trial, no credit card needed.

Scout APM sponsor

Deno 1.9 Released — Sure, it's not Node, but as Node's anagrammed cousin it's worth keeping an eye on. 1.9 brings a native HTTP/2-compliant Web server (which seems to beat Node's in basic benchmarks), support for blob and data URLs, and more.

The Deno Team

💻 Jobs

Join STRV as a Remote Node.js Developer — No working hours. No micromanagement. Just great people who trust you to do solid work & who've got your back when you need them.
STRV s.r.o.

Find Software Engineering Jobs with Hired — Take 5 minutes to build your free profile & start getting interviews for your next job. Companies on Hired are actively hiring right now.

📗 Tutorials and Stories

▶  5 Hours on Node DevOps with Docker — It’s fair to call a 5-hour YouTube video epic, no? Sanjeev covers the use of Docker with Node, what Docker Compose does, building a basic app, bringing MongoDB into the mix, and eventual deployment on a server.

Sanjeev Thiyagarajan

Building a Video Streaming App with Nuxt.js, Node and Express — A walkthrough of creating a server-side Node app that will handle the fetching and streaming of videos, generating thumbnails, and serving captions and subtitles. Nuxt.js is the Vue.js based framework that brings it all together.

Deven Rathore

Report: See Why Developers Spend 34% of Their Time on Internal Apps

Retool sponsor

How to Send Tweets with a JavaScript GitHub Action — Learn how to create a GitHub action which sends a tweet whenever a pull request is merged.

James Hibbard

Scraping the Web with Playwright from Node

Kevin Sahin

Mastering Postgres Transactions with Knex.js and Objection.js

Greg Bergé

🛠 Code and Tools

WikiJs: A Wikipedia Interface for Node.js — An API for working with Wikipedia (or any MediaWiki based wiki, really) for searching, fetching content, scraping links, etc.

Richard van der Dys

fast-folder-size 1.2.0: Calculate the Total Size of a Directory — Works as both a CLI app or Node module.

Simone Busoli

Find, Fix, and Prevent Cloud Misconfigs with Bridgecrew — Bridgecrew embeds automated security from commit to cloud. Try the all-in-one DevSecOps platform for free.

Bridgecrew sponsor

Electron Boilerplate 9.0: A Boilerplate for Building Electron Apps — All the dependencies have been brought up to date and this brings some structure and dependencies to your Electron development party.

Jakub Szwacz

tslog 3.2: 'Beautiful' Logging for Node with TypeScript Support — Featured packed, fully typed, can do stack traces via the native V8 API, show code frames, and more.

Eugene Terehov

JS-YAML: A Fast YAML 1.2 Parser and Dumper



Middy is a middleware engine for simplifying your AWS Lambda code when using Node.js. We caught up with both the project's creator and maintainer to ask a few questions:

How did the Middy project start?

It started in 2016 when Luciano was working with a company building everything on AWS using serverless tech. We were early adopters of this tech so AWS invited us to speak at AWS Summit 2017 to present our serverless use cases.

Lambda was one of the services we used the most (to write REST APIs and data integration pipelines). We realised our code had a lot of duplication and inconsistencies and it was getting harder to keep quality high. We were missing an abstraction that would allow us to easily reuse pieces of repetitive business logic: validation, data serialization and deserialization, authentication and authorization, etc.

We decided to create an abstraction layer to help us simplify our codebase, reduce duplication, and make things more consistent/manageable. A year later we published Middy, effectively a Lambda middleware framework for Node.js, as an open-source project — this is how it was born.

The project saw good traction in the open-source community and many devs started to contribute. After a while, but not before releasing v1.0.0, Luciano put out a call to help from the community — early adopter/contributor Will Farrell offered to take over leadership of the project. Since then he has been leading the efforts on Middy, delivering v2.0.0, with work underway on v3.0.0.

How do you use Middy in production systems yourself?

Will: At DataStream, we started using it just after the v1-alpha was released about 3 years ago. We were migrating from using Elastic Beanstalk to be more serverless. Our API was the first piece to use Middy. Since then we’ve fully migrated to serverless and every Lambda and Fargate container now use Middy. Interestingly, even our Fargate containers use Middy to keep the code clean and organised. As Lambda gets better and covers more use cases, this approach allows us to switch from fargate to Lambda quickly to meet the needs of the system and lower costs. We use nearly every "official" middleware provided from Middy.

Have you tried any of the other serverless platforms?

Will: I mostly stick to AWS, but have used Firebase for smaller one-off projects (the Auth + function + DB integration is really powerful, whilst being dev friendly). I’d like to try Cloudflare Workers with KV Store, they’re doing some really cool stuff over there.

Luciano: I have mostly been using AWS too, even though I had the opportunity to also work with Azure Functions for some professional projects. While I think Azure is doing a great job and improving every day, I have to admit that at the time (~2019) working with Azure Functions was, in some aspects, harder than working with AWS Lambda.

What use cases do you think Node, Middy and AWS Lambda is ideal for?

Middy is a middleware framework that allows you to structure your code in "layers" where every layer is fulfilling a specific responsibility: serialization / deserialization, validation, authentication, etc. This allows you to focus on your business logic by moving all these concerns outside from your handler code.

Its code is simple in design, it doesn’t have excessive dependencies, and it's purpose built.

Unlike others, Middy also focuses on use cases like triggering Lambda from other services such as SQS and S3 and making the developer experience in these less used cases easier.

The Middy repo can be found here. You can also find both Will and Luciano on GitHub too.

This interview has been edited for brevity, you can find the full Q&A on Superhighway.