A TypeScript-first AWS Lambda boilerplate focused on build/test tooling, shared documentation, and a clean project baseline.
This repository is being positioned as an AWS Lambda boilerplate. Today it provides reusable TypeScript, Rollup, Jest,
ESLint, Prettier, Docker, TypeDoc, and Serverless Framework scaffolding, while src/index.ts still contains
placeholder exports that should be replaced or extended as Lambda-specific modules are introduced.
tsconfig*.json)lib/dist/coveragedist/docsDockerfile and docker-compose.yamldist/book with custom dark themesrc/ Source files for Lambda handlers, utilities, and current placeholder exports
index.ts Current entry point used by Rollup and TypeDoc
handlers/direct-hello.ts Sample direct-invocation Lambda handler for Serverless Framework
handlers/hello.ts Sample API Gateway Lambda handler
handlers/scheduled.ts Sample scheduled (EventBridge/cron) Lambda handler
events/ Sample payloads for local invocation
hello.invoke.json Example event for direct invoke (`helloInvoke`)
hello.apigw.json Example API Gateway HTTP event for local invoke (`helloApi`)
serverless.yml Serverless Framework deployment configuration
test/ Jest test files (*.spec.ts)
docs/ Documentation and release history
styles/ Custom CSS for HonKit book theme
guide/deployments/ Deployment guides (quick-start and detailed)
book.json HonKit configuration
changes-log/ Per-date change logs
release-notes/ Per-version release notes
CHANGELOG.md Top-level changelog
CONTRIBUTING.md Contribution workflow
SECURITY.md Security policy
SUPPORT.md Support channels
docker/ Docker assets for landing page and docs book
nginx/ Nginx configuration and landing page HTML
docs.Dockerfile Multi-stage build for docs site
docker-compose.docs.yaml Compose config for docs/book site
npm install
npm run build
npm run test:run
npm run build Build library artifacts via Rollupnpm run test:run Run tests using Jestnpm run test Run lint and testsnpm run lint:run Run linternpm run lint:fix Run linter with auto-fixnpm run build:docs Generate API documentation with TypeDocnpm run build:docs:book Build responsive HonKit book with dark themenpm run build:static Build static site artifacts into dist/ (index.html, book/, docs/, coverage/)npm run serverless:print Print the resolved Serverless Framework configurationnpm run serverless:package Build and package the Lambda service into .serverless/npm run serverless:invoke:local Build and invoke the direct function locally with events/hello.invoke.jsonnpm run serverless:invoke:local:api Build and invoke the API Gateway function locally with events/hello.apigw.jsonnpm run serverless:deploy Build and deploy the sample functionnpm run serverless:deploy:function Update only the deployed sample function codenpm run serverless:remove Remove the deployed Serverless stacksrc/index.ts still exposes placeholder LibraryMetadata/HealthStatus types and helper functions from the original scaffold.serverless.yml now deploys a directly invokable sample function and a scheduled cron function without requiring API Gateway.src/handlers/direct-hello.ts provides the default Serverless Framework direct-invocation function.src/handlers/scheduled.ts provides a sample function triggered by an EventBridge schedule rule.src/handlers/hello.ts now provides a typed sample API Gateway handler using @types/aws-lambda.The repository includes serverless.yml with two deployed functions by default:
| Function key | Handler | Event source |
|---|---|---|
helloInvoke |
directHelloHandler |
None (direct invocation only) |
scheduledCron |
scheduledHandler |
EventBridge rule — rate(5 minutes) |
helloApi |
helloHandler |
API Gateway HTTP API — GET /hello, GET /hello/{name} |
Typical workflow:
npm run serverless:package
npm run serverless:invoke:local
npm run serverless:deploy
Serverless Framework v4 requires login (
serverless login) or a license key before running deployment commands.
After the first deployment, you can update only the function code with:
npm run serverless:deploy:function
To delete the stack:
npm run serverless:remove
The default Serverless Framework function is directHelloHandler, a simple Lambda example that:
name from the invocation payloadworld when no name is providedExample usage in serverless.yml is already wired to the built export:
functions:
helloInvoke:
handler: lib/index.min.directHelloHandler
Example event payload:
{
"name": "Bayu"
}
Example direct invocation response:
{
"message": "Hello, Bayu!",
"requestId": "request-direct-123",
"timestamp": "2026-05-12T00:00:00.000Z",
"input": {
"name": "Bayu",
"source": "event"
}
}
scheduledHandler is triggered by an EventBridge scheduled rule. It receives the raw ScheduledEvent envelope
and returns a structured log-friendly result:
{
"status": "ok",
"executedAt": "2026-05-12T08:00:00.000Z",
"requestId": "…",
"source": "aws.events",
"account": "123456789012",
"region": "ap-southeast-1"
}
The default schedule in serverless.yml is rate(5 minutes). To change it to a specific cron expression:
events:
- schedule:
rate: cron(0 8 * * ? *) # every day at 08:00 UTC
enabled: true
The boilerplate now includes helloHandler, a simple API Gateway HTTP API example that:
name from pathParameters.name or queryStringParameters.nameworld when no name is providedExample routes:
GET /helloGET /hello?name=BayuGET /hello/BayuExample usage:
import { helloHandler } from '@bayudwiyansatria/aws-lambda-boilerplate'
export const handler = helloHandler
Example response body:
{
"message": "Hello, Bayu!",
"requestId": "request-123",
"timestamp": "2026-05-12T00:00:00.000Z",
"input": {
"name": "Bayu",
"source": "query"
}
}
src/index.ts with Lambda-focused modules.test/ using the existing *.spec.ts Jest pattern.serverless.yml with additional functions or event sources when the target deployment approach is chosen.The boilerplate includes a complete documentation site built with TypeDoc and HonKit:
dist/docs/ on deploymentdist/book/ with dark theme, responsive design, and full-text searchlocalhost:8080 when running the docs containerBuild both TypeDoc and HonKit:
npm run build:docs
npm run build:docs:book
To serve the docs site with landing page, coverage, and book via Docker:
docker compose -f docker/docker-compose.docs.yaml up
Then visit http://localhost:8080 to see the landing page with links to:
Thanks to the open-source community and all contributors for support and inspiration.
MIT. See LICENSE.
Generated using TypeDoc