diff --git a/docs/content/guides/6.best-practices/2.data-fetching.md b/docs/content/guides/6.best-practices/2.data-fetching.md index e02816d2f6..d4416b5fb7 100644 --- a/docs/content/guides/6.best-practices/2.data-fetching.md +++ b/docs/content/guides/6.best-practices/2.data-fetching.md @@ -42,7 +42,8 @@ The rule of thumb is: _always use server-side fetching except for_: Alokai architecture introduces the Middleware in between the front-end application and the APIs. This adds two additional possible routes to our diagram, but most of the traffic should go through the middleware, because: -- it is cached on the CDN + + - it keeps your architecture simple - you can easily monitor middleware traffic in the console - enables [data federation](/middleware/guides/federation) @@ -58,13 +59,17 @@ Fortunately, we can reject the route between the server and the API, because: The direct route between the browser and API should be avoided, because it: - tightly couples storefront with the API, -- reduces performance by bypasses CDN cache. + + Use direct direct browser to API calls only when communicating via middleware is not possible or requires unnecessary effort. Sample scenarios when it might be valid to communicate directly between client and API: - the communication requires extremely low latency - e.g. voice or video stream - communication with API is done via some SDK that requires direct client (browser) interaction - e.g. analytics or authentication services + + + ## Examples