Nextjs with dynamic API Keys

We are building a SAAS, builder.io is working great. But we will use different spaces for different tenants. We are dynimically fetching API Keys and then calling builder.init on getServerSideProps . This ofcourse essentially runs on every request. I have two question:

  1. Is there any downside to this approach.
  2. Is there any limit for API Calling
  3. Any better way to do the same,

Hi @faisal-manzer welcome to the forum!

  1. As you mentioned initializing on every request could potentially slow down performance, even when requesting from the same space.
  2. There isn’t a limit on initializing Builder but there might be on listing keys, depending on your use case and how you plan on getting the keys.
  3. You could try creating a hook that handles changes on the keys and only fetch new content where and when necessary. But if you want to keep pre-rendering then I think your approach is still the only way to go.

Please note that you will need an enterprise plan or separate subscriptions for each space. You can read more about what features are available on each plan here. Happy to connect you with our sales team as well if needed!