Skip to content

Latest commit

 

History

History

node-v10.x-aws-serverless-with-serverless-bundle

PROJECT-NAME

This project was generated using https://github.com/UnlyEd/boilerplate-generator/tree/master/templates/node-v10.x-aws-serverless-with-serverless-bundle

This project is similar to node-v10.x-aws-serverless, but uses https://github.com/AnomalyInnovations/serverless-bundle to simplify the babel/webpack configuration. Use this for a quick POC/test project. Beware that you won't be able to customise webpack/babel configurations using serverless-bundle (simplicity over flexibility). For instance, it's not possible to customise webpack in order to configure Sentry. The Sentry integration has therefore been removed from this boilerplate.

In case of any doubt, don't use this boilerplate and use node-v10.x-aws-serverless instead.

Clone this boilerplate

See instructions

TODO (after generating a project from this boilerplate)

  • Rename occurrences of PROJECT-NAME
  • Look for TODO
    • Use your own AWS profile instead of sandbox
  • Enable sentry, if needed (or delete)
    • serverless.yml
    • .sentryclirc
  • Delete this

Features/defaults provided by this boilerplate

  • Usage of https://github.com/AnomalyInnovations/serverless-bundle in order to simplify the webpack/babel setup, at the cost of flexibility
  • SLS handles stages/environments and settings per environment (memorySize, AWS profile, etc.)
    • "staging" and "production" environments built-in
  • SLS scripts (helpers)
  • Environment variables built-in by default (both from .env* files and serverless.yml), using dotenv and @unly/serverless-env-copy-plugin
  • Jest for testing
  • Use YARN for packaging
  • 30s timeout on lambda (max allowed)
  • 128Mo RAM on lambda (min allowed)
  • 60 days logs retention (avoid infinite logs and lambda price increase)
  • Enable API GW logs by default

Getting started

Install

yarn install

Use

yarn start

Deploy

yarn deploy # Deploy to staging env
NODE_ENV=production yarn deploy # Deploy to production env

Logs

yarn logs:status

Similar to reading the logs from the AWS Console

Test

yarn test
yarn test:coverage

Release

Will prompt version to release, run tests, commit/push commit + tag

yarn release

Check the ./package.json file to see what other utility scripts are available