How I Built This: A Sports Betting Exchange (Part 2: The Backend)

Hurdle 4: How Do I Go About Building a Back End?

  • Receive all bets executed on the exchange
  • Submit bets to the exchange
  • Receive event updates from the exchange

Requirements

  • Users would need to be notified via email of any status change to their bet
  • Users would need to confirm their account creation via email
  • Bets would need to be submitted in real-time
  • Bets would have to be consumed and user profiles updated in real-time
  • Bets would have to be aggregated in real-time over 5 minute windows
  • Events would have to be updated in real-time
  • Users would need some sort of type-ahead functionality for searching events

Users would need to be notified via email of any status change to their bet

Users would need to confirm their account creation via email

  1. The email exists and mail can be sent to it
  2. The user has access to the inbox

Bets would need to be submitted in real-time

Bets would have to be consumed and user profiles updated in real-time

                                                       Graph explaining when to use Lambda vs AWS Fargate

Checkpoint

Bets would have to be aggregated in real-time over 5 minute windows

                                                         Query for 5 minute tumbling windows averaging bet odds

Events would have to be updated in real-time

Users would need some sort of type-ahead functionality for searching events

Loose Ends

The Back End Architecture

  • Boto3: for AWS calls to DynamoDB, SNS, and Kinesis
  • ElasticSearch Client: for reading from and writing to the type-ahead ES index
  • PyMySQL: for interactions with MySQL on Aurora
  • PyTest: for unit tests
  • Github Actions: for publishing docker images and uploading Lambda zip files to S3

The Infrastructure

  • Provider agnostic
  • Simple declarative configuration files
  • Faster feedback via the Terraform CLI
  • Modularity
  • Popularity and community support
                           Terraform Cloud Workspace runs console (top) and variables console (bottom)

Post a Comment

0 Comments