New StdLib Utils: SMS, Storage and Image Manipulation

At StdLib, we recently created a utility service, called utils, for our users. This service started with our desire to provide service templates for our users when they build new services and projects with our platform.

Introducing StdLib Utils

As we’ve grown and continued to use our own technology to move faster, it’s become clear to us that while our processes for building with microservices are simple, there have been times where we duplicated pieces of core functionality that we could have easily shared across projects. For instance, one of our engineers built an Alexa skill that sends an SMS, and few weeks later, another engineer incorporated SMS-based notifications into a hackathon project. Rather than building one service that covered these identical use-cases, each engineers built their own version of a microservice that sent SMS messages.

This inspired us to start releasing small, easy-to-use, yet powerful services under the utils account. We’re excited to show you what we’ve already built, and hope you find it valuable! Like all StdLib services, these utility services are available in Ruby, Python, Node, and in web browsers.

Easy, Simple, Key-Value Storage with StdLib and DynamoDB

utils.storage — highly available Key-Value storage service with DynamoDB

One of the main pain points for our users when they get started with small services is storage. No one wants to create a MongoDB cluster or set up PostgresDB when they just want to build a simple Alexa skill or Slack bot that just needs to store a couple of names or emails.

We’re happy to introduce our highly available key-value storage service (built on top of DynamoDB). It’s free and gives you the ability to save any JSON-serializable value to a key in just a few lines of code:

// Retrieve your Library Token at dashboard.stdlib.com/dashboard
const lib = require('lib')({token: STDLIB_LIBRARY_TOKEN});
// Set a String
lib.utils.storage.set('key', 'value', (err, value) => {
// Do something with result
});
// Get a key's value
lib.utils.storage.get('key', (err, value) => {
// Do something with result
});

It’s scoped to your StdLib user account, so be aware of that when using it with multiple services.

Read more about how to use it here.

Easy SMS Delivery with StdLib and Twilio

utils.sms — easy and fast SMS delivery with Twilio

As mentioned above, one use-case we’ve encountered several times while building our own apps with StdLib is texting yourself or others with the result of a service. This serves as an easy, simple way to integrate notifications into your projects. For instance, I created an Alexa skill that texts my girlfriend my ETA when I leave our office.

There are a ton of diverse and interesting use-cases with SMS and we wanted to make that experience very easy:

const lib = require('lib');

lib.utils.sms({
to: '415xxxxxxx',
body: 'Hello!'
}, (err, result) => {
// handle err
});

There’s rate limiting on how much you can use this (mainly for spam protection), but you shouldn’t run into it for normal use-cases.

Read more about how to use it here.

Easy Image Formatting with StdLib and ImageMagick

utils.image — image formatting service for files and AWS objects with ImageMagick

This service is the result of the experiences and headaches we went through while setting up and using ImageMagick. As awesome as ImageMagick is, it’s surprisingly hard to set up and use across a fleet of machines properly.

In response to this, we’ve released utils.image. It works for uploaded files as well as with AWS objects (you’ll have to pass in credentials that give it access to read the file — see here for details). With utils.image, you can resize, crop, blur, and otherwise manipulate any image programmatically with just a few lines of code:

const fs = require('fs');
const lib = require('lib');

const file = fs.readFileSync('./image-file.png');
// Resize and flip the image
lib.utils.image.format(file, {
resize: [300, 200],
flip: true
}, (err, convertedImage) => {
// Do something
});

Read more about how to use it here.


We’ve got plans to continue adding commonly used services to our utils service. If you’ve got any ideas for services you think would be valuable, feel free to tweet us @StdLibHQ!

If you haven’t heard of StdLib yet — check it out. We’d love to know what you think!


Jacob Lee is a software engineer at StdLib. He’s an ex-Googler who loves to play squash and hang out in the Sunset, where StdLib’s offices are located. Follow him on Twitter here!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.