{"id":19201097,"url":"https://github.com/dabit3/appsync-image-rekognition","last_synced_at":"2025-11-17T15:09:55.578Z","repository":{"id":50928211,"uuid":"149494417","full_name":"dabit3/appsync-image-rekognition","owner":"dabit3","description":"React + AWS AppSync App for image recognition using AWS Lambda + Amazon Rekognition","archived":false,"fork":false,"pushed_at":"2021-05-27T13:00:10.000Z","size":898,"stargazers_count":37,"open_issues_count":11,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-05T22:54:11.927Z","etag":null,"topics":["ai","aws-amplify","aws-appsync","graphql","ml","reactjs","serverless"],"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/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":"2018-09-19T18:24:34.000Z","updated_at":"2024-08-26T20:25:39.000Z","dependencies_parsed_at":"2022-08-25T12:51:45.400Z","dependency_job_id":null,"html_url":"https://github.com/dabit3/appsync-image-rekognition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-image-rekognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-image-rekognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-image-rekognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-image-rekognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dabit3","download_url":"https://codeload.github.com/dabit3/appsync-image-rekognition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253742149,"owners_count":21956963,"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":["ai","aws-amplify","aws-appsync","graphql","ml","reactjs","serverless"],"created_at":"2024-11-09T12:36:34.333Z","updated_at":"2025-10-14T03:17:27.046Z","avatar_url":"https://github.com/dabit3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AppSync Image Rekognition\n\nReact app for AI image facial recognition processing.\n\n![](https://i.imgur.com/pL4gveo.jpg)\n\n## Getting started\n\n0. Clone the project \u0026 change into the new directory\n\n```sh\ngit clone https://github.com/dabit3/appsync-image-rekognition.git\n\ncd appsync-image-rekognition\n```\n\n1. Install dependencies \n\n```sh\nnpm install\n```\n\n2. Initialize a new AWS Amplify project\n\n```sh\namplify init\n```\n\n3. Add auth, storage, \u0026 AppSync services\n\n```sh\namplify add auth\n\namplify add api\n\namplify add storage\n\namplify add function\n\namplify push\n```\n\n4. Update the AppSync Schema in your dashboard to the following:\n\n```graphql\ntype ImageData {\n\tdata: String!\n}\n\ntype Query {\n\tfetchImage(imageInfo: String!): ImageData\n}\n```\n\n5. Add the new Lambda function as a data source in the AppSync API Datasources section.\n\n6. Update the `fetchImage` resolver data source to use the new Lambda function as the datasource. Update the `fetchImage` resolver to the following:\n\n##### Request mapping template\n```js\n{\n    \"version\" : \"2017-02-28\",\n    \"operation\": \"Invoke\",\n    \"payload\": $util.toJson($context.args)\n}\n```\n\n##### Response mapping template\n```js\n$util.toJson($context.result)\n```\n\n7. Update the Lambda function code to the following (make sure to replace the bucket name with your bucket name):\n\n```js\nconst AWS = require('aws-sdk')\nAWS.config.update({region: 'us-east-1'})\nvar rekognition = new AWS.Rekognition()\n\nexports.handler = (event, context, callback) =\u003e {\n  var params = {\n    Image: {\n      S3Object: {\n      Bucket: \"\u003cYOURBUCKETNAME\u003e\", \n      Name: \"public/\" + event.imageInfo\n      }\n    }, \n    Attributes: [\n      'ALL'\n    ]\n  };\n \n  rekognition.detectFaces(params, function(err, data) {\n   if (err) {\n    callback(null, {\n     data: JSON.stringify(err.stack)\n    })\n   } else {\n    const myData = JSON.stringify(data)\n    callback(null, {\n        data: myData\n    })\n   }\n });\n};\n```\n\n8. Add permissions to Lambda role for Rekognition as well as S3\n\n## Your final exports file should look something like this:\n\n```js\nconst config =  {\n    'aws_appsync_graphqlEndpoint': 'https://yourendpoint',\n    'aws_appsync_region': 'us-east-2',\n    'aws_appsync_authenticationType': 'API_KEY',\n    'aws_appsync_apiKey': 'APIKEY',\n    'aws_user_pools': 'enable',\n    'aws_cognito_region': 'us-east-2',\n    'aws_user_pools_id': 'us-east-2_YOURID',\n    'aws_user_pools_web_client_id': 'YOURCLIENTID',\n    'aws_cognito_identity_pool_id': 'us-east-2:YOURID',\n    'aws_user_files_s3_bucket': 'YOURBUCKETNAME',\n    'aws_user_files_s3_bucket_region': 'us-east-1'\n  }\n\n  export default config\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Fappsync-image-rekognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdabit3%2Fappsync-image-rekognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Fappsync-image-rekognition/lists"}