{"id":19861242,"url":"https://github.com/tannheuser/serverless-approvals","last_synced_at":"2026-05-14T19:34:15.453Z","repository":{"id":73223512,"uuid":"495929295","full_name":"Tannheuser/serverless-approvals","owner":"Tannheuser","description":"A project to manage approval requests using AWS serverless infrastructure.","archived":false,"fork":false,"pushed_at":"2022-05-30T22:31:30.000Z","size":246,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-01T00:12:55.461Z","etag":null,"topics":["aws","aws-appsync","aws-cdk-typescript","aws-dynamodb","aws-lambda","aws-serverless-backend"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Tannheuser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-05-24T17:45:17.000Z","updated_at":"2022-05-31T15:36:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"9da32317-183d-4e88-adfc-ea6fcdab60ab","html_url":"https://github.com/Tannheuser/serverless-approvals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Tannheuser/serverless-approvals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tannheuser%2Fserverless-approvals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tannheuser%2Fserverless-approvals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tannheuser%2Fserverless-approvals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tannheuser%2Fserverless-approvals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tannheuser","download_url":"https://codeload.github.com/Tannheuser/serverless-approvals/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tannheuser%2Fserverless-approvals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33040163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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-appsync","aws-cdk-typescript","aws-dynamodb","aws-lambda","aws-serverless-backend"],"created_at":"2024-11-12T15:08:29.126Z","updated_at":"2026-05-14T19:34:15.436Z","avatar_url":"https://github.com/Tannheuser.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless Approvals\n\nThis is a project to manage approval requests using AWS serverless infrastructure.\n\n## Architecture overview\n\n![alt text](https://github.com/Tannheuser/serverless-approvals/blob/main/misc/diagram.png?raw=true)\n\n### Current limitations\n\n* It's not possible to create multiple requests of the same type for the same origin.\n* You have to specify user sub manually in GraphQL queries and mutations.\n* No unit tests (yet).\n\n### Possible future improvements\n\n* Make log level configurable.\n* Use another authentication type for API calls (instead of API KEY).\n* Be able to fetch user sub from API calls (from token or lambda context);\n* Use DynamoDB Streams to interact with consumer services in a more event driven way.\n\n## Configuration\n\nBy default, `[default]` AWS profile is used for AWS CDK configuration.\nIf you want to use another named profile, you could specify it in `cdk.json` file as`\"profile\": \"your_profile_name\"`\nor provide a `--profile your_profile_name` parameter to AWS CDK commands.\n\n## Installation\n\nMake sure you have `typescript` and `aws-cdk` installed.\n\nFor the first time run cdk bootstrap command:\n\n```console\ncdk bootstrap\n```\n\nRun cdk synth to synthesize an AWS CloudFormation template:\n\n```console\ncdk synth\n```\n\nRun cdk deploy:\n\n```console\ncdk deploy\n```\n\nSpecify a named profile parameter to AWS CDK commands if needed\n```console\ncdk command --profile your_profile_name\n```\n\n## Creating approval requests\n\nTo send a custom event to the approval event bus you should specify correct values for the `Event source` and `Event details` fields.\n\nThe `Detail type` field is not used, so it could contain any valid value.\n\n###### Example\nEvent bus: \n`serverless-approvals-dev-source`\n\nEvent details:\n```console\n{\n  \"action\": \"create\",\n  \"originType\": \"transaction\",\n  \"originId\": \"QWERTY\",\n  \"sub\": \"user-sub-1\"\n}\n```\n\n## Working with GraphQL API\n\n### Queries\n\n###### Get pending requests\n\nYou could fetch pending (not processed) approval requests by using `getPendingRequests` query.\n\nAdditionally, requests could be filtered by `originType` or `originTyId`.\n\n```console\nquery MyQuery {\n  getPendingRequests(filter: {originType: \"transaction\"}) {\n    action\n    originId\n    originType\n    status\n    createdBy\n  }\n}\n```\n\n###### Get reviewable requests\n\nYou could fetch pending (not processed) approval requests,\nwhich could be reviewed by current user (were not originally created by this user).\n\nIn this case you have to provide user `sub` as a filter parameter.\n\n```console\nquery MyQuery {\n  getReviewableRequests(filter: {sub: \"user-sub-2\", originType: \"transaction\"}) {\n    action\n    originId\n    originType\n    status\n    createdBy\n  }\n}\n```\n\n### Mutations\n\nYou could approve or reject pending approval requests, which were originally created by other user.\n\n###### Approve pending request\n\n```console\nmutation MyMutation {\n  approveRequest(\n    input: {\n      action: \"create\"\n      message: \"Approved\",\n      originId: \"QWERTY\",\n      originType: \"transaction\",\n      sub: \"user-sub-2\"}) {\n    action\n    originId\n    originType\n    status\n    updatedAt\n  }\n}\n\n```\n\n###### Reject pending request\n\n```console\nmutation MyMutation {\n  rejectRequest(\n    input: {\n      action: \"create\"\n      originId: \"QWERTY\",\n      originType: \"transaction\",\n      sub: \"user-sub-2\"}) {\n    action\n    originId\n    originType\n    status\n    updatedAt\n  }\n}\n```\n\n## Other useful commands\n\n* `npm run build`   compile typescript to js\n* `npm run watch`   watch for changes and compile\n* `npm run test`    perform the jest unit tests\n* `cdk deploy`      deploy this stack to your default AWS account/region\n* `cdk diff`        compare deployed stack with current state\n* `cdk synth`       emits the synthesized CloudFormation template\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftannheuser%2Fserverless-approvals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftannheuser%2Fserverless-approvals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftannheuser%2Fserverless-approvals/lists"}