{"id":21404934,"url":"https://github.com/perkzen/serverless-aws-node","last_synced_at":"2025-10-12T02:19:30.988Z","repository":{"id":241737462,"uuid":"806746551","full_name":"perkzen/serverless-aws-node","owner":"perkzen","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-29T14:10:13.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T03:41:34.046Z","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/perkzen.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":"2024-05-27T20:16:43.000Z","updated_at":"2024-05-29T14:10:16.000Z","dependencies_parsed_at":"2024-05-29T23:07:52.447Z","dependency_job_id":null,"html_url":"https://github.com/perkzen/serverless-aws-node","commit_stats":null,"previous_names":["perkzen/serverless-aws-node"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkzen%2Fserverless-aws-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkzen%2Fserverless-aws-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkzen%2Fserverless-aws-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkzen%2Fserverless-aws-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perkzen","download_url":"https://codeload.github.com/perkzen/serverless-aws-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902290,"owners_count":20366259,"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-11-22T16:19:26.690Z","updated_at":"2025-10-12T02:19:25.940Z","avatar_url":"https://github.com/perkzen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎉 Car Management System - Serverless\n\nThis project demonstrates how to develop a serverless backend for an car management system using AWS Lambda, DynamoDB, and SNS with the Serverless Framework. The backend is developed and tested locally using Localstack.\n\n## 🚀 Project Setup\n\n### Step 1: Install Node.js and Serverless Framework\n\nEnsure you have Node.js installed. Then, install the Serverless Framework globally:\n\n```console\n    npm install -g serverless\n```\n\n### Step 2: Create a Serverless Project\n\nCreate a new Serverless project:\n\n```console\n    serverless create --template aws-nodejs --path car-management-system\n    cd car-management-system\n    npm init -y\n    npm install aws-sdk jsonwebtoken bcryptjs serverless-offline serverless-localstack\n```\n\n## ⚙️ Configuration\n\n### Step 3: Configure `serverless.yml`\n\nUpdate your `serverless.yml` to configure DynamoDB and SNS locally using Localstack, and include serverless-offline for local API Gateway.\n\nSee the full `serverless.yml` configuration [here](serverless.yml).\n\n## 📝 Lambda Functions\n\n### Step 4: Create Lambda Functions\n\nCreate a `handler.js` file with the Lambda functions to handle the API endpoints. You can find the implementation details [here](handler.js).\n\n## 🛠 Local Development\n\n### Step 5: Start Localstack\n\nEnsure you have Localstack and Docker installed and running.\n\nStart Localstack:\n\n```console\n    localstack start\n```\n\nCreate DynamoDB Table and SNS Topic Locally:\n\n```bash\n    aws --endpoint-url=http://localhost:4566 dynamodb create-table --table-name car-management-system-cars --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 --region us-east-1\n\n    aws --endpoint-url=http://localhost:4566 sns create-topic --name carNotification --region us-east-1\n```\n\n### Step 6: Start Serverless Offline\n\nStart the Serverless Offline plugin to run the API locally:\n\n```console\n    serverless offline --stage local\n```\n\n### Step 7: Test Locally\n\nUse Postman or curl to test the endpoints locally:\n\n### 👨‍💻 Login:\n\n```bash\n    curl -X POST http://localhost:3000/local/login -H \"Content-Type: application/json\" -d '{\"username\":\"admin\",\"password\":\"admin\"}'\n```\n\n#### 🚀 Create Car:\n\n```bash\n    curl -X POST http://localhost:3000/local/cars -H \"Content-Type: application/json\" -H \"Authorization: Bearer \u003cyour-token\u003e\" -d '{\"brand\":\"VW\",\"model\":\"Polo\"}'\n```\n\n#### 🚗 Get All Cars:\n\n```bash\n    curl http://localhost:3000/local/cars\n```\n\n#### 🔍 Get Event by ID:\n\n```bash\n    curl http://localhost:3000/local/cars/{id}\n```\n\n#### ✏️ Update Event:\n\n```bash\n    curl -X PUT http://localhost:3000/local/cars/{id} -H \"Content-Type: application/json\" -H \"Authorization: Bearer \u003cyour-token\u003e\" -d '{\"title\":\"Updated Event\",\"description\":\"This is an updated event.\",\"date\":\"2024-06-20\"}'\n```\n\n#### ❌ Delete Event:\n\n```bash\n    curl -X DELETE http://localhost:3000/local/cars/{id} -H \"Authorization: Bearer \u003cyour-token\u003e\"\n```\n\n### 🕰 Invoke Scheduled Task Manually:\n\n```bash\n    serverless invoke local --function scheduledTask\n```\n\n### 📡 Publish a Message to SNS Topic:\n\n```bash\n    aws --endpoint-url=http://localhost:4566 sns publish --topic-arn arn:aws:sns:us-east-1:000000000000:carNotification --message \"Test SNS message\" --region us-east-1\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperkzen%2Fserverless-aws-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperkzen%2Fserverless-aws-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperkzen%2Fserverless-aws-node/lists"}