{"id":22771022,"url":"https://github.com/evilkiwi/lamware","last_synced_at":"2025-04-15T05:31:16.346Z","repository":{"id":44147485,"uuid":"472578700","full_name":"evilkiwi/lamware","owner":"evilkiwi","description":"AWS Lambda Middleware design pattern","archived":false,"fork":false,"pushed_at":"2023-03-28T12:07:17.000Z","size":2949,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T18:05:20.624Z","etag":null,"topics":["async","aws","framework","lambda","middleware","typescript"],"latest_commit_sha":null,"homepage":"https://docs.evil.kiwi/lamware/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evilkiwi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"evilkiwi"}},"created_at":"2022-03-22T01:54:12.000Z","updated_at":"2024-08-06T18:47:23.000Z","dependencies_parsed_at":"2024-06-21T13:14:44.543Z","dependency_job_id":"99531a7e-81c2-4cf7-8bca-6a83848b45f9","html_url":"https://github.com/evilkiwi/lamware","commit_stats":{"total_commits":151,"total_committers":6,"mean_commits":"25.166666666666668","dds":0.4304635761589404,"last_synced_commit":"0bb4871bc142ef15679727a51a93f4f36b9477e5"},"previous_names":[],"tags_count":456,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Flamware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Flamware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Flamware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Flamware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evilkiwi","download_url":"https://codeload.github.com/evilkiwi/lamware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249014819,"owners_count":21198677,"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":["async","aws","framework","lambda","middleware","typescript"],"created_at":"2024-12-11T16:11:47.820Z","updated_at":"2025-04-15T05:31:16.322Z","avatar_url":"https://github.com/evilkiwi.png","language":"TypeScript","funding_links":["https://github.com/sponsors/evilkiwi"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@lamware/core\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@lamware/core?style=flat-square\" alt=\"NPM\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/3S6AKZ2GR9\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/discord/1000565079789535324?color=7289DA\u0026label=discord\u0026logo=discord\u0026logoColor=FFFFFF\u0026style=flat-square\" alt=\"Discord\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/@lamware/core?style=flat-square\" alt=\"GPL-3.0-only\" /\u003e\n  \u003ch3\u003eAWS Lambda Middleware Pattern (NodeJS)\u003c/h3\u003e\n\u003c/div\u003e\n\n[Lamware](https://github.com/evilkiwi/lamware) is a simple design pattern based on middleware for AWS Lambda. Lambda, like other Cloud Function platforms, is executed by a request - which could be from anything like a queue (SQS) to a HTTP request. Since Lambda focusses on business logic, setting things up before-hand can be quite tedious.\n\nUsing a middleware pattern means your function is slightly delayed in recieving the event whilst Lamware runs various logic to set things up (in parallel, where possible). For example, you could have middleware set up to do things like:\n\n- Pull Secrets from Secrets Manager/external service\n- Fetch JSON config from AppConfig\n- Exit early if this was a Warming event from CloudWatch\n- Automate some Tracing bootstrap\n- Set-up some best practises (Like `callbackWaitsForEmptyEventLoop`)\n\n## Installation\n\nThis package is available via NPM:\n\n```bash\nyarn add @lamware/core\n\n# or\n\nnpm install @lamware/core\n```\n\nWe maintain and ship various middlewares for public use - you can [install them too](https://github.com/evilkiwi/lamware/tree/master/packages)!\n\n## Usage\n\nWe have [Documentation available here](https://docs.evil.kiwi/lamware), and you can check out the [`example` folder](https://github.com/evilkiwi/lamware/tree/master/example) for a fully-featured example with the AWS CDK stack to deploy it.\n\n```typescript\nimport { powertoolsTracing } from '@lamware/powertools-tracing';\nimport { powertoolsLogger } from '@lamware/powertools-logger';\nimport type { APIGatewayProxyHandlerV2 } from 'aws-lambda';\nimport { doNotWait } from '@lamware/do-not-wait';\nimport { appconfig } from '@lamware/appconfig';\nimport { sentry } from '@lamware/sentry';\nimport { warmer } from '@lamware/warmer';\nimport { lamware } from '@lamware/core';\n\nconst { handler } = lamware\u003cAPIGatewayProxyHandlerV2\u003cany\u003e\u003e()\n  .use(doNotWait())\n  .use(powertoolsTracing({\n    serviceName: 'lamware-example',\n  }))\n  .use(powertoolsLogger({\n    serviceName: 'lamware-example',\n    logLevel: 'DEBUG',\n  }))\n  .use(appconfig\u003c{ hello: string }\u003e({\n    app: 'evilkiwi-lamware-example',\n    env: 'production',\n    config: 'production',\n  }))\n  .use(sentry({\n    config: {\n      dsn: 'https://d99b0b438475869385706e70157c5e05@o1080839.ingest.sentry.io/6270000',\n    },\n  }))\n  .use(warmer())\n  .execute(async ({ state }) =\u003e {\n    return {\n      statusCode: 200,\n      body: JSON.stringify({\n        hello: 'world',\n        appconfig: state.config,\n      }),\n    };\n  });\n\nexport { handler };\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilkiwi%2Flamware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilkiwi%2Flamware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilkiwi%2Flamware/lists"}