- Opinionated NodeJS boilerplate for a AWS serverless app
- You plan to use DynamoDB as your data storage
- You want to use an ORM
- You want to use a simple
x-api-token
as your authorizer - You want to leverage ExpressJS(for a lot of good reasons) on a serverless environment
- You want to be able to work locally on your machine
- You want to bundle you app before you deploy(smaller builds)
- You want to prevent your app from having cold starts(concurrency configurable) see concurrency option
- You want to be able to version your app & save last X number of versions(3 default)
- serverless-http - Enable an express app to work seamlessly with serverless
- dynogels - DynamoDB ORM
- Dotenv-safe - environment manager
- Mocha / nyc - Testing / cover
- Eslint - linter - Base:AirBnB
- Winston - Logger
- serverless-dotenv-plugin
- serverless-dynamodb-local
- serverless-dynamodb-autoscaling
- serverless-plugin-optimize
- serverless-domain-manager
- serverless-add-api-key
- serverless-prune-plugin
- serverless-plugin-warmup
- serverless-offline
- NodeJS v7.6+
- Yarn v1.5+
$ yarn global add serverless
$ git clone https://github.com/shierro/node-serverless-boilerplate <project_name>
$ cd <project_name> && yarn install
$ yarn db:install
$ cp serverless-template.yml serverless.yml
Change serverless.yml dummy config to match your needs.
$ cp .env.example .env
Change .env vars with the actual values
$ STAGE=dev API_KEY=LOCAL yarn start
$ /* Deploy to dev */
$ APP_ROUTE=users STAGE=dev yarn deploy
$ /* Deploy to staging */
$ APP_ROUTE=users STAGE=staging yarn deploy
$ /* Deploy to prod */
$ APP_ROUTE=users STAGE=prod yarn deploy
$ yarn cover