GithubHelp home page GithubHelp logo

the12thplayer.backend's Introduction

The12thPlayer

The backend for The12thPlayer mobile app. The goal of the application is to bring football fans closer together by providing a friendly, feature-rich platform where they can interact with each other in many different ways. The app does all of the usual football app things like live match events, lineups, and stats, but its main focus is on fans interconnecting with other fellow fans in order to build a strong and united community.

You can chat about a game in a discussion room, watch post-match fan video reactions and post your own, rate players' and managers' performances, predict match outcomes, and more. For more details on the available and planned functionality go to this repository, where the mobile app itself is hosted.

More screenshots

Architecture

The application is built on the microservice architecture, i.e., following the principals of domain ownership and data sovereignty.

All communications between services go through a message broker (RabbitMQ in dev) abstracted behind MassTransit.

The Api/Host projects (layers) in every service are entrypoints to the services (i.e., they contain MVC controllers and/or SignalR hubs, and/or MassTransit consumers). The entrypoint layer is very thin and doesn't contain any business logic. Instead, all of the business logic lives in the Application layer. Having a thin entrypoint layer allows for a simplified integration testing (no need for WebApplicationFactory, TestServer, and HttpClient) and also enables us to replace the built-in ASP.NET 5 filter pipeline with our own application (Mediator) pipeline, in order to avoid some of the inconsistencies in the filter pipeline behavior (in particular, the way authorization is handled in MVC and SignalR).

The Application layer manipulates the domain. It mostly consists of mediator behaviors and command and query handlers. This layer is generally coded against interfaces without any knowledge of the concrete implementations.

The Domain layer contains aggregates and some base interfaces and classes. Other DDD patterns (such as repository, domain and integration events, etc.) are used where appropriate.

The Infrastructure layer takes care of external concerns, such as database, cache, third-party services, etc. All but one services that have a database use PostgreSQL and EF Core. But Feed service uses CockroachDB and ADO.NET (Npgsql).

Worker service is a job scheduling/execution service which uses Quartz.NET underneath. It receives commands to schedule/run a certain job (or a series of jobs) from Admin and does it. For example, a command to collect initial data about a certain team (squad, finished fixtures, etc.) and transfer it to the interested services, so that they can populate their databases. Or a command to periodically update a team's upcoming fixtures (since they get rescheduled all the time).

FileHostingGateway is a service that reads files from disk and uploads them to S3/Vimeo/whatever. For example, when a user uploads a post-match video reaction, Livescore service receives the file in chunks (to not fill up the available RAM) and performs some basic validation (extension, signature, file size). It writes the file to disk and then sends a message containing the path to FileHostingGateway.

The idea in production is to use a shared network drive (like AWS EFS) to make the same drive available to all interested service instances (like Livescore and FileHostingGateway), so that they can share files between themselves. Meaning, Livescore receives the video and saves it to the drive, FileHostingGateway picks it up and uploads to Vimeo. Vimeo runs its own more sophisticated checks, transcodes the file, and returns a url.

In development we use a shared Docker volume to emulate a shared network drive.

the12thplayer.backend's People

Contributors

rho-cassiopeiae avatar

Stargazers

fedix 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.