How Commerce Companies can be More API-Focused | Fastly
Many businesses have seen huge shifts in how they operate in 2020, but perhaps none have seen as many changes as those in the ecommerce sector. The percentage of purchases made online has jumped 20-30% for some retailers, according to CNN. As a result of these changes, nearly 70% of respondents to a Gartner survey earlier this year said they were accelerating digital business initiatives in response.
One of the biggest ways commerce companies are accelerating digital transformation is by moving to a headless architecture. In fact, Gartner named API-based — or headless — ecommerce to be one of the Top 10 digital commerce trends of 2020.
What is headless architecture?
A headless platform is front-end agnostic, allowing front-end developers to build various “heads” for specific channels that communicate through a common API. Content delivery networks (CDNs) are typically used to enhance web and mobile performance, but legacy CDNs were not built to support headless, API-focused architecture.
To really capitalize on the promise of personalization and performance of headless commerce, you need to be using a modern CDN built on an edge cloud network that is aligned to the needs of modern app development. Let’s explore five ways an edge cloud fulfills the promise of headless commerce.
1. Optimize performance
Consumers don’t tolerate slow experiences, or worse yet, site downtime. In fact, 90% of shoppers will abandon a site if it loads too slowly, according to a survey by Retail System Research. APIs can be a potential bottleneck in a headless architecture, as all client requests converge on the same API resource. That’s why maintaining API uptime and performance is crucial, a challenge that gets harder as you scale. If your API goes down, all dependent sites and apps will cease to function.
A delivery network built on an edge cloud network can cache dynamic content by instantly and programmatically invalidating API responses at the network edge, increasing performance and resiliency of headless commerce applications. Companies that use traditional ecommerce platforms are accustomed to leveraging CDNs to bolster performance and resiliency, however most legacy CDNs cannot cache API responses because they are unable to instantly invalidate outdated content.
2. Route microservices intelligently
The APIs behind headless commerce are built on microservices, so they rely on routing direct requests to the appropriate API service. While load balancers are designed to accomplish this task — either from the cloud or hardware — most of these present potential problems for headless architectures.
For example, the majority of cloud-based load balancers (like those offered by most legacy CDNs) are built on top of DNS, so they can’t limit their ability to route traffic only by IP address and or push out routing changes instantly.
Additionally, application delivery controllers (ADCs) and many elastic load balancers can be susceptible to the thundering herd problem, which means that unexpectedly high request levels could result in availability issues or performance degradation.
On the other hand, a modern CDN built on an edge cloud network supports microservices by allowing companies to define content-aware routing decisions while providing instant convergence and failover. Unlike DNS-based solutions, companies get immediate and granular control. They can also provide improved performance and cost savings over ADCs, especially during flash traffic.
3. Personalize experiences for higher conversion
Gartner analysts have predicted that site personalization could increase business profits by up to 15%. Most companies recognize the value of offering tailored experiences to increase conversion and average order value, but there can be a significant technical challenge in headless architecture. With a legacy CDN, you’re unable to send visitor data between the heads and the back-end in real time, leaving you unable to truly personalize shopper experiences.
A modern CDN can use client insights to rapidly adjust the content you serve to visitors based on their location, device type, and language. Responses can be returned via API response, allowing you to serve different versions of your site or app depending on whether the shopper is accessing it from a mobile device, laptop, kiosk, smartwatch, or chatbot. You can also deliver different experiences by visitor type, which is useful if you want repeat customers to have a different experience than first-time visitors to further increase conversion.
4. Uncover and fix problems quickly
In order to ensure that visitors are having the intended experience across various sites and apps powered by headless commerce, you need real-time visibility of API requests and responses at the network layer. Without such data, you won’t be able to optimize the visitor experience or effectively troubleshoot problems.
User behavior analytics tools, like Google Analytics, are insufficient for APIs, and legacy CDNs are typically unable to stream logs from the edge in real time or expose any aspect of requests and responses.
A modern CDN can provide full API visibility by streaming logs on any aspect of requests and responses from the edge in near real time. This provides visibility into how visitors engage with your sites and apps, allowing you to identify trends and resolve any API delivery problems. Moreover, you can monitor the impact of new code deployments or API versioning and, in the event of an issue, roll back to a previous stable configuration in seconds. This visibility also can be used to respond to security events — giving you valuable insights to remediate issues quickly.
5. Don’t sacrifice security for speed
APIs and microservices provide the connective tissue in modern applications. The flip side is that threat actors know this and seek to abuse them to extract the valuable data they make available to legitimate users and business partners. This is underscored by Gartner’s prediction that API abuses will become the most frequent attack vector by 2022. So it’s critical to secure your platform without impacting the shopping experience or losing the agility that headless commerce can offer.
With a traditional CDN, there are perceived tradeoffs between performance and security. However, modern CDNs often provide advanced WAF, API, bot, and DDoS protection with minimal latency for a better shopper experience. Rate limiting further helps protect API resiliency and cost. Additionally, with most modern CDNs, security is baked in by sending traffic through one secure network, as opposed to legacy CDNs, which sometimes use a separate network for secure traffic. All of these combine to deliver secure headless commerce experiences without impairing performance.
Bringing the promise of headless commerce to life is just one of the many ways a modern CDN and edge-based serverless architecture help serve more dynamic content and improve user experiences. Explore more on this topic and what else you can do with a modern CDN in our Guide to the Modern CDN: security and performance for today’s developer.