{"id":19200946,"url":"https://github.com/dabit3/this-or-that","last_synced_at":"2025-11-17T15:13:13.930Z","repository":{"id":50826409,"uuid":"265901582","full_name":"dabit3/this-or-that","owner":"dabit3","description":"This or that - Real-time atomic voting app built with AWS Amplify","archived":false,"fork":false,"pushed_at":"2021-06-08T10:35:04.000Z","size":3811,"stargazers_count":99,"open_issues_count":7,"forks_count":24,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-09T09:59:01.308Z","etag":null,"topics":["aws","aws-amplify","aws-appsyng","dynamodb","graphql","javascript","react","serverless"],"latest_commit_sha":null,"homepage":"https://www.thisorthat.cloud","language":"CSS","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/dabit3.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}},"created_at":"2020-05-21T16:45:28.000Z","updated_at":"2025-02-06T00:48:38.000Z","dependencies_parsed_at":"2022-09-02T22:32:29.836Z","dependency_job_id":null,"html_url":"https://github.com/dabit3/this-or-that","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dabit3/this-or-that","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fthis-or-that","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fthis-or-that/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fthis-or-that/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fthis-or-that/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dabit3","download_url":"https://codeload.github.com/dabit3/this-or-that/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fthis-or-that/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284904664,"owners_count":27082304,"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-11-17T02:00:06.431Z","response_time":55,"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-amplify","aws-appsyng","dynamodb","graphql","javascript","react","serverless"],"created_at":"2024-11-09T12:35:41.931Z","updated_at":"2025-11-17T15:13:13.913Z","avatar_url":"https://github.com/dabit3.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# This or that\n\nScalable serverless voting app - built with AWS Amplify, AWS AppSync, and Amazon DynamoDB\n\n![This or that](thisorthat.jpg)\n\n## To deploy\n\nYou can deploy this app and the back end infrastructure in one of two ways:\n\n1. The Amplify CLI\n2. One click deploy button\n\n### Amplify CLI\n\n1. First install and configure the Amplify CLI.\n\n\u003e For a complete walkthrough of how to configure the CLI, see [this video](https://www.youtube.com/watch?v=fWbM5DLh25U)\n\n```sh\n$ npm install -g @aws-amplify/cli\n$ amplify configure\n```\n\n2. Clone the repo, install dependencies\n\n```sh\n$ git clone https://github.com/dabit3/this-or-that.git\n$ cd this-or-that\n$ npm install\n```\n\n3. Initialize the app\n\n```sh\n$ amplify init\n\n? Enter a name for the environment: (your preferred env name)\n? Choose your default editor: (your preferred editor)\n? Do you want to use an AWS profile? Yes\n? Please choose the profile you want to use: your-profile-name\n\n? Do you want to configure Lambda Triggers for Cognito? No\n```\n\n4. Deploy the back end\n\n```sh\n$ amplify push --y\n```\n\n5. Run the app\n\n```sh\n$ npm start\n```\n\n### One click deploy\n\n[![amplifybutton](https://oneclick.amplifyapp.com/button.svg)](https://console.aws.amazon.com/amplify/home#/deploy?repo=https://github.com/dabit3/this-or-that)\n\n## About the app\n\nWhile the voting API is built with DynamoDB and AppSync, the main functionality really is within a single GraphQL resolver that sends an atomic update to DynamoDB.\n\nThis atomic update allows the DynamoDB table to stay consistent regardless of the number of other operations that are happening.\n\n### Upvote resolver\n\n__Request mapping template__\n\n```vtl\n{\n    \"version\": \"2018-05-29\",\n    \"operation\": \"UpdateItem\",\n    \"key\" : {\n      \"id\" : $util.dynamodb.toDynamoDBJson($context.arguments.id)\n    },\n    \"update\": {\n      \"expression\" : \"set #upvotes = #upvotes + :updateValue\",\n      \"expressionNames\" : {\n           \"#upvotes\" : \"upvotes\"\n       },\n       \"expressionValues\" : {\n           \":updateValue\" : { \"N\" : 1 }\n       }\n    }\n}\n```\n\n__Response mapping template__\n\n```vtl\n$util.quiet($ctx.result.put(\"clientId\", \"$context.arguments.clientId\"))\n$util.toJson($ctx.result)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Fthis-or-that","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdabit3%2Fthis-or-that","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Fthis-or-that/lists"}