{"id":23704127,"url":"https://github.com/getssh/serverless","last_synced_at":"2025-09-23T04:57:54.118Z","repository":{"id":67996555,"uuid":"598054999","full_name":"getssh/serverless","owner":"getssh","description":"Serverless application Implemented using AWS-lambda service. For this project Serverless has been used. The application also have authentication and authorization security features. It allows users to sign-in and create, upload, edit and delete the posts. React, NodeJS has been used for the project.","archived":false,"fork":false,"pushed_at":"2023-02-19T18:59:34.000Z","size":995,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-23T04:57:53.886Z","etag":null,"topics":["aws","aws-lambda-node","serverless"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/getssh.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-06T09:53:55.000Z","updated_at":"2023-03-10T14:32:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"c4a89b11-83e0-457c-ac57-b8a98e26737b","html_url":"https://github.com/getssh/serverless","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/getssh/serverless","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2Fserverless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2Fserverless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2Fserverless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2Fserverless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getssh","download_url":"https://codeload.github.com/getssh/serverless/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getssh%2Fserverless/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276518809,"owners_count":25656497,"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","status":"online","status_checked_at":"2025-09-23T02:00:09.130Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","aws-lambda-node","serverless"],"created_at":"2024-12-30T13:25:31.415Z","updated_at":"2025-09-23T04:57:54.112Z","avatar_url":"https://github.com/getssh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless TODO\n\nTo implement this project, you need to implement a simple TODO application using AWS Lambda and Serverless framework. Search for all comments starting with the `TODO:` in the code to find the placeholders that you need to implement.\n\n# Functionality of the application\n\nThis application will allow creating/removing/updating/fetching TODO items. Each TODO item can optionally have an attachment image. Each user only has access to TODO items that he/she has created.\n\n# TODO items\n\nThe application should store TODO items, and each TODO item contains the following fields:\n\n* `todoId` (string) - a unique id for an item\n* `createdAt` (string) - date and time when an item was created\n* `name` (string) - name of a TODO item (e.g. \"Change a light bulb\")\n* `dueDate` (string) - date and time by which an item should be completed\n* `done` (boolean) - true if an item was completed, false otherwise\n* `attachmentUrl` (string) (optional) - a URL pointing to an image attached to a TODO item\n\nYou might also store an id of a user who created a TODO item.\n\n## Prerequisites\n\n* \u003ca href=\"https://manage.auth0.com/\" target=\"_blank\"\u003eAuth0 account\u003c/a\u003e\n* \u003ca href=\"https://github.com\" target=\"_blank\"\u003eGitHub account\u003c/a\u003e\n* \u003ca href=\"https://nodejs.org/en/download/package-manager/\" target=\"_blank\"\u003eNodeJS\u003c/a\u003e version up to 12.xx \n* Serverless \n   * Create a \u003ca href=\"https://dashboard.serverless.com/\" target=\"_blank\"\u003eServerless account\u003c/a\u003e user\n   * Install the Serverless Framework’s CLI  (up to VERSION=2.21.1). Refer to the \u003ca href=\"https://www.serverless.com/framework/docs/getting-started/\" target=\"_blank\"\u003eofficial documentation\u003c/a\u003e for more help.\n   ```bash\n   npm install -g serverless@2.21.1\n   serverless --version\n   ```\n   * Login and configure serverless to use the AWS credentials \n   ```bash\n   # Login to your dashboard from the CLI. It will ask to open your browser and finish the process.\n   serverless login\n   # Configure serverless to use the AWS credentials to deploy the application\n   # You need to have a pair of Access key (YOUR_ACCESS_KEY_ID and YOUR_SECRET_KEY) of an IAM user with Admin access permissions\n   sls config credentials --provider aws --key YOUR_ACCESS_KEY_ID --secret YOUR_SECRET_KEY --profile serverless\n   ```\n   \n# Functions to be implemented\n\nTo implement this project, you need to implement the following functions and configure them in the `serverless.yml` file:\n\n* `Auth` - this function should implement a custom authorizer for API Gateway that should be added to all other functions.\n\n* `GetTodos` - should return all TODOs for a current user. A user id can be extracted from a JWT token that is sent by the frontend\n\nIt should return data that looks like this:\n\n```json\n{\n  \"items\": [\n    {\n      \"todoId\": \"123\",\n      \"createdAt\": \"2019-07-27T20:01:45.424Z\",\n      \"name\": \"Buy milk\",\n      \"dueDate\": \"2019-07-29T20:01:45.424Z\",\n      \"done\": false,\n      \"attachmentUrl\": \"http://example.com/image.png\"\n    },\n    {\n      \"todoId\": \"456\",\n      \"createdAt\": \"2019-07-27T20:01:45.424Z\",\n      \"name\": \"Send a letter\",\n      \"dueDate\": \"2019-07-29T20:01:45.424Z\",\n      \"done\": true,\n      \"attachmentUrl\": \"http://example.com/image.png\"\n    },\n  ]\n}\n```\n\n* `CreateTodo` - should create a new TODO for a current user. A shape of data send by a client application to this function can be found in the `CreateTodoRequest.ts` file\n\nIt receives a new TODO item to be created in JSON format that looks like this:\n\n```json\n{\n  \"createdAt\": \"2019-07-27T20:01:45.424Z\",\n  \"name\": \"Buy milk\",\n  \"dueDate\": \"2019-07-29T20:01:45.424Z\",\n  \"done\": false,\n  \"attachmentUrl\": \"http://example.com/image.png\"\n}\n```\n\nIt should return a new TODO item that looks like this:\n\n```json\n{\n  \"item\": {\n    \"todoId\": \"123\",\n    \"createdAt\": \"2019-07-27T20:01:45.424Z\",\n    \"name\": \"Buy milk\",\n    \"dueDate\": \"2019-07-29T20:01:45.424Z\",\n    \"done\": false,\n    \"attachmentUrl\": \"http://example.com/image.png\"\n  }\n}\n```\n\n* `UpdateTodo` - should update a TODO item created by a current user. A shape of data send by a client application to this function can be found in the `UpdateTodoRequest.ts` file\n\nIt receives an object that contains three fields that can be updated in a TODO item:\n\n```json\n{\n  \"name\": \"Buy bread\",\n  \"dueDate\": \"2019-07-29T20:01:45.424Z\",\n  \"done\": true\n}\n```\n\nThe id of an item that should be updated is passed as a URL parameter.\n\nIt should return an empty body.\n\n* `DeleteTodo` - should delete a TODO item created by a current user. Expects an id of a TODO item to remove.\n\nIt should return an empty body.\n\n* `GenerateUploadUrl` - returns a pre-signed URL that can be used to upload an attachment file for a TODO item.\n\nIt should return a JSON object that looks like this:\n\n```json\n{\n  \"uploadUrl\": \"https://s3-bucket-name.s3.eu-west-2.amazonaws.com/image.png\"\n}\n```\n\nAll functions are already connected to appropriate events from API Gateway.\n\nAn id of a user can be extracted from a JWT token passed by a client.\n\nYou also need to add any necessary resources to the `resources` section of the `serverless.yml` file such as DynamoDB table and S3 bucket.\n\n\n# Frontend\n\nThe `client` folder contains a web application that can use the API that should be developed in the project.\n\nThis frontend should work with your serverless application once it is developed, you don't need to make any changes to the code. The only file that you need to edit is the `config.ts` file in the `client` folder. This file configures your client application just as it was done in the course and contains an API endpoint and Auth0 configuration:\n\n```ts\nconst apiId = '...' API Gateway id\nexport const apiEndpoint = `https://${apiId}.execute-api.us-east-1.amazonaws.com/dev`\n\nexport const authConfig = {\n  domain: '...',    // Domain from Auth0\n  clientId: '...',  // Client id from an Auth0 application\n  callbackUrl: 'http://localhost:3000/callback'\n}\n```\n\n## Authentication\n\nTo implement authentication in your application, you would have to create an Auth0 application and copy \"domain\" and \"client id\" to the `config.ts` file in the `client` folder. We recommend using asymmetrically encrypted JWT tokens.\n\n# Best practices\n\nTo complete this exercise, please follow the best practices from the 6th lesson of this course.\n\n## Logging\n\nThe starter code comes with a configured [Winston](https://github.com/winstonjs/winston) logger that creates [JSON formatted](https://stackify.com/what-is-structured-logging-and-why-developers-need-it/) log statements. You can use it to write log messages like this:\n\n```ts\nimport { createLogger } from '../../utils/logger'\nconst logger = createLogger('auth')\n\n// You can provide additional information with every log statement\n// This information can then be used to search for log statements in a log storage system\nlogger.info('User was authorized', {\n  // Additional information stored with a log statement\n  key: 'value'\n})\n```\n\n\n# Grading the submission\n\nOnce you have finished developing your application, please set `apiId` and Auth0 parameters in the `config.ts` file in the `client` folder. A reviewer would start the React development server to run the frontend that should be configured to interact with your serverless application.\n\n**IMPORTANT**\n\n*Please leave your application running until a submission is reviewed. If implemented correctly it will cost almost nothing when your application is idle.*\n\n# Suggestions\n\nTo store TODO items, you might want to use a DynamoDB table with local secondary index(es). A create a local secondary index you need to create a DynamoDB resource like this:\n\n```yml\n\nTodosTable:\n  Type: AWS::DynamoDB::Table\n  Properties:\n    AttributeDefinitions:\n      - AttributeName: partitionKey\n        AttributeType: S\n      - AttributeName: sortKey\n        AttributeType: S\n      - AttributeName: indexKey\n        AttributeType: S\n    KeySchema:\n      - AttributeName: partitionKey\n        KeyType: HASH\n      - AttributeName: sortKey\n        KeyType: RANGE\n    BillingMode: PAY_PER_REQUEST\n    TableName: ${self:provider.environment.TODOS_TABLE}\n    LocalSecondaryIndexes:\n      - IndexName: ${self:provider.environment.INDEX_NAME}\n        KeySchema:\n          - AttributeName: partitionKey\n            KeyType: HASH\n          - AttributeName: indexKey\n            KeyType: RANGE\n        Projection:\n          ProjectionType: ALL # What attributes will be copied to an index\n\n```\n\nTo query an index you need to use the `query()` method like:\n\n```ts\nawait this.dynamoDBClient\n  .query({\n    TableName: 'table-name',\n    IndexName: 'index-name',\n    KeyConditionExpression: 'paritionKey = :paritionKey',\n    ExpressionAttributeValues: {\n      ':paritionKey': partitionKeyValue\n    }\n  })\n  .promise()\n```\n\n# How to run the application\n\n## Backend\n\nTo deploy an application run the following commands:\n\n```\ncd backend\nnpm install\nsls deploy -v\n```\n\n## Frontend\n\nTo run a client application first edit the `client/src/config.ts` file to set correct parameters. And then run the following commands:\n\n```\ncd client\nnpm install\nnpm run start\n```\n\nThis should start a development server with the React application that will interact with the serverless TODO application.\n\n# Postman collection\n\nAn alternative way to test your API, you can use the Postman collection that contains sample requests. You can find a Postman collection in this project. To import this collection, do the following.\n\nClick on the import button:\n\n![Alt text](images/import-collection-1.png?raw=true \"Image 1\")\n\n\nClick on the \"Choose Files\":\n\n![Alt text](images/import-collection-2.png?raw=true \"Image 2\")\n\n\nSelect a file to import:\n\n![Alt text](images/import-collection-3.png?raw=true \"Image 3\")\n\n\nRight click on the imported collection to set variables for the collection:\n\n![Alt text](images/import-collection-4.png?raw=true \"Image 4\")\n\nProvide variables for the collection (similarly to how this was done in the course):\n\n![Alt text](images/import-collection-5.png?raw=true \"Image 5\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetssh%2Fserverless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetssh%2Fserverless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetssh%2Fserverless/lists"}