The Blog

Our latest insights, opinions and general musings as we float about on the vast ocean of tech we call home.

Introducing our open-source Serverless starter kit

Introducing our open-source Serverless starter kit

We are excited to announce that we have released our Serverless framework starter kit as an open-source project on GitHub. Following the release of our Gatsby starter kits this is the next step in our efforts to give back to the community.

Check out the code on GitHub!

The starter kit is an opinionated boilerplate for a Serverless app running in AWS. It's been designed to offer as much future-proofing as possible, a tricky challenge in the fast-moving JavaScript ecosystem! Our starting point was the fantastic "Modern Serverless Starter Kit" by Postlight. While that project has "modern" in the name we felt that we could safely go a bit closer to the cutting edge.

Features

When designing the Serverless starter kit we had a few key requirements in mind which directly translate into features:

  • Node 8 support. This was a key one for us. AWS has supported Node 8 as a Lambda runtime environment since April 2018, bringing native support for a whole host of recent ECMAScript features (including async/await), performance improvements and reduced memory consumption thanks to the more recent version of V8.

  • Webpack 4 support. It was important that we could bundle our Lambda function code with Webpack to reduce the size of the package uploaded to AWS. Webpack 4 is the latest and greatest version, offering major speed improvements and much simpler configuration compared to previous iterations.

  • Babel 7 support. This one is more a straightforward case of future- proofing. There's currently little technical reason to favour Babel 7 over the arguably more stable version 6 but it's fun to push the boundaries sometimes!

  • Local development support. If you have to deploy functions to AWS every time you make a change the developer experience is somewhat poor. Fortunately this problem has been solved by the serverless-offline plugin which emulates AWS Lambda and API Gateway locally.

  • Jest support. Unit testing is important. Jest is, in our opinion, the best tool for the job. The starter kit includes Jest configuration to automatically collect code coverage information.

  • ESLint configuration. We're firm believers in the need for consistent code and therefore the starter kit ships with a pre-configured ESLint set up, along with Husky and lint-staged to efficiently lint and auto-fix code at commit time.

Usage

The Serverless CLI allows you to scaffold a new Serverless application from a template on GitHub. Run the following command to use our starter kit:

serverless create --template-url https://github.com/orangejellyfish/serverless-starter --path your/local/path

What's next?

We think that the feature set provided by this starter kit give you a really solid start for any Serverless application but it's only the basics. Watch this space for more advanced kits, built upon this one, in the future, adding pre- configured support for things like DynamoDB.

Check out the code on GitHub!

Want to know more?

Get in touch.