{"id":15801609,"url":"https://github.com/garrettmac/serverless-aws-node-starter-example","last_synced_at":"2025-03-31T21:55:42.817Z","repository":{"id":84888661,"uuid":"182327018","full_name":"garrettmac/serverless-aws-node-starter-example","owner":"garrettmac","description":null,"archived":false,"fork":false,"pushed_at":"2019-04-19T22:22:57.000Z","size":145,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-06T01:23:19.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garrettmac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-19T21:19:49.000Z","updated_at":"2019-04-19T22:22:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2e06f2d-e992-4066-b988-703682d4b969","html_url":"https://github.com/garrettmac/serverless-aws-node-starter-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettmac%2Fserverless-aws-node-starter-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettmac%2Fserverless-aws-node-starter-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettmac%2Fserverless-aws-node-starter-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettmac%2Fserverless-aws-node-starter-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garrettmac","download_url":"https://codeload.github.com/garrettmac/serverless-aws-node-starter-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246547388,"owners_count":20794970,"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":[],"created_at":"2024-10-05T01:23:17.523Z","updated_at":"2025-03-31T21:55:42.799Z","avatar_url":"https://github.com/garrettmac.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serverless-aws-node-starter\n[![Build Status](https://cloud.drone.io/api/badges/dczepierga/serverless-aws-node-starter/status.svg)](https://cloud.drone.io/dczepierga/serverless-aws-node-starter)\n\nModern AWS Serverless Starter Kit built on top of the [Serverless Framework](https://serverless.com/), giving you support for:\n* JavaScript linting with [ESLint](https://eslint.org/) and style guide created by [Airbnb](https://github.com/airbnb/javascript)\n* Unit tests with [Jest](https://jestjs.io/)\n* GIT commit with [Commitizen](https://github.com/commitizen/cz-cli)\n* GIT hooks with [husky](https://github.com/typicode/husky) to lint code on every commit and run tests before push\n* Local development with [serverless-offline](https://github.com/dherault/serverless-offline)\n* Releases with [semantic-release](https://semantic-release.gitbook.io/semantic-release/)\n* CI/CD with [Drone.io](https://cloud.drone.io/)\n* API documentation with [Swagger UI](https://swagger.io/tools/swagger-ui/)\n\n## Requirements\n- [Node.js v8.10.0](https://nodejs.org/en/blog/release/v8.10.0/)\n- [Serverless Framework](https://serverless.com/framework/docs/providers/aws/guide/installation/)\n- [AWS CLI account configured](https://serverless.com/framework/docs/providers/aws/guide/credentials/)\n- [Docker](https://www.docker.com/) - for API documentation\n\n## Install\n```bash\n# If you don't already have the serverless cli installed, do that\nnpm install -g serverless\n\n# Use the serverless cli to install this repo\nserverless install --url https://github.com/dczepierga/serverless-aws-node-starter --name \u003cyour-service-name\u003e\n\n# cd into project and set it up\ncd \u003cyour-service-name\u003e\n\n# Install dependencies\nnpm install\n```\n\nNow you only need to change service name in following files:\n* [`package.json`](./package.json) - `name` field\n* [`serverless.yml`](./serverless.yml) - `service` field\n\n## Deploy\nIf you've already set up your default AWS credentials:\n\n```bash\nnpm run deploy\n```\n\nBy default script will deploy to `dev` stage and `eu-west-1` region. You can deploy to different stage or region by passing command line arguments:\n```bash\nnpm run deploy -- --stage test --region us-east-1\n```\n\n## Development\n### Local dev server - simulate API Gateway\n```bash\nnpm start\n```\n\nBy default local dev server will use `dev` stage and `eu-west-1` region. You can start local dev server for different stage or region by passing command line arguments:\n```bash\nnpm start -- --stage test --region us-east-1\n```\n\nFor more options check [serverless-offline](https://github.com/dherault/serverless-offline) plugin documentation - [Usage and command line options](https://github.com/dherault/serverless-offline#usage-and-command-line-options)\n\n\n### Creating and deploying new functions\n#### Create function with unit tests\nThe starter Hello World function can be found at [`./src/handler.js`](./src/handler.js) with unit tests ['./src/handler.js`](./src/handler.spec.js). There you can find a basic function that returns success response with body and simple unit test for this functionality.\n\nThis is all basic [Serverless](https://serverless.com/). If you've never used it, be sure to get familiar with their [docs](https://serverless.com/framework/docs/providers/aws/).\nMore information about writing unit tests using [Jest](https://jestjs.io/) can be found in their [guide](https://jestjs.io/docs/en/getting-started.html).\n\n#### Create configuration\nThe starter Hello World configuration can be found at [`src/handler.yml`](./src/handler.yml) and at [`serverless.yml`](./serverless.yml) in the `functions` section (linked file).\n\nMore details about function configuration can be found in the [AWS functions guide](https://serverless.com/framework/docs/providers/aws/guide/functions/)\n\n\u003e **IMPORTANT** Remember to add all required files in `package/include` section. Without this your function may not work after deploy to the cloud!\n\n#### Test and diagnose your function\nYou can run unit tests using following command:\n```bash\nnpm test\n```\n\nMore options is available in Jest docs - [CLI Options](https://jestjs.io/docs/en/cli.html).\n\nIf you want to diagnose you function and local dev webserver is not enough for you, then you can invoke the function with logs - more details you can find in the Serverless docs - [AWS Invoke](https://serverless.com/framework/docs/providers/aws/cli-reference/invoke/).\n\n#### Commit your code\nAdd all files to stage and run:\n```bash\nnpm run commit\n```\n\nYou'll be prompted to fill out any required commit fields at commit time.\n\n## API documentation\nDocumentation for AWS API Gateway is provided by [serverless-aws-documentation](https://github.com/deliveryhero/serverless-aws-documentation) plugin and exported to [Swagger UI](https://swagger.io/tools/swagger-ui/) format.\n\nTo open deployed to AWS API Gateway documentation in Swagger UI, you must run:\n```bash\nnpm run docs\n```\n\n## Cleanup\n```bash\nnpm run detroy\n```\n\nBy default script will cleanup `dev` stage and `eu-west-1` region. You can cleanup different stage or region by passing command line arguments:\n```bash\nnpm run detroy -- --stage test --region us-east-1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarrettmac%2Fserverless-aws-node-starter-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarrettmac%2Fserverless-aws-node-starter-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarrettmac%2Fserverless-aws-node-starter-example/lists"}