{"id":29436865,"url":"https://github.com/stone-foundation/stone-js-aws-lambda-adapter","last_synced_at":"2026-01-20T16:35:39.853Z","repository":{"id":234701966,"uuid":"789389540","full_name":"stone-foundation/stone-js-aws-lambda-adapter","owner":"stone-foundation","description":"General-purpose AWS Lambda adapter for Stone.js, run any app in serverless environments, beyond HTTP. Supports queues, events, schedulers, and background jobs.","archived":false,"fork":false,"pushed_at":"2025-06-14T19:56:49.000Z","size":312,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T20:12:52.861Z","etag":null,"topics":["aws-lambda","context-aware","continuum-architecture","javascript","official-stonejs","stone-foundation","stonejs","stonejs-adapter","typescript"],"latest_commit_sha":null,"homepage":"https://stonejs.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stone-foundation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-04-20T12:10:43.000Z","updated_at":"2025-06-14T19:55:33.000Z","dependencies_parsed_at":"2024-05-20T01:29:28.080Z","dependency_job_id":"cf8dd7e8-172b-4319-bfd0-166bc6bac1c6","html_url":"https://github.com/stone-foundation/stone-js-aws-lambda-adapter","commit_stats":null,"previous_names":["stonemjs/aws-middleware","stonemjs/aws-lambda-adapter","stone-foundation/stone-js-aws-lambda-adapter"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/stone-foundation/stone-js-aws-lambda-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-aws-lambda-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-aws-lambda-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-aws-lambda-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-aws-lambda-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stone-foundation","download_url":"https://codeload.github.com/stone-foundation/stone-js-aws-lambda-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-aws-lambda-adapter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265091734,"owners_count":23710033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","context-aware","continuum-architecture","javascript","official-stonejs","stone-foundation","stonejs","stonejs-adapter","typescript"],"created_at":"2025-07-13T05:06:54.548Z","updated_at":"2026-01-20T16:35:39.816Z","avatar_url":"https://github.com/stone-foundation.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stone.js - AWS Lambda Adapter\n\n[![npm](https://img.shields.io/npm/l/@stone-js/aws-lambda-adapter)](https://opensource.org/licenses/MIT)\n[![npm](https://img.shields.io/npm/v/@stone-js/aws-lambda-adapter)](https://www.npmjs.com/package/@stone-js/aws-lambda-adapter)\n[![npm](https://img.shields.io/npm/dm/@stone-js/aws-lambda-adapter)](https://www.npmjs.com/package/@stone-js/aws-lambda-adapter)\n![Maintenance](https://img.shields.io/maintenance/yes/2025)\n[![Build Status](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/actions/workflows/main.yml/badge.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/actions/workflows/main.yml)\n[![Publish Package to npmjs](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/actions/workflows/release.yml/badge.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/actions/workflows/release.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-aws-lambda-adapter\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-aws-lambda-adapter)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-aws-lambda-adapter\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-aws-lambda-adapter)\n[![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](./SECURITY.md)\n[![CodeQL](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/security/code-scanning)\n[![Dependabot Status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/network/updates)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThe **AWS Lambda Adapter** allows you to deploy any Stone.js application as a general-purpose Lambda function, not tied to HTTP. Whether you're building background jobs, event processors, queue consumers, or cron-based automation, this adapter brings the full power of Continuum Architecture to the serverless world.\n\n---\n\n## Introduction\n\nIn Stone.js, **adapters** connect your app to the outside world. The AWS Lambda Adapter enables your logic to run in any AWS Lambda context, triggered by SQS, EventBridge, CloudWatch, or even a custom invocation.\n\nThis adapter captures the Lambda `event` and `context`, wraps them in a consistent `IncomingEvent`, and allows you to produce a clean `OutgoingResponse`, or nothing at all, if your function is fire-and-forget.\n\nThe result? One system, one lifecycle, one architectural model, everywhere.\n\n## Installation\n\n```bash\nnpm install @stone-js/aws-lambda-adapter\n```\n\n\u003e This package is **pure ESM**. Make sure your project uses ESM (`\"type\": \"module\"` in `package.json`) or configure your tooling accordingly.\n\n## Usage\n\nYou can register the adapter via class decorators or programmatically using the blueprint.\n\n### Declarative API\n\n```ts\nimport { AwsLambda } from '@stone-js/aws-lambda-adapter'\nimport { StoneApp, IncomingEvent, IEventHandler } from '@stone-js/core'\n\n@StoneApp()\n@AwsLambda()\nexport class LambdaHandler implements IEventHandler\u003cIncomingEvent\u003e {\n  async handle(event: IncomingEvent) {\n    const payload = event.get\u003cany\u003e('payload')\n    // Process message or do background work\n    return { success: true, received: payload }\n  }\n}\n```\n\n### Imperative API\n\n```ts\nimport { defineStoneApp, IncomingEvent } from '@stone-js/core'\nimport { awsLambdaAdapterBlueprint } from '@stone-js/aws-lambda-adapter'\n\nconst handler = async (event: IncomingEvent) =\u003e {\n  const task = event.get\u003cstring\u003e('task')\n  console.log(`Processing task: ${task}`)\n}\n\nexport const App = defineStoneApp(handler, {}, [awsLambdaAdapterBlueprint])\n```\n\n## What It Enables\n\n* **General-Purpose Lambda Support**\n  Process any AWS Lambda invocation, from SQS to EventBridge, without HTTP assumptions.\n\n* **Full Continuum Integration**\n  The raw Lambda event and context become cleanly wrapped in a Stone `IncomingEvent`.\n\n* **Minimal Setup, Max Power**\n  Start with a single function, scale to a complex pipeline, no boilerplate required.\n\n* **No Vendor Lock-in**\n  The logic is decoupled from Lambda. You can reuse and test it outside of AWS with zero changes.\n\n* **Flexible Output Handling**\n  Return an `OutgoingResponse`, throw errors, or simply return `void`, your flow, your rules.\n\n* **Lifecycle Hooks**\n  Define `onStart`, `onStop`, and hook into adapter middleware.\n\n* **First-Class TypeScript Support**\n  All context and behavior are typed and autocompleted out of the box.\n\n## Configuration Options\n\nThe AWS Lambda Adapter inherits the base Stone.js `AdapterConfig` type. It does not define custom options, but you can configure:\n\n| Option          | Type                                      | Description                                      |\n| --------------- | ----------------------------------------- | ------------------------------------------------ |\n| `default`       | `boolean`                                 | Set as the default adapter for your app          |\n| `alias`         | `string`                                  | Optional name to reference this adapter          |\n| `current`       | `boolean`                                 | Marks this adapter as active at runtime          |\n| `middleware[]`  | `AdapterMixedPipeType[]`                  | Middleware executed during the adapter lifecycle |\n| `errorHandlers` | `Record\u003cstring, MetaAdapterErrorHandler\u003e` | Customize error response formatting or behavior  |\n\n## Adapter Context Shape\n\nDuring execution, adapter middleware and hooks receive a full context object:\n\n```ts\ninterface AwsLambdaAdapterContext {\n  rawEvent: unknown;              // The raw AWS Lambda event input\n  rawResponse?: unknown;          // Optionally the return response (if expected)\n  executionContext: LambdaContext; // AWS Lambda context object\n  incomingEvent?: IncomingEvent;\n  outgoingResponse?: OutgoingResponse;\n  incomingEventBuilder: IAdapterEventBuilder\u003cany, IncomingEvent\u003e;\n  rawResponseBuilder: IAdapterEventBuilder\u003cany, any\u003e;\n}\n```\n\nThis allows for full introspection and control at all stages of execution, including advanced transformation and diagnostics.\n\n## Summary\n\nThe `@stone-js/aws-lambda-adapter` bridges your system with AWS Lambda, but without compromising your architecture. Whether you're building automation scripts, stream processors, or serverless services, this adapter keeps your code structured, composable, and future-proof.\n\nBuild it once. Deploy it anywhere.\n\n## Learn More\n\nThis package is part of the Stone.js ecosystem, a JavaScript framework for cloud-native applications built on the Continuum Architecture.\n\nExplore the full documentation: [https://stonejs.dev](https://stonejs.dev)\n\n## API documentation\n\n* [API](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/blob/main/docs)\n\n## Contributing\n\nSee [Contributing Guide](https://github.com/stone-foundation/stone-js-aws-lambda-adapter/blob/main/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstone-foundation%2Fstone-js-aws-lambda-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstone-foundation%2Fstone-js-aws-lambda-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstone-foundation%2Fstone-js-aws-lambda-adapter/lists"}