Momento announces $15M Series A funding. Topics event bus released for general availability. Read more →
February 13, 2023 - 5 Min Read

Major release: v1.0 release of the Momento Node.js Client!

Check out some highlights from our node.js client SDK–and take it for a spin!

Chris Price
Author

Share

Today we’re excited to announce the 1.0 release of the Momento client for Node.js.

At Momento, simplicity is one of our north stars. We want the Momento experience to be simple and delightful for our users, on both the server side and the client side. On the server side, this means you just create your cache and go, and leave all of the scaling and operations concerns to us. On the client side, this means having an SDK that makes it simple and intuitive to write bug-free code that interacts with your cache, and not having to spend a ton of your time thinking about tuning, thread-safety, or other esoteric concerns.

This week we put the finishing touches on our Node.js client, with special attention and testing to ensure that the APIs feel easy to integrate into your existing applications and libraries.  Now we are excited to share the result of that hard work with you!

Sidenote: If you want to dive into the nitty gritty of how we think about designing, building, and tuning our SDKs, check out our Shockingly Simple blog series!

Node.js client library highlights

Async

All of the methods on the SimpleCacheClient are asynchronous, so you can consume it from your existing asynchronous node.js code without any concerns about blocking the event loop or bottlenecking your application. If your application is synchronous, no worries; our return values are all Promises, so you can use them from your synchronous code too.

Support for collection data types

The Node.js client is the first 1.0 Momento client that supports our new collection data types!  Now, in addition to storing strings and byte arrays in your Momento cache, you can also store lists, dictionaries, and sets!  For more info check out our collection data types announcement.  The Node.js collections APIs give you flexibility as to what JavaScript types you want to use to represent your results (Map vs Record, Set vs Array, etc.) for seamless integration into your existing code.

Discoverable response types for bug-free code

There are multiple types of responses you can get from an API call. For example, when you make a Get request to retrieve a value from your cache, the response might be a Hit, a Miss, or an Error. Depending on which of those you get back, there will be a very different set of properties that you need to access on the response. (For example, a Hit will have an associated value that contains the data from your cache, but a Miss will not.)  The Momento Node.js client uses TypeScript’s instanceof type guards to check which response type was received, and the TypeScript compiler can then infer the correct type to give you a strongly-typed response object for each of those cases.  This means that you can easily discover all of the possible return types in your IDE, and get compile-time type checking to prevent bugs. It’s always more pleasant to find a bug at compile time than at run time!

Flexible logging configuration

Node.js doesn’t have a single dominant logging framework, so the Momento Node.js client provides a simple MomentoLogger interface that is used throughout the SDK.  By default we provide a simple console logger, but you can easily implement this interface to support your favorite logging framework.  Then all of the log messages from the Momento SDK will be routed to the same destinations that the rest of your applications logs are sent to, and you can leverage all of your existing logging configuration and functionality.

Pre-built configurations

Tuning a network client can be a lot of work and the best settings can differ pretty dramatically between environments. For example, the best settings to allow you to explore and debug from your laptop probably aren’t the same settings that you want in your low-latency production environment in the cloud. To help keep things simple, the Momento Node.js client comes with several pre-built configurations designed for different types of environments like these. The configuration is fully customizable if you have a unique need that we haven’t accounted for, but we did our best to make sure we would have the 90% case covered so that you don’t need to spend your engineering hours on tuning.

Take the Node.js client for a spin today

You can get started with the 1.0 version of the Momento Node.js client right now. If you haven’t created a free Momento cache yet, visit our Momento getting started docs. You can try out the Momento CLI and Node.js SDK right from your browser, no software installation necessary!  Or if you are ready to try it out on your own machine, check out the docs for getting started with the Node.js client on GitHub

We hope you love it! And if you don’t, we’d love to hear about it so we can improve it further! File a GitHub issue or ping us at support@momentohq.com.

Coming Soon

Stay tuned for additional announcements about exciting new features. In the 1.0 version we support basic cache management operations, strings, bytes, and the new collections data types. We have plans for additional exciting features in subsequent releases – watch this space!

Share