Storefront APIs versus UI API and Aura controllers
Key Takeaway
Storefront APIs give custom Lightning Web Components (LWCs) four advantages over platform UI APIs and Aura controllers: security, performance and scalability, convenience, and UI cohesiveness.
Storefront APIs are a set of APIs that custom LWCs, such as headers, footers and banners, use to connect to data and run store processes. Examples of those processes are adding a product to a cart or wishlist and applying a coupon to an order. Storefront APIs are supported in B2B and B2C stores built with LWR templates. They matter because components built on them get buyer entitlement guardrails, layered caching, data aggregation and page-wide reactivity.
Three kinds of Storefront APIs
Storefront APIs come in three kinds: Imperative APIs, Wire Adapters and Storefront Actions. Each kind differs in how and when it retrieves data. Together they fetch and display data for Commerce, Platform and CMS products.
| What it is | When it runs | |
|---|---|---|
| Imperative APIs | Process-oriented functions that change data and return an outcome | Usually when a page load or button click triggers them |
| Wire Adapters | Adapters that call a GET method to retrieve data from a hosted data source | When the LWC loads or updates |
| Storefront Actions | Events that trigger updates to closely related LWCs | On events such as adding an item to a cart or filtering search results on a product variant |