{"id":19380430,"url":"https://github.com/ksalmon/user-api","last_synced_at":"2025-08-31T09:32:45.873Z","repository":{"id":248755581,"uuid":"829078650","full_name":"ksalmon/user-api","owner":"ksalmon","description":"Express.js Lambda Microservice for Users","archived":false,"fork":false,"pushed_at":"2024-07-17T22:12:17.000Z","size":1160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-07T06:16:50.950Z","etag":null,"topics":["dynamodb","express","lambda","serverless"],"latest_commit_sha":null,"homepage":"https://1ysyd81oza.execute-api.us-east-1.amazonaws.com/api/v1/health","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/ksalmon.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-07-15T17:58:35.000Z","updated_at":"2024-07-17T22:12:20.000Z","dependencies_parsed_at":"2024-07-16T23:56:24.258Z","dependency_job_id":"c447f41b-1c2d-41b9-bc9c-9996222db576","html_url":"https://github.com/ksalmon/user-api","commit_stats":null,"previous_names":["ksalmon/user-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksalmon%2Fuser-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksalmon%2Fuser-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksalmon%2Fuser-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksalmon%2Fuser-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksalmon","download_url":"https://codeload.github.com/ksalmon/user-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240517103,"owners_count":19814138,"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":["dynamodb","express","lambda","serverless"],"created_at":"2024-11-10T09:13:53.653Z","updated_at":"2025-02-24T16:43:50.166Z","avatar_url":"https://github.com/ksalmon.png","language":"TypeScript","readme":"\n# User CRUD Microservice \nI decided to go with a proxy handler that points to a Node.js Express application instead of defining all the events separately in different handlers. Setup a v1 router and built a custom DynamoDB ORM service called DynOrm. I have middleware that handles validating inbound requests with Joi.\n\n### Local Development\nRequires [Docker app](https://docs.docker.com/desktop/install/mac-install/) running so we can spin up the local dynamodb instance, which is a lot easier then installing the Java instance.\n\n1) Install deps with `npm install`\n2) Run the function in offline mode with `npm run dev`\n\nWhen first running, it will spin up a docker container for the local dynamoDB instance and create a new table called `development-users`\n\nYou can access the lambda express application at `http://localhost:3000/api/v1/health`\n\n### Running Tests\nI decided to add some E2E controller specs alongside my service specs which ensures good integration with the entity services and the db model functions. \n\nSimply run `npm run test`\n\n\n### Deploy to AWS\nThe fastest and least problamatic way to deploy to production is to have the lastest AWS CLI installed on your machine ([instructions here](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html))\n\nNext please run `aws configure` to [setup](https://docs.aws.amazon.com/cli/latest/reference/configure/) the region and enter any credentials from your AWS account.\n\nNext add a `.env.production` with ```AWS_DYNAMODB_ENDPOINT=https://dynamodb.{AWS_REGION}.amazonaws.com``` and replace the AWS_REGION var with whatever you set when you ran `aws configure`. \n\nLastly, run `npm run deploy` which will return you an endpoint once successfully deployed\n\n### Routes\nGET: /api/v1/health --- Get the application status, I have a habit of setting these for canary deploy checks\n\nPOST: /api/v1/users --- Create a new user\n\nGET: /api/v1/users/{user_id} --- Get an existing user\n\nPUT: /api/v1/users/{user_id} --- Update an existing user\n\nDELETE: /api/v1/users/{user_id} --- Delete an existing user\n\n### Existing Deployed Resources\nhttps://1ysyd81oza.execute-api.us-east-1.amazonaws.com/api/v1/health\n\nhttps://1ysyd81oza.execute-api.us-east-1.amazonaws.com/api/v1/users\n\n### Extra\nFor [Postman](https://www.postman.com/) lovers, there is a collection file in the source that you can import to quickly test any local or live instances of this function. Download `postman-user-api.json``\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksalmon%2Fuser-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksalmon%2Fuser-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksalmon%2Fuser-api/lists"}