{"id":13532558,"url":"https://github.com/dabit3/appsync-graphql-cities","last_synced_at":"2025-11-17T15:28:34.745Z","repository":{"id":73190367,"uuid":"120858552","full_name":"dabit3/appsync-graphql-cities","owner":"dabit3","description":"A real time React Native application built using GraphQL \u0026 AWS AppSync","archived":false,"fork":false,"pushed_at":"2018-03-29T17:07:23.000Z","size":739,"stargazers_count":39,"open_issues_count":2,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-09T09:58:56.910Z","etag":null,"topics":["android","appsync","graphql","ios","javascript","react","react-apollo","react-native"],"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/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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-02-09T04:58:13.000Z","updated_at":"2025-02-13T12:20:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f3d2ce7-474d-4772-9eab-7d57a41cc769","html_url":"https://github.com/dabit3/appsync-graphql-cities","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dabit3/appsync-graphql-cities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-graphql-cities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-graphql-cities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-graphql-cities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-graphql-cities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dabit3","download_url":"https://codeload.github.com/dabit3/appsync-graphql-cities/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabit3%2Fappsync-graphql-cities/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284911240,"owners_count":27083421,"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":["android","appsync","graphql","ios","javascript","react","react-apollo","react-native"],"created_at":"2024-08-01T07:01:11.855Z","updated_at":"2025-11-17T15:28:34.730Z","avatar_url":"https://github.com/dabit3.png","language":"JavaScript","readme":"# React Native and AppSync - Demo Travel App\n\nThis app demonstrates how to integrate React Native \u0026 GraphQL using [AppSync](https://aws.amazon.com/appsync/) with optimistic UI and real time subscriptions.\n[AppSync](https://aws.amazon.com/appsync/) is part of [AWS Mobile](https://aws.amazon.com/mobile/)\n\nTo view the tutorial for how to build this app, see both [part 1](https://code.tutsplus.com/tutorials/code-an-app-with-graphql-and-react-native--cms-30511) and [part 2](https://code.tutsplus.com/tutorials/code-an-app-with-graphql-react-native-and-aws-appsync-the-app--cms-30569) on Tuts Plus.\n\n![React Native AppSync](https://i.imgur.com/X3zmWGS.jpg)\n\n### To get started    \n\n1. clone project    \n\n```\ngit clone https://github.com/dabit3/appsync-graphql-cities.git\n```\n\n2. change into directory and install dependencies    \n\n```\ncd appsync-graphql-cities \u0026\u0026 yarn || cd appsync-graphql-cities \u0026\u0026 npm install\n```\n\n3. Update credentials in `./aws-exports`    \n\n4. Run project in either iOS or Android simulators\n\n___\n\n## AppSync Configuration    \n\nFor this to work, you must have the following AppSync Schema as well as the `cityId-index` created in your LocationTable (see screenshot below). You must also have the correct resolver mapping template for the `listLocations` query.\n\n#### listLocations request mapping template:    \n\n```\n{\n    \"version\": \"2017-02-28\",\n    \"operation\": \"Query\",\n    \"index\": \"cityId-index\",\n    \"query\": {\n        \"expression\": \"cityId = :cityId\",\n        \"expressionValues\": {\n            \":cityId\": {\n                \"S\": \"$ctx.args.cityId\"\n            }\n        }\n    },\n    \"limit\": #if($context.arguments.limit) $context.arguments.limit #else 10 #end,\n    \"nextToken\": #if($context.arguments.nextToken) \"$context.arguments.nextToken\" #else null #end\n}\n```\n\n#### Schema    \n\n```\ntype City {\n\tid: ID!\n\tname: String!\n\tcountry: String!\n\tlocations: [Location]\n}\n\ntype CityConnection {\n\titems: [City]\n\tnextToken: String\n}\n\ninput CreateCityInput {\n\tid: ID!\n\tname: String!\n\tcountry: String!\n}\n\ninput CreateLocationInput {\n\tid: ID!\n\tcityId: ID!\n\tname: String!\n\tinfo: String\n}\n\ninput DeleteCityInput {\n\tid: ID!\n}\n\ninput DeleteLocationInput {\n\tid: ID!\n}\n\ntype Location {\n\tid: ID!\n\tcityId: ID!\n\tname: String!\n\tinfo: String\n}\n\ntype LocationConnection {\n\titems: [Location]\n\tnextToken: String\n}\n\ntype Mutation {\n\tcreateCity(input: CreateCityInput!): City\n\tupdateCity(input: UpdateCityInput!): City\n\tdeleteCity(input: DeleteCityInput!): City\n\tcreateLocation(input: CreateLocationInput!): Location\n\tupdateLocation(input: UpdateLocationInput!): Location\n\tdeleteLocation(input: DeleteLocationInput!): Location\n}\n\ntype Query {\n\tgetCity(id: ID!): City\n\tlistCities(first: Int, after: String): CityConnection\n\tgetLocation(id: ID!): Location\n\tlistLocations(cityId: ID!, first: Int, after: String): LocationConnection\n}\n\ntype Subscription {\n\tonCreateCity(id: ID, name: String, country: String): City\n\t\t@aws_subscribe(mutations: [\"createCity\"])\n\tonUpdateCity(id: ID, name: String, country: String): City\n\t\t@aws_subscribe(mutations: [\"updateCity\"])\n\tonDeleteCity(id: ID, name: String, country: String): City\n\t\t@aws_subscribe(mutations: [\"deleteCity\"])\n\tonCreateLocation(\n\t\tid: ID,\n\t\tcityId: ID,\n\t\tname: String,\n\t\tinfo: String\n\t): Location\n\t\t@aws_subscribe(mutations: [\"createLocation\"])\n\tonUpdateLocation(\n\t\tid: ID,\n\t\tcityId: ID,\n\t\tname: String,\n\t\tinfo: String\n\t): Location\n\t\t@aws_subscribe(mutations: [\"updateLocation\"])\n\tonDeleteLocation(\n\t\tid: ID,\n\t\tcityId: ID,\n\t\tname: String,\n\t\tinfo: String\n\t): Location\n\t\t@aws_subscribe(mutations: [\"deleteLocation\"])\n}\n\ninput UpdateCityInput {\n\tid: ID!\n\tname: String\n\tcountry: String\n}\n\ninput UpdateLocationInput {\n\tid: ID!\n\tcityId: ID\n\tname: String\n\tinfo: String\n}\n\nschema {\n\tquery: Query\n\tmutation: Mutation\n\tsubscription: Subscription\n}\n```\n\n### LocationTable index configuration\n\n![](https://i.imgur.com/W05xPFo.png)\n","funding_links":[],"categories":["Example Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Fappsync-graphql-cities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdabit3%2Fappsync-graphql-cities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabit3%2Fappsync-graphql-cities/lists"}