Giter VIP home page Giter VIP logo

backend-takehome's Introduction

TakeOff Labs Backend Technical Test

Prerequisites

git clone https://github.com/xpcapital/backend-takehome.git

Introduction

As you probably heard during your first interview, Takeoff Labs builds social consumer apps. Among other things, it means that we have a lot of users spreaded arround the world.

We often want to send our users notifications, emails etc.
Most of the time in real time (e.g. a new message notification) but also sometimes with a delay (e.g. when we want to reengage our users with push notifications received at a given date and time).

Moreover since most users are abroad, they might have different timezones which we may want to consider when scheduling particular tasks.

Instructions

In this test you will be asked to implement a solution for the second type of notification: namely those that are scheduled.

Your task will be to implement a very simple REST API with a unique endpoint that listens on 127.0.0.1:3001.

This endpoint should be POST /user (body described below).

{
	"uid": string,
	"timeZone": string
}

For each request received on this endpoint, the API should send a couple of requests (which we will call notification) to the client app which is listening on 127.0.0.1:8080 on the POST / endpoint.

Suppose you receive a request R at time T on the POST /user endpoint. Here is the list of notifications that should be triggered:

  • One scheduled at T + 2 min
  • One scheduled on the same Day than Day(T), sent each at random times picked between 7 and 9PM in the user's timeZone (skipped if this timeframe is already past).

You don't have to check if timeZone is valid as we only send valid ones.

Each notification sent to our mobile app should contain the data your API received + the random time you computed (body described below).

{
	"uid": string,
	"timeZone": string,
	"scheduledDate": string
}

Rules

  • You are free to use whatever you need as long as you respect our instructions and other rules. It means languages, libraries, services etc. The most important thing is to build an efficient and reliable solution.
  • Your code must be resilient to downtimes. We will start the project then stop and restart your API to see if the tasks are still handled.
  • We should only have to run docker compose build and docker compose up to see the whole code running successfully. You will find an incomplete docker-compose.yml at project's root.
  • We will test your solution with various number of requests, so keep in mind that it should handle a heavy load with the least possible performance issues.
  • You have 3 hours to complete and send us the test.

Setup

You'll find our code under the takeoff directory. It contains :

  • The script sending requests to your API. As you can see, it will keep sending you requests until it receives a valid answer from your server.
  • The app that will receive your request. It basically just logs what you sent.

If you want to run the app or the script outside of a docker container you would typically use the following commands :

yarn install
yarn build
yarn start:app  # Starts the app
yarn send:tasks # Run the script

At the root of the project you will also find a docker-compose.yml file.
As of now, it only starts our app and script, it's your responsability to modify it such that it also launches the API you built.
Feel free to update it as long as you respect the rules.
You can even modify our Docker architecture if you think it would make it better, but please notify us and keep in mind that you have a deadline.

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.