{"id":23067039,"url":"https://github.com/dvsa/dvsa-lambda-starter","last_synced_at":"2025-08-15T11:33:50.523Z","repository":{"id":37711033,"uuid":"286450295","full_name":"dvsa/dvsa-lambda-starter","owner":"dvsa","description":"A starting pattern for AWS lambda in Typescript ","archived":false,"fork":false,"pushed_at":"2023-12-07T15:03:40.000Z","size":3456,"stargazers_count":5,"open_issues_count":8,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-15T04:43:08.264Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/dvsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-10T10:57:19.000Z","updated_at":"2024-01-03T09:19:44.000Z","dependencies_parsed_at":"2023-02-08T07:00:38.955Z","dependency_job_id":null,"html_url":"https://github.com/dvsa/dvsa-lambda-starter","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fdvsa-lambda-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fdvsa-lambda-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fdvsa-lambda-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fdvsa-lambda-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvsa","download_url":"https://codeload.github.com/dvsa/dvsa-lambda-starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229910956,"owners_count":18143229,"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":["hacktoberfest"],"created_at":"2024-12-16T05:15:57.490Z","updated_at":"2024-12-16T05:15:57.981Z","avatar_url":"https://github.com/dvsa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lambda-starter\n\nA starting pattern for AWS lambda in Typescript \n\n**Requirements**\n\n- node v16.17.1 (Note if still using node 14 please checkout tag 1.0.0 and consider upgrading your runtime)\n- [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)\n- npm 8+\n\n**Prerequisites**\n- Create a `.env`\n    ```shell\n    cp .env.example .env\n    ```\n\n**Build**\n\n- `npm i`\n- `npm run build:dev`\n\n**Watch**\n\nTo watch for changes and automatically trigger a new build:\n- `npm run watch:dev`\n\n\n**Run Lambdas Locally**\n\n- Build the files first\n- `npm run start:dev`\n- To ensure that the lambdas have been successfully served, run the following command in a separate terminal:\n    - `curl --request GET http://localhost:3000/?message=hello%20world`\n    - the response should be: `{\"queryParams\": {\"message\": \"hello world\"}}`\n- To run CloudWatch Event lambdas: `npm run invoke -- CloudWatchEventLambdaFunction`\n\n\n**Debug Lambdas Locally (VS Code only)**\n\n- Run lambdas in debug mode: `npm run start:dev -- -d 5858`\n- Add a breakpoint to the lambda being tested (`src/handler/get.ts`)\n- Run the debug config from VS Code that corresponds to lambda being tested (`GetLambdaFunction`)\n- Send an HTTP request to the lambda's URI (`curl --request GET http://localhost:3000/?message=hello%20world`)\n- To debug CloudWatch Event lambdas: `npm run invoke -- CWEventLambdaFunction -d 5858`\n\n\n**Tests**\n\n- The [Jest](https://jestjs.io/) framework is used to run tests and collect code coverage\n- To run the tests, run the following command within the root directory of the project: `npm test`\n- Coverage results will be displayed on terminal and stored in the `coverage` directory\n    - The coverage requirements can be set in `jest.config.js`\n\n\n**Logging**\nLogging is handled by `https://github.com/winstonjs/winston`. A pre-configured logger is available, and can be used like so:\n\n```ts\nimport logger from \"../utils/logger\";\n\nlogger.info('Hello world');\nlogger.error('Hello world');\nlogger.warn('Hello world');\n```\n\n**Tip:** It's usually a good idea to attach the `requestId` and any `X-Correlation-Id` to the logger object's meta data so every log message will contain these useful bits of information.\n\n```ts\n  const event: APIGatewayProxyEvent = currentInvoke.event as APIGatewayProxyEvent;\n  const correlationId: string = event.headers['X-Correlation-Id'] || (currentInvoke.context as Context).awsRequestId;\n\n  const { requestId } = event.requestContext;\n\n  req.app.locals.correlationId = correlationId;\n  req.app.locals.requestId = requestId;\n\n  Logger.defaultMeta = { requestId, correlationId };\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvsa%2Fdvsa-lambda-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvsa%2Fdvsa-lambda-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvsa%2Fdvsa-lambda-starter/lists"}