Hey, team! I just started using GrowthBook in our ...
# ask-questions
n
Hey, team! I just started using GrowthBook in our React application. Going through the documentation, I saw a comment that got me intrigued:
Copy code
// Load feature definitions from API
  // In production, we recommend putting a CDN in front of the API endpoint
  fetch('api-endpoint')
    .then((res) => res.json())
    .then((json) => {
      growthbook.setFeatures(json.features);
    });
What I’d like to know is why are putting a CDN in front of the API endpoint recommended in this instance? Is the API endpoint private?
f
its more about reducing 3rd party dependancies
if you’re using our cloud, we have a CDN already
if you’re self hosting, that’s up to you
you can also cache it or store it locally for speed
n
Oooh, okay. That makes sense. We are self hosting.
I’ll definitely implement caching for this feature.
Tyvm 😌
f
sure thing
f
@fresh-football-47124 what do you have to cache locally in my app? The response from the API endpoint (directly or behind CDN)?
… or is it needed to request the API for each user/page request?
f
we encourage caching of the feature json
is that what you mean?
f
Yes indeed. So the assignment also works locally (because you get all experiments + config in that JSON)? Does this approach also works for distributed frontend apps?