Now that we discussed what edge functions are, let's talk about how PeakActivity is utilizing this functionality in a highly sustainable and impactful way.
We recently engaged with a client to help bring speed, stability, and scalability to their users. After spending a few weeks learning about their current architecture and factoring in the upcoming holiday season, we decided to bring speed incrementally through edge computing.
At the time, Vercel was not ready for edge functions, and the client was already on AWS, so we decided to utilize the Lambda@Edge feature. Since the functionality was based on Node + Typescript, we could easily chunk the existing extensive API into smaller, more composable serverless functions. Right out of the gate, we yielded one colossal benefit: cost savings. We went from a high availability EKS cluster to a dozen smaller lambda functions which you only pay for what you use. We deployed these on edge now that we have a dozen lambda functions.
The total time spent implementing these changes was approximately 30 days end-to-end. We abstracted the extensive REST API to smaller serverless functions, reused it where necessary, and deployed it on edge. All of this within 30 days provides tremendous incremental value.
Now that Vercel supports edge functions, we can better adapt this functionality. Vercel now provides an edge middleware to convert or create new server APIs directly from the Next.js application.