DEV Community

Cover image for Elevating Your AWS Lambda Game With Middy And TypeScript

Elevating Your AWS Lambda Game With Middy And TypeScript

Matteo Depascale on February 28, 2024

Introduction In the ever-evolving landscape of AWS Lambda development, efficiency is key. Picture this: you're building serverless funct...
Collapse
 
dvddpl profile image
Davide de Paolis AWS Community Builders

middy is awesome. why reinventing the wheel and write over and over again the same code in every lambda? by using those Middleware our code is lean and simple and we can focus only on what matters.

Collapse
 
mdrijwan profile image
Md Rijwan Razzaq Matin

Whatever you’re doing with middy here are easily achievable without using middy which eliminates installing so many external modules that unnecessarily makes the package heavier. If your lambda doesn’t have lot of handlers, using any external modules seems useless in my opinion.

Collapse
 
depaa profile image
Matteo Depascale AWS Community Builders

That's a really great opinion, I think it's the eternal dilemma right? If you want to bring your own utilities, you can do just that. Sometime people don't have time to create their utilities, and they want something they can use to enhance their Lambda development experience. And I think Middy does just that.

For example, one small thing that comes to my mind is the ability to validate the event body and have an interface to use, both while defining the schema in one single point

Image description

Other than that, you are importing less than 250KB (235KB are for the validator because it uses Ajv).
So yeah, I agree with you that you can use your own utilities, and sometimes, other options, like Middy, may come handy too