Skip to content

Latest commit

 

History

History
149 lines (107 loc) · 3.02 KB

README.md

File metadata and controls

149 lines (107 loc) · 3.02 KB

Homelike

Project features

  • REST API for properties and favorites
  • User management with AWS Cognito
  • API routing with AWS Api Gateway
  • Computing with AWS Lambda (Node.js)
  • Data storage with AWS DynamoDB
  • Infrastructure management with Terraform
  • Radius-based geospatial search supported by Google's S2 Geometry library
  • Data modelling using DynamoDB's single-table design

API documentation

Sign up

POST /sign-up

{
  "email": "[email protected]",
  "password": "your-password",
  "givenName: "John"
}

Note that you'll receive a verification email in the process. You can ignore it.

Sign in

POST /sign-in

{
  "email": "[email protected]",
  "password": "your-password",
}

This request returns the idToken that you'll need to authenticate with the rest of the API.

Create a new Property

POST /properties

{
  "name": "Cosy studio in the city center",
  "country": "DE",
  "city": "Cologne",
  "location": {
      "longitude": 50.93979502370754,
      "latitude": 6.934593964765874
  },
  "numberOfRooms": 1
}

Authentication is required for this endpoint.

Search Properties

GET /properties?...

{
  "longitude": 50.94170642954174,
  "latitude": 6.958322074883795,
  "radiusInMeters": 3000
}

Mark Property as Favorite

POST /me/favorites

{
  "propertyId": "xxxxxxxxx",
}

Authentication is required for this endpoint.

List my Favorites

GET /me/favorites

Authentication is required for this endpoint.

Deployment

The app is running on my private AWS account and I am therefore not sharing any public access data here.

See the instructions below to deploy to your own AWS account:

Requirements

  • AWS CLI
  • Terraform 1.0.2
  • Node.js 14
  • Npm 7

AWS CLI configuration

Deploy the infrastructure to AWS

cd infrastructure
terraform init
terraform apply

Deploy the lambda functions code

cd code
npm ci
make prepare
make deploy

Seed property data

cd code
node_modules/.bin/ts-node scripts/seed.ts

Try it

  • Find you API Gateway domain in the AWS console and use it to trigger the API.
  • Here's a Postman collection that should help. Take notice of the two environment variables api_url and id_token.

Known issues and limitations

  • No handling for DynamoDB's query response pagination
  • No pagination supported for the GET /properties request
  • No pagination supported for the GET /me/favorites request
  • Limited error handling
  • Limited test coverage