A boilerplate for developing serverless applications with typescript and terraform.
- ✅
webpackto compile deployment packages. - ✅
jestand for testing - ✅
typescript-isto 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-fnsinto 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.tsand edit the file and filename. - Run
npm run deployand all files inlambda-fnswill 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