Skip to content

GraphQL API that provides information about the different public transport / urban mobility services of Barcelona

License

Notifications You must be signed in to change notification settings

aalises/barcelona-urban-mobility-graphql-api

Repository files navigation

Barcelona Urban Mobility Graphql API

Netlify Status Coverage Status MIT License

GraphQL API built using Apollo Server + Typescript that integrates information about the urban mobility services of the city of Barcelona.

It provides information about bus stops and lines, metro stations/lines, and public bikes (Bicing) stations and availability.

GraphQL Playground 🚀

Barcelona Urban Mobility GraphQL Playground

Usage 🔧

Install

The installation requires node.js as the execution environment as well as npm or yarn as the package manager. Then run npm install or yarn install as a command on your commandline interface.

Run

To run it, execute yarn build, and then yarn start. The application will be available port 9000.

Generate Schema

To generate the schema and Typescript types for the schema (on src/types.d.ts), run schema. This uses GraphQL Code Generator

Test

In order to test using Jest, just run yarn test or npm run test

Data Sources 📊

Metro Stations / Bus Stops

For the metro stations and bus stops, we use the public Transports Metropolitans de Barcelona (TMB) API, at https://developer.tmb.cat/.

The App Key and App ID are passed through the node's process.env.TMB_API_APP_KEY and process.env.TMB_API_APP_ID and the credentials can be obtained if you log and register an app to the portal.

Bike Stations

For the bike stations, we use the BSMSA API for smou/bicing. The endpoints are:

https://api.bsmsa.eu/ext/api/bsm/gbfs/v2/en/station_information
https://api.bsmsa.eu/ext/api/bsm/gbfs/v2/en/station_status

About

GraphQL API that provides information about the different public transport / urban mobility services of Barcelona

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published