/serverless-nodejs-starter

Template for Serverless Typescript Applications

Primary LanguageTypeScriptMIT LicenseMIT

Serverless Node.js Starter

A Serverless starter that adds ES6, TypeScript, linting, and unit test support. Part of the Serverless Stack guide.

Serverless Node.js Starter uses the serverless-esbuild plugin. It supports:

  • Generating optimized Lambda packages with Webpack
  • Using ESNext or TypeScript in your handler functions
  • Support for unit tests
    • Run yarn run test to run your tests
  • Sourcemaps for proper error messages
    • Error message show the correct line numbers
    • Works in production with CloudWatch
  • Lint your code with ESLint
  • No need to manage Webpack or Babel configs

Requirements

Installation

To create a new Serverless project.

$ serverless install --url https://github.com/renanwilliam/serverless-nodejs-starter --name my-project

Enter the new directory

$ cd my-project

Install the Node.js packages

$ yarn install

Usage

Deploy your project

$ serverless deploy

Deploy a single function

$ serverless deploy function -f hello

Running Tests

Run your tests using

$ npm run test

We use Jest to run our tests. You can read more about setting up your tests here.

Bundle

We use serverless-esbuild to create the bundle. It works with Typescript and Javascript projects.

Formatting

We use Prettier to format your code via npm run prettier-format.

Linting

We use Typescript ESLint to lint your code via npm run eslint.

Support

  • Open a new issue if you've found a bug or have some suggestions.
  • Or submit a pull request!