Code Monkey home page Code Monkey logo

drawspace-be's Introduction

Running Tests

yarn install

yarn test (must have docker installed)

General architecture

  • AWS CDK for infrastructure as code
  • Cognito for user auth
  • Dynamodb as the database
  • Api-gateway / lambdas
  • S3 for browser based image/drawStack uploads
  • lambda-api library for API routing
  • dynamodb-toolbox as a Dynamodb "ORM"

Reasoning

I like CDK because you can version your infrastructure, plus it helps with deployment via CloudFormation. I'm generally a serverless advocate, and like to let AWS handle scaling so I chose to use Api-gateway/lambda and DynamoDb. Dynamodb is infinitely scalable, performant and cheap. I Like to use Ddb for data at rest and denormalize to other specialized databases for things like search (elasticsearch). Cognito allows for authenticating browser based uploads to s3 so only logged in users can upload to their bucket.

Didn't Implement / Trade offs

  • I probably would have split these stacks into their own repos in a prod environment
  • Not as many developer are comfortable with Dynamodb
  • Security concern with s3 uploads: I could post any api to the rest api for my thumbnail. Could easily be fixed by validating it is in the users bucket
  • Can't run the api locally, didn't have enough time to set up a dockerized ddb for it

Ddb Access patterns

Create User
Get User / Bulk Get User: 1

List Public Drawings: 3
List Users Drawings: 4
Get Drawing: 2
Create Public Drawing
Create Private Drawing
Delete Drawing

### Entities
  Entity       PK                                   SK
1 user         user#<userId>                        user#<userId>
2 drawing      drawing#<drawingId>                  drawing#<drawingId>

### GSI1
  Entity       GSI1PK                               GSI1SK
3 drawing      gsi1pkDrawing#<truncatedTimestamp>   gsi1skDrawing#<public/private>#<publishDate>

### GSI2
  Entity       GSI2PK                               GSI2SK
4 drawing      gsi2pkDrawing#<userId>               gsi2skDrawing#<createDate>

drawspace-be's People

Contributors

billjohnston avatar

Watchers

 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.