Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

distributeaid/flexport-shipment-monitor

Repository files navigation

Distribute Aid Flexport Shipment Monitor

Test and Release semantic-release Renovate Mergify Status Commitizen friendly code style: prettier

Monitor shipments on Flexport.

Note: This project is not feature complete, until then 1.x releases may contain breaking changes. Development is managed in this project.

This project provides

  • a GraphQL API using AWS AppSync to query Flexport's API v2, which simplifies the resolving of links and pagination.
  • a webhook receiver to receive shipment event notifications
  • a Slack notifier which posts an update to a channel when a shipment event is received

Development

ℹ️ These instructions apply to Unix-based development environments; Linux and Mac users should be fine. Windows users could look into setting up their development environment using WSL2.

CLI Usage

npm ci
npx tsc

export FLEXPORT_API_KEY=<your API key>

node cli

Deploy

Make sure your have AWS credentials in your environment.

npm ci
npx tsc

The Flexport API credentials need to be provided:

aws ssm put-parameter --name /${STACK_NAME:-flexport-shipment-monitor-dev}/flexport/apiKey --type String --value <Flexport API Key>

The Slack webhook endpoint needs to be provided:

# disable URL resolution in the AWS CLI: aws configure set cli_follow_urlparam false
aws ssm put-parameter --name /${STACK_NAME:-flexport-shipment-monitor-dev}/slack/webhook --type String --value <Slack Webhook URL>

If this is the run the first time in an account

npx cdk bootstrap
npx cdk -a 'node dist/aws/cloudformation-sourcecode.js' deploy

Deploy the integration:

npx cdk deploy

Continuous Integration

This project is continuously tested using a real instance.

Architecture decision records (ADRs)

see ./adr.