Curbside pickup

End-to-end patterns for curbside pickup with Mapbox

What does this solution do?

This solution enables developers to quickly build, test, and deploy all the components of a location-enabled curbside pickup program. Typical implementations of curbside rely heavily (or entirely) on customer actions, such as call when you arrive. This reactive process hinders process optimization and results in slow delivery times.

The more idealized curbside experience contained in this solution ties together customer location with key business activities such as order picking & packing and staging for delivery. The solution provides an organized set of code and infrastructure to demonstrate each step of the flow and its integration with the Mapbox platform.

Version:
1.0
Last Updated:
July 24, 2020
Author:
Mapbox
Start building
Get source code from Github

Solution Details

The curbside solution is a collection of code and deployable infrastructure that implements a location-optimized curbside pickup order flow. It includes:

  1. Data preparation - constructing and tiling isochrone-based geofences
  2. Infrastructure - managing the order flow and location data
  3. Interface - customer and business interaction with curbside infrastructure.

Data preparation

This component demonstrates how to convert store location information into isochrones, using the Mapbox Isochrone API.

Once the isochrones are created, the script converts them into geofences using the Mapbox Tiling Service. By converting these data into vector tiles, users can perform geofencing queries with the Mapbox Tilequery API. These results can then be passed into a notification service to alert the store to perform a specific task (such as "stage the order when the customer is 3 minutes away").

Creating vector tile geofences

Infrastructure

This component maps each step of the ideal curbside order flow to an API infrastructure. Each API endpoint provides an event processor that moves an order along from ingestion to delivery, and logs each step into a database. By isolating each event into an API call, the curbside solution demonstrates how to integrate specific Mapbox services into your own order management systems.

This component deploys the following endpoints into your AWS account:

/order

Add an order and calculate ETA with Mapbox Directions API.

Delete an order.

/orders

List all orders.

/here

Announce that customer has arrived and notify employees with text message via AWS SNS.

/geofence

Perform geofence query with Mapbox Tilequery API and notify employees with text message via AWS SNS.

Interface

This component represents a simplified interface for placing and monitoring orders through the curbside infrastructure. It contains a sample customer-facing page and a sample employee-facing page.

  • Sample customers can place orders, announce arrivals, and indicate they have received their order.
  • Sample employees can see the order log, ETA, which geofence the customer is in, and arrival status.

Technical Information

All three components of the solution are available via GitHub. To use the solution you will need the following.

  • Current Mapbox account and tokens

    Public-scoped (pk) token for all API interactions.
    Secret-scoped (sk) token for Mapbox Tiling Service interactions. Read about token management here.
  • AWS Account

    You will need basic familiarity with Amazon Web Services (AWS). You will need an active AWS account with valid Access and Secret keys to deploy your infrastructure. If you do not have an AWS account, you will need to create an account and consult the AWS documentation for configuring CLI access.
  • Pulumi
    This solution depends on Pulumi to deploy the sample infrastructure to AWS. Pulumi allows you to use common programming languages like Javascript to define and manage infrastructure. It reduces the need to manually manage infrastructure deployments via the AWS Console or learn new syntax like CloudFormation. Once you have signed up and installed the CLI, run pulumi up to deploy the solution.

Usage considerations

You will be consuming services from Mapbox and AWS. You are responsible for any associated costs.

  • Mapbox usage
    Each location in the data prep phase results in two calls to the Isochrone API. The final GeoJSON is submitted to the Mapbox Tiling Service for processing. Services called via the infrastructure are available on the free tier.

    All services used in the solution are available on free tier. The Mapbox Tiling Service is billable, but should be in the free tier. This may change based on the volume and number of isochrones you generate. For more pricing details, consult the Mapbox pricing documentation.
  • Pulumi
    There is no charge for Pulumi usage.