Skip to content
Jesús Montes edited this page Feb 26, 2019 · 7 revisions

Demo

Demo animation

Tech choices

  • AWS Lambda: Fault-tolerant application and continuos scaling is required. A microservice is useful when small methods need to be executed and they don't depend on the whole server to work.
  • Deepstream: Lightning fast server that provides data-sync, pub-sub and request-response as well as all the security, failover, loadbalancing and encryption features necessary for scalable production realtime apps.
  • RethinkDb: RethinkDB is the open-source, scalable database that makes building realtime apps dramatically easier.
  • NodeJS/Typescript: All the glory of node with Typescript helps to better handle typo errors. It's helpful for big teams.
  • RxJS: Reactive programming is helpful to orchestrate plenty of async operations over which some manipulation could be needed.

Communication Layer

In order to fulfill the requirements, this application needs at least two communication protocols: HTTP, WebSocket. Thus is needed to create a client structure to properly handle both protocols seamlessly. RxJS is a perfect match to manipulate async data regardless of the source. We can multiplex data streams over a single communication channel.

Modular client structure

A facade is needed for an easy access to a large body of code. Let the Senior developer worry about the bigger structure and don't let Junior developers be less productive. Async services are responsible to communicate with external sources through actions that will be executed by the specific gateway. Custom async services will be injected as needed, that way we only depend on abstractions.

In the image bellow, the squares in gray are elements that still need to be created for this demo:

  • Command pattern
  • @ngrx implementation for a more predictable state management.

Modular client structure

Client async structure

Client async structure

Server structure proposal

This structure is very simple but helps to solve the current problem in a future prove way.

  • Cluster of lambdas
  • Cluster of RethinkDB instances
  • A utilities subnetwork.
  • Authentication through jwt

Server structure proposal

Server functional focus

Since the server code will be stored in lambdas it was easier to approach a more funcional programming structure to keep it simple as the requirements grow.