AEM Edge Functions

IMPORTANT
AEM Edge Functions is currently in beta. Features and documentation may change. For feedback, contact aemcs-edgecompute-feedback@adobe.com.

AEM Edge Functions let you run JavaScript on Adobe CDN at the edge, close to your visitors and without a round trip to origin. They work on AEM as a Cloud Service and Edge Delivery Services sites with Adobe Managed CDN.

What are AEM Edge Functions

AEM Edge Functions are JavaScript modules deployed to and executed on Adobe CDN (powered by Fastly Compute). When a request matches a CDN routing rule in cdn.yaml, the AEM Edge Function intercepts it, reads headers, calls backends, transforms responses, and returns the result from the edge.

Common patterns include server-rendered personalization, secure API proxying, and response aggregation.

When to use AEM Edge Functions

Use the following guide when choosing between AEM Edge Functions and other AEM extensibility options.

Scenario
Recommended approach
Run custom logic, call external APIs, personalize responses at the edge
AEM Edge Functions
Complex business logic with full AEM context (for AEM as a Cloud Service Java stack) at the origin
OSGi service or Sling servlet

Prefer AEM Edge Functions for dynamic content or data that needs speed, security and scalability without a round trip to origin.

Why use AEM Edge Functions

AEM Edge Functions address four common challenges when building dynamic, CDN-delivered experiences.

Benefit
Description
Performance
Lower time-to-first-byte with edge-side execution and no origin round trip for common patterns
SEO
Server-rendered HTML on first crawl, friendly to search engines and AI crawlers
Security
API credentials and secrets stay server-side and are never exposed in client JavaScript
Personalization
Customize content by geo, device, or audience before the page loads

How it works

An AEM Edge Function sits between the CDN cache and your backends. It processes matching requests before they reach origin.

AEM Edge Functions request flow {align="center"}

Two independent cache layers exist: the CDN cache (what the browser sees) and the fetch cache (what the AEM Edge Function sees when calling backends). Invalidate each layer separately when underlying data changes.

For more information, see Caching in AEM Edge Functions.

How to get started

Choose if you are using AEM as a Cloud Service or Edge Delivery Services site and follow the setup tutorial. You deploy a JavaScript AEM Edge Function with /hello-world and /weather routes, configure CDN routing, push the code to Adobe CDN, and verify responses from the edge.

Set up on AEM as a Cloud Service

Set up on AEM as a Cloud Service

Install the CLI, deploy WKND (or your site), configure CDN routing, and verify AEM Edge Function endpoints on AEM as a Cloud Service.

Set up

Set up on Edge Delivery Services

Set up on Edge Delivery Services

Onboard your Edge Delivery site in Cloud Manager, link your repository, and deploy AEM Edge Function endpoints on Edge Delivery Services.

Set up

Platform limits

Keep the following limits in mind when you design AEM Edge Function logic.

Limit
Value
Max outbound fetch calls per invocation
32
Max AEM Edge Functions (AEM as a Cloud Service)
1 per environment
Max AEM Edge Functions (Edge Delivery Services)
3 per program (main, stage, dev branch of your Edge Delivery Services project)
Config, secret, and KV stores (sandbox programs)
Not available

For the complete list of limitations, see Limitations in the AEM Edge Functions product documentation.

Additional resources

recommendation-more-help
experience-manager-learn-help-cloud-service