Skip to content

TJM-Associates/ot-right-reservations

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 39 commits ahead of lmwy-labs:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
aws
 
 
 
 
db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OpenPlace - Restaurant Reservations Module

A restaurant reservation booking app. Scaled the backend of the reviews microservice to handle +2400 RPS over +100M rows at under 50 ms latency.

  • Postgres as primary data store
  • Redis for in-memory caching
  • Load balancer server pointing to multiple EC2 instances of the application

Tech Stack

  • Front end: ReactJS
  • Back end: Node/Express, Postgres, Redis, AWS EC2

Related Projects

Table of Contents

  1. Usage
  2. Requirements
  3. Development
  4. [CRUD APIs](CRUD APIs)

Usage

Install node modules using npm install.

Initialize Postgres schema and generate dummy data for 10M restaurants and 100M reservations.

npm run sql
npm run seed

Launch webpack and host server.

npm run build:dev
npm run start:dev

This component uses port 3003, with the global component name Reservation.

Requirements

An nvmrc file is included if using nvm.

  • Node 6.13.0
  • etc

Development

Installing Dependencies

From within the root directory:

npm install

CRUD APIs

Create a new reservation

Creates a new reservation for the given restaurant_id, reservation_date, reservation_time, and party_size.

POST /api/restaurants/reservations

Sample Input:

POST /api/restaurants/1/reservations
{
  "reservation_datetime": "2019-09-02 13:00:00",
  "seats": 3,
}

Sample Output:

{
  "id": "123",
  "restaurant_id": "r1",
  "reservation_datetime": "2019-09-02 13:00:00",
  "seats": 3,
}

Retrieve available times for restaurant

Retrieves a list of available reservation times for the given restaurant_id, reservation_date, reservation_time, and party_size.

GET /api/restaurants/:restaurantId/availability/date={reservation_date}&time={reservation_time}&seats={party_size}

Sample Input:

GET /api/restaurants/1/availability/date=2019-09-12&time=19:00&seats=3

Sample Output:

["19:00", "19:30", "20:00"]

Update an existing reservation

Updates an existing reservation's party size given the reservation_id.

PATCH /api/restaurants/:restaurantId/reservations/:reservationId

Sample Input:

PATCH /api/restaurants/1/reservations/111
{
  "num_reserved_seats": 3,
}

Sample Output:

{
  "reservation_id": 111,
  "seats": 3,
}

Delete a reservation

Deletes the reservation given the reservation_id.

DELETE /api/restaurants/:restaurantId/reservations/:reservationId

About

OpenPlace - A restaurant reservations app. Designed backend architecture to support 100M rows and 2400+ RPS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.0%
  • TSQL 4.6%
  • Dockerfile 1.3%
  • HTML 1.1%