{"id":16446130,"url":"https://github.com/mschaeffner/react-native-graphql-aws-amplify","last_synced_at":"2025-07-13T02:04:05.737Z","repository":{"id":93436089,"uuid":"162539116","full_name":"mschaeffner/react-native-graphql-aws-amplify","owner":"mschaeffner","description":"Demo to get AWS Amplify, GraphQL, Cognito, DynamoDB and an Expo app with Apollo client running together","archived":false,"fork":false,"pushed_at":"2018-12-20T11:01:35.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T01:47:57.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/mschaeffner.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":"2018-12-20T06:53:54.000Z","updated_at":"2020-01-08T22:31:52.000Z","dependencies_parsed_at":"2023-04-07T18:48:40.502Z","dependency_job_id":null,"html_url":"https://github.com/mschaeffner/react-native-graphql-aws-amplify","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/mschaeffner%2Freact-native-graphql-aws-amplify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschaeffner%2Freact-native-graphql-aws-amplify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschaeffner%2Freact-native-graphql-aws-amplify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschaeffner%2Freact-native-graphql-aws-amplify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mschaeffner","download_url":"https://codeload.github.com/mschaeffner/react-native-graphql-aws-amplify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240831381,"owners_count":19864718,"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":[],"created_at":"2024-10-11T09:46:31.437Z","updated_at":"2025-02-26T10:15:44.606Z","avatar_url":"https://github.com/mschaeffner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-graphql-aws-amplify\n\n## Get the backend running\n\n### Install and configure Amplify CLI\n`npm install -g @aws-amplify/cli`\n\n`amplify configure`\n\n### Clone this repo\n`git clone git@github.com:mschaeffner/react-native-graphql-aws-amplify.git`\n\n### Init Amplify in project\n`amplify init`\n\n### Configure Cognito user pool\n`amplify add auth`\n\n### Configure S3 Bucket for storage\n`amplify add storage`\n\n### Configure GraphQL API\n`amplify add api`\n\nWhen asked for a schema, use the file `schema.graphql` in root directory.\n\n### Push all changes to AWS (this may take a few minutes)\n`amplify push`\n\n\n### Change GraphQL schema\n- Login into AWS account\n- Go to AppSync, select the new API and go to schema\n- Replace the schema with following and save:\n\n```\ntype ModelUserProfileConnection {\n\titems: [UserProfile]\n\tnextToken: String\n}\n\ntype Mutation {\n\tupdateUserProfile(input: UpdateUserProfileInput!): UserProfile\n}\n\ntype Query {\n\tgetUserProfile(id: ID!): UserProfile\n\tlistUserProfiles(limit: Int, nextToken: String): ModelUserProfileConnection\n}\n\ntype S3Object {\n\tbucket: String!\n\tregion: String!\n\tkey: String!\n}\n\ninput S3ObjectInput {\n\tbucket: String!\n\tregion: String!\n\tkey: String!\n}\n\ntype Subscription {\n\tonUpdateUserProfile: UserProfile\n\t\t@aws_subscribe(mutations: [\"updateUserProfile\"])\n}\n\ninput UpdateUserProfileInput {\n\tid: ID!\n\tname: String\n\tlocation: String\n\tavatar: S3ObjectInput\n}\n\ntype UserProfile {\n\tid: ID!\n\tname: String!\n\tlocation: String\n\tavatar: S3Object\n}\n```\n\n### Replace the existing GraphQL resolvers with the followings\n\n#### updateUserProfile(...): UserProfile\n```\n$util.qr($context.args.input.put(\"createdAt\", $util.time.nowISO8601()))\n$util.qr($context.args.input.put(\"updatedAt\", $util.time.nowISO8601()))\n$util.qr($context.args.input.put(\"__typename\", \"UserProfile\"))\n{\n  \"version\": \"2017-02-28\",\n  \"operation\": \"PutItem\",\n  \"key\": {\n      \"id\":     $util.dynamodb.toDynamoDBJson($ctx.args.input.id)\n  },\n  \"attributeValues\": $util.dynamodb.toMapValuesJson($context.args.input),\n}\n```\n\n\n#### getUserProfile(...): UserProfile\n```\n{\n  \"version\": \"2017-02-28\",\n  \"operation\": \"GetItem\",\n  \"key\": {\n      \"id\": $util.dynamodb.toDynamoDBJson($ctx.args.id)\n  }\n}\n```\n\n\n#### listUserProfiles(...): ModelUserProfileConnection\n```\n#set( $limit = $util.defaultIfNull($context.args.limit, 10) )\n{\n  \"version\": \"2017-02-28\",\n  \"operation\": \"Scan\",\n  \"filter\": null,\n  \"limit\": $limit,\n  \"nextToken\":   #if( $context.args.nextToken )\n\"$context.args.nextToken\"\n  #else\nnull\n  #end\n}\n```\n\n\n\n## Get the app running\n\n### Install NPM dependencies\nyarn\n\n### Run Expo application\nyarn start\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmschaeffner%2Freact-native-graphql-aws-amplify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmschaeffner%2Freact-native-graphql-aws-amplify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmschaeffner%2Freact-native-graphql-aws-amplify/lists"}