# generator-serverless-scaffolder

> Generate Lambda functions deployable with Terraform IAC. Includes Webpack, Jest testing and an optional API Gateway module

Latest version **1.3.9** (published 2019-10-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install generator-serverless-scaffolder
pnpm add generator-serverless-scaffolder
yarn add generator-serverless-scaffolder
bun add generator-serverless-scaffolder
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.9 |
| Published | 2019-10-02 |
| First published | 2019-08-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 120.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Blair Calderwood |
| Maintainers | bcalderwood, mattchilds |
| Keywords | serverless, AWS, Lambda, API Gateway, scaffolder, yeoman, generator, node, javascript, jest, webpack, code-coverage, yeoman-generator |

## Links

- npm: https://www.npmjs.com/package/generator-serverless-scaffolder
- Repository: https://github.com/blaircalderwood/serverless-scaffolder
- Homepage: https://github.com/blaircalderwood/serverless-scaffolder#readme
- Issues: https://github.com/blaircalderwood/serverless-scaffolder/issues
- npm.io page: https://npm.io/package/generator-serverless-scaffolder

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.1.0
- [yosay](https://npm.io/package/yosay.md) ^2.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [yeoman-generator](https://npm.io/package/yeoman-generator.md) ^2.0.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.3.9 (latest) — 2019-10-02
- 1.3.6 (dev) — 2019-10-15
- 1.4.0 — 2019-10-07
- 1.3.5 — 2019-10-02
- 1.3.4 — 2019-10-02
- 1.3.1 — 2019-10-02
- 1.3.0 — 2019-09-10
- 1.2.12 — 2019-09-09
- 1.2.8 — 2019-09-09
- 0.1.2 — 2019-08-22
- 0.1.1 — 2019-08-22
- 0.1.0 — 2019-08-20
- 0.0.7 — 2019-08-12
- 0.0.6 — 2019-08-06
- 0.0.5 — 2019-08-06
- … 4 more at https://npm.io/package/generator-serverless-scaffolder/versions

## README

# Serverless Scaffolder

The Serverless Scaffolder is a highly opinionated AWS Lambda generator built using the Yeoman scaffolding tool. This tool is fantastic for spinning up new Lambda projects very quickly and so works well in conjunction with a microservices based architecture.

## Getting Started

Install Yeoman and the scaffolder via npm:

```bash
npm install -g yo
npm install -g generator-serverless-scaffolder
```

Move into the directory you wish to create your app in (e.g. projects/) and run the generator:

```bash
yo serverless-scaffolder
```

If you want to generate the project with full CodeBuild / CodePipeline and Lambda Terraform IAC then run with the `--iac` flag.

```bash
yo serverless-scaffolder --iac
```

Answer the questions when prompted. The app will now be generated with everything you need to start a Lambda based project.

## What is generated?

- src folder with index.js and Lambda entry point function
- Linter with opinionated linting rules
- .gitignore file which includes files you will typically want to keep out of your git repository
- .nvmrc which locks the Lambda to Node version 10.14.1. This can be changed if needed. To use the version included here install nvm and run `nvm use`
- Pre-commit rules which (among other things) ensures AWS keys are not accidentally posted to a git repository (pre-commit will need to be installed for this to work)
- The Jest testing suite to unit test code
- A package.json file with all the necessarry npm installs and commands to get you started developing Lambda functions
- A Readme with all the information you'll need to get started

## Subgenerators

### Service

To generate a new service in the `src/services` folder of your generated project run

```bash
yo serverless-scaffolder:service
```

This will create a new service class and Jest test file to unit test the aforementioned class.

### Util

To generate a new set of utils in the `src/utils` folder of your generated project run

```bash
yo serverless-scaffolder:util
```

This will create a new util file and Jest test file to unit test the aforementioned functions.

### Constants

To generate a new constants file in the `src/constants` folder of your generated project run

```bash
yo serverless-scaffolder:constants
```

This will create a new constants file.

### Errors

To generate a new error type file in the `src/errors` folder of your generated project run

```bash
yo serverless-scaffolder:error
```

This will create a new error class which can then be imported and thrown in any project JavaScript file.

### Infrastructure As Code

To generate all Terraform associated with standing up CodeBuild/CodePipeline and Lambda for a dev/test environment the following should be run from the root directory

```bash
yo serverless-scaffolder:iac
```

This will create all of the associated IAC in the `iac/` folder. If only the CI or the Lambda IAC is needed please run one of the subcommands found below.

#### Infrastructure As Code - CI (iac-ci)

To generate all associated Terraform to standup CodeBuild/CodePipeline for a dev/test environment located in `iac/`. This should be run from the root folder of your generated project.

```bash
yo serverless-scaffolder:iac-ci
```

All code will be generated in `iac/`.

#### Infrastructure As Code - Lambda (iac-lambda)

To generate all associated Terraform to standup lambda infrastructure for a dev/test environment. This should be run from the root folder of your generated project.

```bash
yo serverless-scaffolder:iac-lambda
```

All code will be generated in `iac/lambda`

#### Infrastructure As Code - API Gateway (iac-apigateway)

To generate all associated Terraform to standup API Gateway infrastructure for a dev/test environment. This should be run from the root folder of your generated project. The terraform should be ran after the Lambda terraform, as it depends on a lambda function being deployed in the same AWS account.

```bash
yo serverless-scaffolder:iac-apigateway
```

All code will be generated in `iac/apigateway`

## License

Apache-2.0 © [Blair Calderwood](https://github.com/blaircalderwood)

### Contributors

| [![Blair Calderwood][blaircalderwood_avatar]][blaircalderwood_homepage]<br/>[Blair Calderwood][blaircalderwood_homepage] | [![Matt Childs][mattchilds1_avatar]][mattchilds1_homepage]<br/>[Matt Childs][mattchilds1_homepage] | [![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]<br/>[James Woolfenden][jameswoolfenden_homepage] |
| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |


[blaircalderwood_homepage]: https://github.com/blaircalderwood
[blaircalderwood_avatar]: https://github.com/blaircalderwood.png?size=150
[mattchilds1_homepage]: https://github.com/mattchilds1
[mattchilds1_avatar]: https://github.com/mattchilds1.png?size=150
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150

---
_Source: https://npm.io/package/generator-serverless-scaffolder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
