A boilerplate for developing serverless applications with typescript and terraform.
- ✅
webpack
to compile deployment packages. - ✅
jest
and for testing - ✅
typescript-is
to validate event input - ✅ Minimal terraform configuration to manage deployment.
I believe both can be installed via brew (`brew install terraform aws)
npm run build
- Turns all typescript files inlambda-fns
into lambda deployment packages (To deploy run )npm run test
- Runs all testsnpm run test:watch
- Rerun tests when files changenpm run plan
- Display terraform deployment plan. Shows you what AWS resources will be created.npm run apply
- Deploys project to aws with terraformnpm run destroy
- Tear down project on aws with terraform
- Simply duplicate
lambda-fns/example.ts
and edit the file and filename. - Run
npm run deploy
and all files inlambda-fns
will be deployed on AWS as lambda handlers.
This boilerplate uses typescript-is
to check types at runtime, you can use this as an easy way to validate lambda input, the example handler at lambda-fns/example.ts
uses assertType<MyEvent>(event)
to validate the type of the event.
This repository uses jest
and ts-jest
.
Every lambda function should have an accompanying test file in lambda-fns/__tests__
.
If you have suggestions for what can be improved, please open an issue
Made by Julian, follow me on twitter