A TypeScript template for AWS Lambda functions with business logic separation and Cucumber testing.
- Node.js 22 or higher
- npm
- Install dependencies:
npm install
├── src/
│ └── handler.ts # Main Lambda handler
├── business/
│ └── example-service.ts # Business logic and services
├── specs/
│ └── example.feature # Gherkin test specifications
├── dist/ # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md
- Build TypeScript:
npm run build - Run tests:
npm run test - Lint code:
npm run lint - Clean build:
npm run clean
Test the handler directly from command line:
# Run with default test data
npx ts-node src/handler.ts
# Run with custom JSON data
npx ts-node src/handler.ts '{"name": "test", "value": 123}'- Implement your business logic in the
business/folder - Update the handler in
src/handler.tsto use your business services - Write Gherkin specifications in the
specs/folder - Build and test before deployment
This template includes a GitHub Actions CI workflow that automatically runs on pull requests to the main branch. The CI pipeline:
- Runs
npm testto execute Cucumber BDD tests - Runs
npm run lintfor code quality checks - Runs
npm run buildto verify TypeScript compilation
- purecloud-platform-client-v2: PureCloud SDK
- @cucumber/cucumber: BDD testing framework
- TypeScript: Type-safe JavaScript development
- Write comprehensive Gherkin tests in specs/
- Create your business services in the business/ folder
- Update handler.ts with your specific business logic