Skip to content

feat: add AWS Lambda deployment target#116

Merged
PAMulligan merged 1 commit into
mainfrom
32-add-aws-lambda-deployment-target
Jun 12, 2026
Merged

feat: add AWS Lambda deployment target#116
PAMulligan merged 1 commit into
mainfrom
32-add-aws-lambda-deployment-target

Conversation

@PAMulligan

Copy link
Copy Markdown
Contributor

Summary

Adds AWS Lambda as Nerva's third deployment target, alongside Cloudflare Workers and Node.js/Docker. Generated projects deploy as a single Lambda function behind an API Gateway HTTP API (payload format 2.0) via AWS SAM, with esbuild producing a single-file bundle and GitHub OIDC handling CI/CD credentials.

Closes #32

Changes

  • setup-project.sh --lambda — new platform branch: copies SAM/esbuild/compose templates, adds build:lambda + deploy package scripts, local dev via src/dev.ts (@hono/node-server), writes .env.example, drops the OIDC deploy workflow into .github/workflows/, and generates README sections with cold start optimization notes and the Lambda Web Adapter container alternative
  • templates/aws-lambda/template.yaml (SAM, AWS::Serverless::HttpApi, nodejs22.x on arm64, 512 MB, $default catch-all route), samconfig.toml, esbuild.config.mjs, docker-compose.yml (local Postgres), deploy.yml (GitHub Actions with OIDC — id-token: write, aws-actions/configure-aws-credentials, setup-sam)
  • templates/snippets/aws-lambda/ — typechecked app sources including the Lambda entry point:
    import { handle } from 'hono/aws-lambda';
    import app from './index.js';
    export const handler = handle(app);
  • CI — new "Type-check AWS Lambda snippets" step (tsconfig.lambda.json); templates/aws-lambda added to the required-dirs check
  • Skills/config/docsdeployment-config-generator gains Step 2c (SAM + esbuild + OIDC patterns), schema-intake target unions and interview updated, pipeline.config.json gains awsLambda block, target mentions updated across CLAUDE.md/README/onboarding/pipeline docs

Deviations from the issue

  1. The issue asks for an @hono/aws-lambda dependency — that package does not exist. Hono ships the adapter inside core hono as hono/aws-lambda, so no new runtime dependency is needed (only esbuild as a dev dependency in generated projects).
  2. Bundling uses a plain esbuild script + sam deploy rather than sam build, whose esbuild builder shells out to npm and conflicts with pnpm projects.

Test plan

  • bash -n + shellcheck (CI severity) on setup-project.sh; JSON validation of all touched configs
  • tsc --noEmit passes for all three snippet tsconfigs (cloudflare, node, lambda)
  • Generated a real --lambda project: 20/20 Vitest tests pass; pnpm build:lambda emits dist/lambda.mjs; invoking the bundled handler with a simulated API Gateway v2 $default event returns the app's 200 response
  • Regressions: real --node project (20/20 tests, no leaked lambda scripts) and --cloudflare dry-run unchanged
  • YAML validation of deploy.yml, docker-compose.yml, and edited ci.yml

🤖 Generated with Claude Code

Add --lambda to setup-project.sh alongside --cloudflare and --node.
Generated projects get a SAM template (API Gateway HTTP API, nodejs22.x
on arm64), an esbuild single-file bundle build, a Postgres compose file
for local dev, an OIDC-based GitHub Actions deploy workflow, and cold
start optimization notes in the README.

- templates/aws-lambda/: template.yaml, samconfig.toml,
  esbuild.config.mjs, docker-compose.yml, deploy.yml
- templates/snippets/aws-lambda/: app entry, lambda.handler wrapper
  (hono/aws-lambda from core hono -- @hono/aws-lambda does not exist),
  local dev server, config, health route + tests
- CI: type-check the new snippets, require templates/aws-lambda
- deployment-config-generator and schema-intake skills,
  pipeline.config.json, and docs updated for the new target

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PAMulligan PAMulligan linked an issue Jun 12, 2026 that may be closed by this pull request
8 tasks
@github-actions github-actions Bot added area: agents Claude Code agents area: skills Claude Code skills area: scripts Automation scripts area: templates Starter templates area: pipeline Build pipeline area: ci-cd CI/CD workflows area: docs Documentation labels Jun 12, 2026
@PAMulligan PAMulligan added enhancement New feature or request area: deployment Deployment targets labels Jun 12, 2026
@PAMulligan PAMulligan self-assigned this Jun 12, 2026
@PAMulligan PAMulligan merged commit c05990b into main Jun 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Claude Code agents area: ci-cd CI/CD workflows area: deployment Deployment targets area: docs Documentation area: pipeline Build pipeline area: scripts Automation scripts area: skills Claude Code skills area: templates Starter templates enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add AWS Lambda deployment target

1 participant