This is a fully serverless GraphQL backend for interacting with the NYC MTA API. It runs in AWS and is deployed using CDK.
This was previously the backend for closingdoors.nyc.
UpdateFeedsService
: A Fargate service that takes a periodic snapshot of the MTA's real-time data feeds and persists them to S3 for consumption by other services.mtaApi
: The AppSync instance that resolves GraphQL requests.mtaNearestStation
: a Lambda function that resolves thenearestStations
query.mtaTrainTimes
: a Lambda function that resolves thetrainTimes
query.mtaSystemMetadata
: a DynamoDB table that resolves thesystemMetadata
query (see:mapping_templates
folder).
The following environment variables are used:
CONTAINER_REGISTRY
: the address of the container registry to push/pull themta-feed-fetcher
Docker image.OUTPUT_APPSYNC_DETAILS
: if true, output the AppSync URL and API key after deployment. These are considered secrets and are not output in builds hosted on GitHub.
Before deploying the infrastructure, the mta-feed-fetcher
Docker image needs to be built and published:
cd docker
./build_and_push
This only needs to be done once initially and then subsequently when the image changes.
npm install && npm run build
cdk deploy --all