Back to blog

Edge functions: Go for Launch

Dean HaddockAug 12, 20243 min read
PULSE_Launch.png
Talk to an expert about something you read on this page

This summer we rolled out an exciting new feature for Contentstack Launch: edge functions.

This update gives Launch developers powerful new capabilities to use when implementing headless applications, and it opens up a vast green field for Contentstack customers to imagine–and realize–magical new experiences for their end users. 

In this article I’ll cover edge functions at a high level, share a few common use cases, and suggest some considerations for your team to think about when envisioning your next great feature at the edge.

Edge functions in the Contentstack ecosystem

First, if you’re new to headless or MACH architecture, it’s important to remember that the front end (what the user sees, usually a website) is separate from the CMS (where the content is managed). On Contentstack, just a few clicks away from our headless CMS, is Launch, our own advanced solution for hosting enterprise-class websites.

Launch allows you to deploy sites in the frontend framework of your choice and execute code in cloud (serverless) and edge functions. Cloud functions are typically used for backend operations, like securely connecting to remote upstream data services and handling lots of concurrent requests at scale.

Edge functions are similar to cloud functions, but instead of running in the cloud close to the origin, edge functions run proximally close to the end user at the CDN layer. This gives edge functions unique capabilities compared to cloud functions, like intercepting headers and dynamic rewrites/redirects. Edge functions are also useful for IoT and geospatial applications because they offer extremely low latency and can instantly serve localized content from the CMS.

But by far, my favorite applications for edge functions are content personalization and A/B testing. These applications took center stage this year at Contentstack’s annual ContentCon event, along with the announcement of our upcoming new product release, Personalize, which does both with remarkable ease. 

If you think of edge functions as the layer at which your code presents a given version of content to the end user, Personalize is the Contentstack product your content team will use to configure audience, variant, and attribute logic that determines which content is presented and to whom. The content variations themselves are crafted and maintained within the CMS. A few lines of edge function code delivers the variants to appropriate audiences without even a flicker on the page. Without edge functions, the user would experience a very brief but potentially costly delay while the content is retrieved and assembled on the page.

Real-world use case

Consider this use case: you have a purchase page that converts 1% of new visitors to customers. Increasing this to 2% would double the sales of this product, so your content and design teams collaborate on a few different strategies they can formally test. 

Your design team has a hypothesis that the product featured image isn’t appealing enough to visitors, and they provide two new versions to test against the current image. In just a couple of minutes, the featured image variants are created and a new experiment is deployed to staging for review and then published directly to production instantly across the CMS and Launch. Your engineering team didn’t have to lift a finger in this scenario either because they had already implemented the small amount of edge code needed to enable Personalize across the entire site. 

This model has very low ongoing overhead because it allows a developer to implement edge code for Personalize just once to enable their content team to deliver personalized experiences continuously. The other nice thing about this setup is that the CMS, content personalization engine, and frontend hosting are all on one platform, so the components are designed to click into place as if they were made to go together–in fact they were! Because it’s Contentstack, it’s also composable, so you can still bring your own personalization and hosting solutions if you prefer, too.

3 things to keep in mind

Now that you have a feel for some of the capabilities of edge functions, here are some things to keep in mind as your team begins to explore potential use cases and implement your first edge functions: 

  1. Edge functions do have some important limitations, such as computational resources and restrictions on certain APIs. Ensure that the use case you’re considering as a candidate for edge functions is both possible and performant.
  2. Keep in mind new capabilities, like blazing-fast geotargeting, the ability to intercept HTTP headers, and rewrites/redirects. Edge functions give you access to new tools that may help in your next localized marketing campaign or multisite content migration.
  3. Don’t just think about what you’re delivering to your end user; also consider where you’re delivering it. The low latency and geographically distributed nature of edge functions make it possible to interact with users and IoT devices in new and exciting ways.

Keep these basic constraints and capabilities in mind as you and your team begin to ideate on your first potential use cases, and you will be off to a smooth start writing your first edge functions. To dive deeper and see real-world examples, check out the recording from our recent small group demo on Edge Functions.

Intro_to_Edge_Functions_-_1200_x_1201.png

Looking ahead

After reading this article, I hope you’re as excited about this new feature in Launch as we are. With Personalize coming online soon and even the brief list of other benefits I shared above, it’s clear that gaining some familiarity with edge functions now will keep you ahead of your competition.

Do you have any edge function success stories to share?

Share on:

About Contentstack

The Contentstack team comprises highly skilled professionals specializing in product marketing, customer acquisition and retention, and digital marketing strategy. With extensive experience holding senior positions in notable technology companies across various sectors, they bring diverse backgrounds and deep industry knowledge to deliver impactful solutions.  

Contentstack stands out in the composable DXP and Headless CMS markets with an impressive track record of 87 G2 user awards, 6 analyst recognitions, and 3 industry accolades, showcasing its robust market presence and user satisfaction.

Check out our case studies to see why industry-leading companies trust Contentstack.

Experience the power of Contentstack's award-winning platform by scheduling a demo, starting a free trial, or joining a small group demo today.

Follow Contentstack on Linkedin

Background.png