lerna

Teravoz Challenge

This repository solves the Teravoz's fullstack challenge

Currently deployed to https://teravoz-challenge-grxovemtdu.now.sh/

Read the tasks answers 1, 2, 4 here

Task3 requirements and solutions

So your Node.js application has to do the following:

Running Locally

Please install docker and docker-compose;

$ docker-compose build
$ docker-compose up

Expected terminal output alt docker-compose

Open in your browser http://localhost:5000 alt dashboard

Deploying

Install now-cli

$ now --docker --public

How it works

This Dockerfile is special because in a single container we launch all 3 applications, i.e 3 differente node processes. We use pm2 and this config to manage all processes.

Development Requirements

Install the most up-to-date node.

The Dockerfile of all application use node10. See apps/api/Dockerfile The applications rely on async/await synxtax (node8+) and we also use the new URL builtin;

Understanding the code

Repository Overview

This repository contains 3 different applications:

  • apps/dashboard: A little dashboard in React, showing current active calls.
  • apps/api: Exposes current active calls via http and handle teravoz event by exposing a /webhook endpoint.
  • apps/teravoz-api-fake: A http service that mimics the teravoz api and provides simulation goodies.

Each application is a docker container and meant to be deployed separatedly. For instance using now.

This is a monorepo made using lerna to manage multiple packages. Also I'm not using yarn because of some lerna issues.

Even though there's no shared packages for this trivial application, the monorepo structure is convenient to use a single linting and formatting set of rules.

We use eslint + prettier to quite the good pretty. Take a look at .prettierrc and .eslintrc.json for details.

Guided Tour

  1. Read the challenge specification
  2. Read the docker-compose to see how apps interact with each other.
  3. Read the source code of integration tests to get a feel how the api works
  4. Read the source code for the call-delegation-logic
  5. Read the source code for all routes:
  6. Read the Notable Packages section.
  7. Read apps/api README in particular Services Model
  8. Read apps/dashboard README in particular Architecture Decisions