/serverless-boilerplate

Boilerplate for serverless framework applications

Primary LanguageTypeScriptMIT LicenseMIT

Current travis build: build status

Boilerplate code for rapidly creating ready-to-deploy Serverless Framework services.

Quick Start

  • Install
npm install

rename .env.dist to .env, fill all information

  • Create lambda or workflow
npm run plop

Development Local

  • docker-compose up
  • npm install
  • rename .env.dist to .env
  • fill all information
  • npm run run-migrations
  • npm run dev

Debugging locally

Serverless uses workers to run lambdas locally. To debug them in your IDE you need to add --useInProcess flag, or run the following command:

npm run dev-with-debug

Run workflow locally

npm run start-workflow --workflow=NAME_OF_THE_WORKFLOW

Follow workflow logs

To follow all the logs from the step function executions you can use the command:

npm run get-sf-logs

Develop workflow

We support ASL for Step Functions. Make sure to install AWS Toolkit so you can render graph for step functions and validate its syntax easily.

SonarQube configuration

Before deployment, please ensure that a related SonarQube project has been created. After that set proper repository variables (SONAR_TOKEN and SONAR_HOST_URL) and properties in sonar-project.properties file.

Deploy

The best choice for deployment is the bitbucket pipeline.

Deployment pipeline consist of two steps:

  1. compile (automated start)
    • build
    • run lambda offline
    • run test
  2. deploy (user action required)

Other good source of information

What do we use for testing lambdas?

  1. supertest
  2. mocha

Here you can check example tests: handler.spec.ts

What do we use for validating schemas?

We use zod for schema validation.

Issues:

If you notice any issues while using, let as know on github. Security issues, please send on email

You may also like our other projects:

About us:

The Software Housetsh.png

License

license

This project is licensed under the terms of the MIT license.