Giter Site home page Giter Site logo

alexandruantonica / rankings-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from international-slackline-association/rankings-backend

0.0 1.0 0.0 3.43 MB

Server-side client of ISA Rankings (Serverless, NestJS, DynamoDB)

Home Page: https://www.isa-rankings.org

License: GNU General Public License v3.0

TypeScript 98.75% JavaScript 1.25%

rankings-backend's Introduction

Rankings-Backend

Server-side client of isa-rankings.org

Technical Overview:

  • The server-side is entirely designed to be serverless on AWS.
  • Requires knowledge on followings
    • Webpack
    • NestJS
    • Typescript
    • Serverless Framework (with Serverless-Offline plugin)
    • AWS DynamoDB (main database)
    • AWS DynamoDB Streams
    • AWS Api Gateway
    • AWS Lambda
    • AWS CloudFormation (infrastructure as a code)
    • AWS IAM Management (user, roles, policies)
    • Redis (read through cache)

Why serverless?

  • Pay as you go: You only pay for the resources you actively use, not when they are sitting idle. Perfect for low|inconsistent traffic applications.
  • Costs: Extremely cheap . This application costs less than 1 dolar/month.
  • Maintenance & Operation: You never manage infrastructure or any problem that comes with it. Only write the code and it works. Since its a volunteered project nobody wants to do anything but writing the application code

Architecture Overview

Architecture


DynamoDB - (Database Design)

DynamoDB is designed in such a way (primary keys and sort keys) so that it supports all the query patterns this application needs. It has only a single table with aggregated GSIs, hierarchical SKs.

In short, it is customized for application's access patterns.

Overview of the table:

Main Table

PK SK_GSI LSI GSI_SK ...Attributes
Athlete:{id} AthleteDetails {normalizedName} ...
Athlete:{id} Contest:{discipline}:{id} Contest:{date} {points} ...
Athlete:{id} Rankings:{type}:{year}:{discipline}:{gender}:{ageCategory} {points} ...
Contests Contest:{discipline}:{id} Contest:{date} ...

Possible Query Patterns:

  • Get details of athlete
  • List contests of an athlete sorted by date
  • Get a contest of an athlete
  • Get a ranking of athlete
  • Get details of a contest
  • List details of contests sorted by date

GSI Table

GSI SK PK ...Attributes
AthleteDetails {normalizedName} Athlete:{id} ...
Contest:{discipline}:{id} {points} Athlete:{id} ...
Rankings:{year}:{discipline}:{gender}:{ageCategory} {points} Athlete:{id} ...

Possible Query Patterns:

  • List details of athlete sorted by name
  • List athletes of a contest sorted by points
  • List athletes of a ranking sorted by points

Getting Started

To start with, serverless installation must be completed on your local comptuter.

How to: Installation Guide

There are 2 environment stages, therefore you should have valid credentials for them. Checkout the secrets.example.yml under serverless folder. Replace the values with real ones

For deployment aws-cli should be installed and configured with Profiles needed in the serverless.yml file. To get your credentials contact to ISA.

Running on local

First, credentials are obtained from .env file. Replace the values in .env.example file with real ones depending on the stage you want to run (in secrets.yml you can see the stages)

Install dependencies

npm install

Start serverless-offline

npm start

API is served at localhost:3000/

Project Folder Overview

Gource output

GourceImage

rankings-backend's People

Contributors

can-sahin avatar dependabot[bot] avatar

Watchers

James Cloos 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.