JavaScript API Client v4 is released 🎉

Hi,

We are thrilled to announce the release of the Algolia API Client JavaScript v4! The most powerful Algolia JavaScript client ever. It’s faster, smaller, more flexible, and features the implementation of our Common API Client specifications.

The best news is that the new version is a minimal change to the API, so updating should take less than ten minutes: Upgrade Guide.

If you’re interested to learn more about what’s inside this client, let’s deep dive!

:green_salad: Reduced file size

Despite all additions, the API Client JavaScript v4 is actually smaller compared to the v3!

  • Lite version is 4.27 kb gzipped on v4, down from 13.21 kb on v3.
  • Default version is 7.44 kb gzipped on v4, down from 19.35 kb on v3.

That amounts to a combined 64% size decrease compared to the previous version.

:zero: Zero dependencies

Also, this new version reduced the number of dependencies from 15 => 0. Yes, that’s right - 0 dependencies. So there is no longer the risk of receiving third-party updates that might break the client.

:fire: Brings the DX one step further

We added a bunch of new helpers that aren’t just a simple mapping to API endpoints. Users are now able to replaceAllObjects with zero downtime, or even copyIndex between apps, and so much more! Here are some examples:

Some customers have use cases where a complex code is needed, so we are really happy to turn things more easy for them .

:muscle:t2: State of the art JavaScript

In addition, for optimal developer experience and type safety, the new release introduces strong typing as is fully written in TypeScript, so the customer is able to leverage optional static typing and type inference out-of-the-box.

:alembic: Redesigned architecture

Just like the v3, we ship with two versions: lite and default - those are predefined versions that help the customers to start quickly using the traditional: algoliasearch(appId, apiKey).

But now, thanks to a brand new redesigned architecture, you can build your own version of the client, adjusted to your own needs. Here is an example:

The customer can inject their own requester, their own logger, but also their own cache implementations. Good news is, even if you inject your concrete implementations, everything will still run under our retry strategy.

With this approach, we believe that we will able to answer to advanced use cases of our customers.

:raised_hands: You’d like to contribute?

You’d like to contribute? Before start, we want to let you know that your feedback is important to us! Please consider start using this v4 today! Found a bug or see something that can be improved?

Report it here: github.com/algolia/algoliasearch-client-javascript

You can also contact us or answer to the thread directly.

Thanks!

1 Like