1 hour ago · Tech · 0 comments

There is one pattern that has been my secret sauce for AWS Lambda code for almost as long as I have been writing AWS Lambda code: the middleware pattern. If you have touched a modern web framework in the last decade (Express, Fastify, NestJS, Laravel, Django, Rails, FastAPI, … take your pick), you have almost certainly used this pattern, probably without even noticing. It is everywhere, and I love it! I love it so much that, back in 2017, I started an open source project called Middy just to bring a fully fledged middleware engine to Node.js Lambdas. Today, Middy is widely used in the Node.js serverless ecosystem, and the pattern has been recognised as incredibly useful for keeping Lambda handlers clean and maintainable (huge props to the Middy community, and especially to Will Farrell, who has maintained and grown the project for years). Recently I was building a rate limiter middleware for a Rust Lambda project at work, and I realised the generalised version of what I learned would…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.