Hosting JavaScript Client SDKs for SaaS Systems

This blog post contains perspectives on hosting JavaScript client SDKs for SaaS systems such as headless content management systems. You can host JavaScript client SDKs from SaaS vendors on infrastructure that you manage or you can use infrastructure that the vendor manages. If you have opinions on this topic, please comment on this blog post.

First, decide whether to use JavaScript client SDKs. Optimally, abstract and otherwise insulate the CMS to a point where client-side code is not aware of its vendor, specifically by avoiding use of its SDKs and vendor-specific JSON formats.

If your client-side code uses vendor SDKs directly and you want full control of the SDK, or if your hosting infrastructure could significantly outperform the CMS vendor’s, then host the SDK on your own infrastructure. For example, according to documentation for the Contentstack SaaS headless CMS at Home – Documentation (contentstack.com):

/path/to/contentstack.min.js;

In development environments, you may not want to work with the minified version of the library.

For the following reasons, consider using the vendor’s infrastructure rather than hosting the libraries on yours:

  • The first response from your website to the browser includes a <script> element that triggers an HTTPS request that begins resolution for CMS vendor DNS entries, which may provide a slight performance advantage for subsequent requests to the CMS that retrieve content and media assets.
  • If the visitor has previously accessed a site that uses the same technique with the same CMS, then some or all of the relevant DNS entries may already be resolved, and the SDK is likely already cached.

For example, in the Contentstack documentation, the text above the <script> tag above states:

To use the JavaScript Delivery SDK, download it from here and include it in the <script> tag:

The text “here” is a link to the following URL, which contains an optimized version of the SDK hosted on the Contenstack global content delivery network for assets:

https://assets.contentstack.io/v3/assets/blt23180bf2502c7444/blt7c37c3a74961a31e/60794c381898af75a401dae0/contentstack-v3.13.1.min.js

So, you have at least three options:

  • Do not use the vendor’s SDK directly.
  • Copy the SDK to your own hosting infrastructure and reference that.
  • Reference the SDK hosted by the vendor.

In the last case, work with the vendor to determine a permanent library URLs for current and future versions of the SDK.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: