/backend-nodejs-logistics

A backend for logistics sample apps using HyperTrack

Primary LanguageJavaScriptMIT LicenseMIT

HyperTrack logo

Logistics Backend (NodeJS)

A sample NodeJS/ExpressJS server integration with the HyperTrack platform. It consumes HyperTrack APIs and Webhooks and exposes them through REST API endpoints and push notifications specifically for Logistics sample mobile apps (iOS/Android).

Features

  • Store drivers and deliveries
  • Receive HyperTrack Webhooks
  • Send mobile device push notifications on webhook arrival

How to deploy on Heroku

1. Get your keys

2. Use Heroku One-Click Deploy

This project is set up to be deployed to Heroku within seconds. Create or log in to your existing Heroku account and click on the one-click-deploy button below. It will provide the following services and add-ons:

  • Web Dyno - to run the server on Heroku
  • NodeJS buildpack - to run NodeJS/ExpressJS on Heroku
  • MongoLab - hosted MongoDB database
  • PaperTrail - hosted logging system

You need to have your keys ready for the deployment. The Heroku page will ask you for all these keys:

  • HyperTrack:
    • HT_ACCOUNT_ID = HyperTrack Account ID
    • HT_SECRET_KEY = HyperTrack Secret Key
  • Push Notifications:
    • APN_CERT: (iOS) APN certification (p9 file content)
    • APN_KEY_ID: (iOS) APN Key ID
    • APN_TEAM_ID: (iOS) APN Team ID
    • FCM_KEY: (Android) FCN Key

Deploy this project now on Heroku:

Deploy

As soon as the deployment is completed, you can view the app and within a new browser window you should see a confirmation to indicate that your backend is up and running successfully:

HyperTrack Logistics Backend is RUNNING

3. Set up webhooks

Follow the steps to verify HyperTrack Webhooks and receive them in this project. The webhook receiver endpoint is /hypertrack, so your Webhook URL should be:

# app name you entered on the deployment screen
https://<your_heroku_app_name>.herokuapp.com/hypertrack

By default, the server prints all webhook content to the console using console.log(req.body). You should look for the verification webhook and open the SubscribeURL printed in the console to enable webhooks to come in.

Documentation

For detailed documentation of the APIs, customizations and what all you can build using HyperTrack, please visit the official docs.

Contribute

Feel free to clone, use, and contribute back via pull requests. We'd love to see your pull requests - send them in! Please use the issues tracker to raise bug reports and feature requests.

We are excited to see what live location feature you build in your app using this project. Do ping us at help@hypertrack.com once you build one, and we would love to feature your app on our blog!

Support

Join our Slack community for instant responses. You can also email us at help@hypertrack.com.