Coder Social home page Coder Social logo

location-snap's Introduction

location-snap

Project Integrating Location based picture posting and Viewing.

Content:

About

This Project was build as part of Udacitys Cloud Developer Nanodegree graduation project. The scope of the project was to be set by the developer and there were no limitations as to what kind of stacks to use.

Application Scope

Location Snap is a location based public image posting application. Users can signup and login via Auth0 and then proceed to post images.

Each image posted is maped to a physical location in the world(geolocation). Authenticated Users can query for all images in a radius to a geolocation, which both are provided as query parameters.

A list of imageId's and the distance of each image to the user (in km, rounded as integer) will be returned.

With that data, the user can proceed to open a single image. The userId will be added to the list of users who have viewed the image and a presigned url to access the image will be returned to the user, future queries for pictures won't return the one which has just been accessed.

Application Stack

The whole application has been developed using the serverless framework, AWS and Auth0 as Identity provider:

Stack Diagram

While the whole application could have been developed using a single database, it has been split into using DynamoDB for image metadata and Postgres to process location related data:

Postgres is hosted on an AWS RDS Aurora Serverless cluster, thus making the whole application completly 'serverless' without even the need to provision instances.

With the underlying R-Tree structure, Postgres with the PostGIS extension is very efficient at processing location distance queries (implementation chosen is EPSG 4326 with Cartesian plane instead of gegraphical sphere, which results in cheaper computational costs butsome precision loss on longer distances).

Choosing this implementation, location-based queries are faster and also much cheaper than with DynamoDB, while at the same time implementing DynamoDB offers easy and efficient future implementation of additional features (for example, adding user interaction such as liking / commenting on pictures).

Demo

A due to data regulations private Demo of the running application can be found here. Please contact me for the password.

Setup

git clone https://github.com/willsamu/location-snap.git

Backend

NOTE: Deploying this configuration will create resources on AWS for which you will be charged according to AWS's pricing conditions.

Signup at Auth0 and create an application with RS256 encrypted signature.

Replace jwksUrl in src/lambda/auth/auth0Authorizer.ts with your Auth0JSON Web Key Set.

Install and setup Serverless for usage with AWS.

cd backend && yarn

Open serverless.yml and Comment/Remove Entity RDSCluser (line 222 - 236).

sls deploy

This deploys the Cloudformation stack to AWS, not including the Aurora Cluster. Alternatively run sls deploy --stage {desiredStageName} to select a different stage.

Open AWS Console -> Secrets Manager, select snap-rds-key-{stage}, and insert a username & password for the Cluster:

{
  "username": "myUsername",
  "password": "mySecurePassword"
}

Uncomment/Add the RDSCluster again.

Finally and for further deploys, run sls deploy again.

Frontend

cd frontend && yarn

Edit the config.ts file with the apiId provided from Api Gateway, and the region you've used for deployment (default eu-central-1).

Populate authConfig.domain and authConfig.clienId with your Auth0 App resources.

Add the url {hostingUrl}/callback as valid callback url in the Auth0 Console.

Optionally set another reactPassword which blocks the page content from public access.

yarn start

location-snap's People

Contributors

willsamu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.