• Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    Go
  • Created about 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

uber, but for on-demand delivery.

Postmates

This is the heart of a delivery service. Features include geo-indexing, order-dispatch, proximity-searching, ETA, trip estimates, etc
We use google maps for features such as distance-matrix and directions
Find more documentation here

Inbuilt Features

  • geo-indexing
  • geo-radius search
  • ETA
  • order creation
  • order dispatch
  • order acceptance
  • order order rejection
  • customer login/signup
  • customer ratings

Requirements

  • Postgres
  • Redis
  • Uber H3

Architecture

  • We use websocket connections for realtime communications with courier and customers. The ws connections are store in-memory in a concurrency safe manner.
  • Couriers are indexed using uber's h3 geo-indexing library and grouped in redis.
  • When you perform a radius search(closest couriers), we use h3 to calculate all indices 2 levels at resolution 8, see image below. Then we query our courier index, powered by redis to find all the couriers in those locations. Then, we make a request using their lng/lats and the customer's lng/lat to google maps to get the distance and duration from the customer, then we sort that result, and then dispatch the order to these couriers in order of those closest the origin of the request. (See image
  • The couriers send location updates every 3 seconds. This allows us to know their locations in almost realtime.
  • The dispatch logic gives a courier 5 seconds to accept an order, after which it is sent to the next closest/available courier. If none of the available couriers accept the request, the process starts all over again, till someone finally accepts it.

Project Setup

  1. Clone the repo and make a copy of .env.sample as .env & update the env vars.
git clone https://github.com/gwuah/postmates.git
cp .env.sample .env
  1. Run the app using either :
go run main.go
go build main.go
./main

Demo

  • cd demo and run yarn to install all required dependencies.
  • run node electrons.js to initiate 3 couriers instances that are constantly sending location updates every 3 seconds
  • run node customer__delivery_request.js to instantiate a customer that will create a delivery request.
  • pay attention to the logs.

More Repositories

1

cashapp

peer-to-peer payments service
Go
27
star
2

subway

network tunneling software
Rust
21
star
3

geo-indexer

a simple geo-coordinate indexing service.
Go
10
star
4

athena

geo-indexing / dispatch / ETA / proximity-search
Go
9
star
5

rproxy

๐ŸคŸ๐Ÿพ the world's greatest reverse proxy
Go
6
star
6

heatmap

:neckbeard: a minimal javascript library that generates user activity heat-maps for your website.
JavaScript
6
star
7

reminder

remind me to take breaks every hour! ๐Ÿ˜ค
Go
5
star
8

sherperd

๐Ÿ’‚โ€โ™‚๏ธ A twitter account growth service. [ Built with Node.js ]
JavaScript
5
star
9

crypto-maniac

๐Ÿ’ฐ Keep track of the top 6 crypto-currencies in real time. Comes with a nice Nice UI too.
JavaScript
5
star
10

node-server-boilerplate

A boilerplate for hacking up quick nodejs servers
JavaScript
3
star
11

token-daily-telegram-bot

A token-daily news bot that runs on telegram.
JavaScript
3
star
12

hermes

a highly unstable irc client
Python
3
star
13

ds-algorithms

practicing ds-algorithms to improve my problem solving ability
JavaScript
3
star
14

go-process-killer

a program that hunts for all go processes and kills them
Go
3
star
15

tinderclone

tinderclone api
Go
3
star
16

xenar

๐Ÿ˜ˆ Chrome extension blocks in-browser crypto-miners.
JavaScript
3
star
17

udemy-course-link-extractor

๐ŸŒˆ a program that extracts lecture video links of a Udemy course a user has purchased.
Python
3
star
18

twitter-save

โšก chrome extension that enables you to save tweets for later reference!
JavaScript
3
star
19

kerious

A minimal version of curious cat.
CSS
2
star
20

kermit

๐Ÿ‘ธ mini trojan that dumps your browser login history
Python
2
star
21

gotham

exercises to learn golang. Especially implementations of classic cs algorithms. [More into java now]
Go
2
star
22

afdtechbot

๐Ÿ”ฅ A twitter-bot that monitors twitterโ€™s tweet stream for the afdtechtalk hashtag ( #afdtechtalk )
2
star
23

mimosa

๐ŸŒต a lightweight javascript library for building beautiful drop-downs.
HTML
2
star
24

todo-list

A minimal todo list built with Vanilla Javascript
JavaScript
2
star
25

schoology-py

A script that alerts me when new courses, materials, or updates to my schoology circle
2
star
26

axel

๐Ÿธ Unique containers per namespace in local-storage.
JavaScript
2
star
27

adventofcode21

solutions to advent of code 2021
Go
1
star
28

humano-rescue

HTML
1
star
29

node-starter-griffith

๐Ÿ”ฅ A custom starter file for all my node projects. [@gwuah]
JavaScript
1
star
30

feedbackhunt-frontend

frontend for feedback hunt(it's messed up, will be changing my architecture soon)
Vue
1
star
31

livescores-scraper

A script that scrapes score data from livescores.com
Python
1
star
32

tiny-app

tiny backend to demo role based authorization (very diry)
JavaScript
1
star
33

website

building a website for myself.
HTML
1
star
34

Kreeboard

โšก Chrome Dashboard
CSS
1
star
35

react-bootcamp

my attempt at teaching few people reactjs
JavaScript
1
star
36

scully

A golang wrapper around mapbox apis
Go
1
star
37

telegram-bot

A simple telegram bot i worked on sometime back! Deployed with NOW!
JavaScript
1
star
38

mywebsite

๐Ÿ’€ my personal website
Vue
1
star
39

adsumo-online-resturant

A web application built to serve a restaurants services online. [Vue, Node]
CSS
1
star
40

eva

โญ A command line tool that setups a new express project. [more like express-cli, but for larger applications]
1
star
41

mailcollector

a tiny micro-service to record and serve customer emails. [python]
1
star
42

mudClone

โšก { Major competitor to Mudclo } -- Built in 4hrs
CSS
1
star
43

lamaison

One place for tertiary students and workers to find affordable hostels/housing
JavaScript
1
star
44

341fe

ILOC Compiler
Java
1
star
45

lamaison-frontend

Web Application For Laimaison Project [ https://lamaison-frontend.netlify.com ]
Vue
1
star
46

Fairytale

๐Ÿ’ต Some random project by @gwuah and I
CSS
1
star
47

gwuah.com

HTML
1
star
48

affinity-labs-interview

solution for affinity's take home question
JavaScript
1
star
49

aidahrector

A simple chrome extension I built to speedup development
JavaScript
1
star
50

ogma

๐Ÿ”ฅ Super Tiny Language Detetection Library
Python
1
star
51

node-auth-jwt

Implement authentication in nodejs using jsonwebtokens.
JavaScript
1
star
52

feedback-hunt

Get customer feedback, in realtime, with absolutely zero hassle.
HTML
1
star
53

management-software

CLI management software written in c++ and python
C++
1
star
54

deSMB

Automatically disables SMB-1 on all Windows machines and also shuts down port 445
Python
1
star
55

slayte-internship

Solution to slayte coding test
TypeScript
1
star
56

felix

learning git
JavaScript
1
star