{"id":19200964,"url":"https://github.com/dabit3/real-time-image-tracking","last_synced_at":"2025-11-17T15:12:18.004Z","repository":{"id":49938298,"uuid":"213426269","full_name":"dabit3/real-time-image-tracking","owner":"dabit3","description":"Real-time image tracking with React, GraphQL, and AWS AppSync","archived":false,"fork":false,"pushed_at":"2021-06-08T04:24:58.000Z","size":6308,"stargazers_count":45,"open_issues_count":12,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T09:59:03.572Z","etag":null,"topics":["amplify","aws","graphql","javascript","machine-learning","react","rekognition"],"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":"2019-10-07T15:57:47.000Z","updated_at":"2024-06-13T09:47:18.000Z","dependencies_parsed_at":"2022-09-18T12:00:56.155Z","dependency_job_id":null,"html_url":"https://github.com/dabit3/real-time-image-tracking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dabit3/real-time-image-tracking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Freal-time-image-tracking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Freal-time-image-tracking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Freal-time-image-tracking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Freal-time-image-tracking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dabit3","download_url":"https://codeload.github.com/dabit3/real-time-image-tracking/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Freal-time-image-tracking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284904317,"owners_count":27082231,"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":["amplify","aws","graphql","javascript","machine-learning","react","rekognition"],"created_at":"2024-11-09T12:35:46.663Z","updated_at":"2025-11-17T15:12:17.987Z","avatar_url":"https://github.com/dabit3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Real-time image recognition\n\n![](header.png)\n\n### What is this?\n\nThis app will allow you to set a tracker on the types of items you'd like to detect. It will then check for movement, detect the item in the picture, and if the item is on the list of items being tracked, will display the image in an image feed.\n\n### To deploy this project\n\n1. Update the [Amplify CLI](https://aws-amplify.github.io/docs/) to the latest version\n\n```sh\n$ npm install -g @aws-amplify/cli\n```\n\n2. Clone the repo \u0026 install the dependencies\n\n```sh\ngit clone https://github.com/dabit3/real-time-image-tracking.git\n\ncd real-time-image-tracking\n\nnpm install\n```\n\n3. Initialize \u0026 deploy the Amplify project\n\n```sh\namplify init\n\namplify push\n```\n\n4. Update the IAM policy associated with the Lambda function to have access to Rekognition as well as the S3 bucket (open the AWS console and open the Lambda function to see the associated role)\n\nFunction name can be found in `amplify/backend/function/rekognitionfunction-\u003cenvironment-name\u003e`\n\n5. Update the environment variables in the Lambda console: `BUCKET`, `APPSYNC_ENDPOINT`, and `APPSYNC_KEY`. All of these values can be found in `aws-exports.js`\n\n6. Run the project\n\n```sh\nnpm start\n```\n\n### Tools\n\n- React\n- AWS Amplify\n- AWS AppSync\n- Amazon Cognito\n- Amazon Rekognition\n- React Router\n- AWS Lambda\n\n### GraphQL schema\n\n```graphql\ntype ImageData @model\n  @auth(rules: [\n    { allow: public },\n    { allow: private }\n    ])\n{\n  id: ID!\n  imageKey: String\n  rekognitionData: String\n  imageTypes: [String]\n}\n\ntype Query {\n  process(imageKey: String!): ImageData @function(name: \"rekognitionfunction-${env}\")\n}\n```\n\n### Lambda function:\n\n```javascript\nconst AWS = require('aws-sdk')\nAWS.config.update({region: 'us-east-2'})\nconst rekognition = new AWS.Rekognition()\nconst axios = require('axios')\nconst gql = require('graphql-tag')\nconst graphql = require('graphql')\nconst { print } = graphql\nconst uuid = require('uuid/v4')\n\nconst saveData = gql`mutation CreateImageData($input: CreateImageDataInput!) {\n  createImageData(input: $input) {\n    id\n    imageKey\n    rekognitionData\n  }\n}`;\n\nexports.handler = function (event, context) { //eslint-disable-line\n  var params = {\n    Image: {\n      S3Object: {\n        Bucket: process.env.BUCKET, \n        Name: \"public/\" + event.arguments.imageKey\n      }\n    }, \n    MaxLabels: 10, \n    MinConfidence: 70\n  };\n\n  rekognition.detectLabels(params, function(err, data) {\n    if (err) {\n      context.done(err)\n    } else {\n      const rekognitionData = JSON.stringify(data)\n      axios({\n        url: process.env.APPSYNC_ENDPOINT,\n        method: 'post',\n        headers: {\n          'x-api-key': process.env.APPSYNC_KEY\n        },\n        data: {\n          query: print(saveData),\n          variables: {\n            input: {\n              imageKey: event.arguments.imageKey,\n              rekognitionData\n            }\n          }\n        }\n      })\n      .then(successData =\u003e {\n        const { id, imageKey, rekognitionData } = successData.data.data.createImageData\n        const graphqlData = {\n          id,\n          imageKey,\n          rekognitionData\n        }\n        context.done(null, graphqlData)\n      })\n      .catch(err =\u003e context.done(err))\n    }\n  })\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Freal-time-image-tracking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdabit3%2Freal-time-image-tracking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Freal-time-image-tracking/lists"}