{"id":16979995,"url":"https://github.com/gsans/amplify-london-cycles","last_synced_at":"2025-04-12T01:43:24.112Z","repository":{"id":38644004,"uuid":"226081211","full_name":"gsans/amplify-london-cycles","owner":"gsans","description":"LondonCycles. Find available rental Santander Cycles in London using open data via GraphQL with AWS Amplify and Angular","archived":false,"fork":false,"pushed_at":"2023-05-07T11:18:19.000Z","size":1582,"stargazers_count":11,"open_issues_count":7,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T21:23:00.667Z","etag":null,"topics":["amazon-elasticsearch","aws-amplify","aws-appsync","geolocation","graphql","mapbox","mapbox-gl-js","open-data"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/gsans.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-12-05T10:59:02.000Z","updated_at":"2023-04-15T10:53:33.000Z","dependencies_parsed_at":"2022-08-27T20:20:25.858Z","dependency_job_id":null,"html_url":"https://github.com/gsans/amplify-london-cycles","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/gsans%2Famplify-london-cycles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsans%2Famplify-london-cycles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsans%2Famplify-london-cycles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsans%2Famplify-london-cycles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gsans","download_url":"https://codeload.github.com/gsans/amplify-london-cycles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505869,"owners_count":21115353,"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":["amazon-elasticsearch","aws-amplify","aws-appsync","geolocation","graphql","mapbox","mapbox-gl-js","open-data"],"created_at":"2024-10-14T01:48:23.047Z","updated_at":"2025-04-12T01:43:24.092Z","avatar_url":"https://github.com/gsans.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LondonCycles. Find available rental Santander Cycles in London using open data via GraphQL with AWS Amplify and Angular\n\n\u003cp float=\"left\" \u003e\n  \u003cimg src=\"https://i.imgur.com/tvwNkuA.gif\" height=\"350px\" /\u003e\n  \u003cimg src=\"https://i.imgur.com/t70U9hb.png\" height=\"350px\" /\u003e\n\u003c/p\u003e\n\nThis app shows how to integrate **Amazon Elasticsearch** with **AWS Amplify**, **AWS AppSync** to query Santander Cycles open data via **GraphQL** and create a client using **Mapbox** and **Angular** to run GraphQL distance-aware searches.\n\nFeatures included:\n- Display bike stations and allow querying a single bike station to see how many free bikes it has available at the moment using Santander Cycles open data via GraphQL.\n- Find the nearest bike stations around a given location and how many bikes are available for each at that time through a single GraphQL API.\n- Query using users current location (Geolocation Web API) or map coordinates.\n- Allow users to locate points of interest, addresses or places using a text based search integrating the Mapbox Geocoding API.\n- Relocate map to a default location, at Piccadilly Circus, for demo purposes.\n\n\nDistance-aware searches usage example:\n```\nquery NearbyBikes {\n  nearbyBikeStations(location: { \n    lat: 51.510239,\n    lon: -0.134167\n  }, m: 500, limit: 10) {\n    total\n    nextToken\n    items {\n      id\n      name\n      location {\n        lat\n        lon\n      }\n      bikes\n    }\n  }\n}\n```\n\n## Deploy with the AWS Amplify Console\n\nThe AWS Amplify Console provides hosting for fullstack serverless web apps. [Learn more](https://console.amplify.aws). Deploy this app to your AWS account with a single click:\n\n[![amplifybutton](https://oneclick.amplifyapp.com/button.svg)](https://console.aws.amazon.com/amplify/home#/deploy?repo=https://github.com/gsans/amplify-london-cycles)\n\n\u003e**Important**: enabling searches in your application will incur in costs. As part of the AWS Free Tier you are able to use searches for at least 30 days and up to 1GB data transfer with no cost.\n\nThe Amplify Console will fork this repo in your GitHub account, and then build and deploy your backend and frontend in a single workflow. Your app will be available at `https://master.APPID.amplifyapp.com`.\n\n## Run locally with the Amplify CLI\n\n1. Install and configure the Amplify CLI\n\n```\n  npm install -g @aws-amplify/cli\n  amplify configure\n```\n\n2. Install and configure the Amplify CLI\n\n```\n  amplify init --app https://github.com/gsans/amplify-london-cycles\n```\n  \n\u003eThe init command clones the GitHub repo, initializes the CLI, creates a ‘sampledev’ environment in CLI, detects and adds categories, provisions the backend, pushes the changes to the cloud, and starts the app.\n\n3. Provisioning the frontend and backend\n\nOnce the process is complete, the CLI will automatically open the app in your default browser.\n\n# Elastic Search Setup\n```\n# Create the index if it does not exist\nPUT /bikepoint\n```\nResult\n```\n{\n  \"acknowledged\": true,\n  \"shards_acknowledged\": true,\n  \"index\": \"bikepoint\"\n}\n```\n\n```\n# Tell Elasticsearch that the location field is a geo_point\nPUT /bikepoint/_mapping/doc\n{\n  \"properties\": {\n    \"location\": {\n      \"type\": \"geo_point\"\n    }\n  }\n}\n```\nResult \n```\n{\n  \"acknowledged\": true\n}\n```\n\nCreate BikePoint\n```\nmutation addBikePoint {\n  m0: createBikePoint(input: { id: \"BikePoints_1\" name: \"River Street , Clerkenwell\" location: { lat: 51.529163 lon: -0.10997 } }) { id }\n}\n```\n\nQuery\n```\nquery nearByBikes {\n  nearbyBikeStations(location:{\n    lon: -0.134167\n    lat: 51.510239\n  } km: 3) {\n    items {\n      id name location { lon lat }\n    }\n  }\n}\n```\n\nSearches\n```\nGET /bikepoint/_search\n{\n  \"query\": { \"match_all\": {} }\n}\n\nGET /bikepoint/doc/_search\n{\n  \"query\": { \"match_all\": {} }\n}\n```\n\nSearch Radius around location\n```\nGET /bikepoint/doc/_search\n{\n  \"from\" : 0, \n  \"size\" : 20,  \n  \"query\": {\n    \"bool\" : {\n      \"must\" : {\n        \"match_all\" : {}\n      },\n      \"filter\" : {\n        \"geo_distance\" : {\n          \"distance\" : \"1km\",\n          \"location\" : {\n            \"lon\": -0.134167,\n            \"lat\": 51.510239\n          }\n        }\n      }\n    }\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsans%2Famplify-london-cycles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgsans%2Famplify-london-cycles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsans%2Famplify-london-cycles/lists"}