Create FasterCreate Faster
AWS

Lambda (SST)

Serverless monorepo for AWS Lambda using SST Ion. Generates three Lambda functions behind API Gateway, SQS, and EventBridge, with a shared types package and GitHub Actions CI/CD using OIDC authentication.

Composition

Apps:

  • api — Hono (→ docs) + AWS Lambda adapter (→ docs)
  • cron — Node (→ docs), EventBridge scheduled handler
  • worker — Node (→ docs), SQS queue consumer

Shared packages:

  • @repo/shared — Typed message contracts (QueueMessage)

Project addons:

Architecture

sst.config.ts                          # SST Ion config (API Gateway + SQS + EventBridge)
.github/workflows/deploy.yml           # GitHub Actions with OIDC auth
apps/
├── api/src/
│   ├── app.ts                         # Hono routes and middleware
│   └── index.ts                       # Lambda handler via hono/aws-lambda
├── cron/src/
│   └── index.ts                       # EventBridge scheduled handler
└── worker/src/
    └── index.ts                       # SQS batch consumer with partial failure
packages/
└── shared/
    ├── src/types.ts                   # QueueMessage interface
    ├── package.json                   # @repo/shared exports
    └── tsconfig.json

What's included

SST Ion configuration defines the full infrastructure in sst.config.ts:

  • ApiGatewayV2 with a default route pointing to the Hono handler
  • Queue with a subscriber Lambda (the worker)
  • Cron on a 1-hour schedule triggering the cron handler
  • Stage-aware resource removal (retain in production, remove otherwise)

SQS worker with partial batch failure reporting:

  • Processes records individually, collecting failures per messageId
  • Returns batchItemFailures so only failed messages re-enter the queue
  • Messages are typed as QueueMessage from @repo/shared

EventBridge cron handler receives ScheduledEvent with request context logging.

GitHub Actions deploy workflow:

  • Triggers on push to main or manual dispatch with stage selection (staging/production)
  • OIDC-based AWS credentials (no long-lived keys)
  • Runs lint and build before sst deploy
  • Concurrency control per stage
  • aws-actions/configure-aws-credentials reads the role from the AWS_ROLE_ARN secret and the region from the AWS_REGION variable of the GitHub environment named after the stage

Extra dependencies

From blueprint packageJson:

  • @repo/shared — shared types package (workspace dependency)
  • @types/aws-lambda — Lambda event type definitions (dev)

Each app includes a build script: bun build src/index.ts --outfile dist/index.mjs --target node. SST bundles the handlers from src/ itself; this build only checks that the bundle builds, and its .mjs extension lets Node load the ES module without a MODULE_TYPELESS_PACKAGE_JSON warning, since no package.json declares "type": "module".

First deploy

The generated README.md walks through it in order: AWS credentials and region, sst install (the root tsc fails with Cannot find name '$config' until it has run), sst deploy --stage staging, a request to the live api URL, then the GitHub Actions setup: the OIDC identity provider, one IAM role per environment (staging, production) and the AWS_ROLE_ARN secret and AWS_REGION variable of each GitHub environment.

CLI usage

bunx create-faster my-lambda \
  --blueprint lambda-sst-hono \
  --git \
  --pm bun

Agent context

This blueprint ships AGENTS.md + docs/agents/ guides (architecture, infrastructure, messaging) so AI coding agents understand the project out of the box. See Agent Context.

On this page