Skip to content
My solution for the backend-challenge @cabify
JavaScript TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Cabify backend challenge

Developed with love by Francisco Aranda.

You can find a deployed version of the solution here. It may take a little to boot up the server because I used the free tier of Zeit Now.


  • yarn dev Launches the solution in development mode.
  • yarn build Prepares the solution for production.
  • yarn start Launches the solution using the production generated code.
  • yarn test Launches the tests suite.
  • yarn doc:api Generates the documentation of the API.

Solution explanation

My solution consists on a server written in NodeJS that exposes an API and a client written with NextJS in order to test the API and trying to represent a real world approach of how could be the point of sale used in the physical store.

As there is no DBA at Cabify, and being a physical store, I decided to implement a memory-based storage system and a simple architecture around it that can be easily scalated to another storage approach in any time without the need to rewrite other modules. Part of this architecture is written using Typescript in order to make up the architecture as explicit as possible, making their use when creating new modules of the store comfortable and suffering-free.

As this solution initially ships without any external database, I created a populate system based on JSON files that can be written easily in order to add more products or discounts to the store. This JSON data is parsed and converted into instances of the system once the server is loaded.

I took the liberty of creating an endpoint not contemplated in the specification GET /basket/:id in order to retrieve the data from the basket and display it in the client in case of page reload or loss of connection.

You can read more about the solution in the code. I've posted several comments explaining every part of the architecture. Anyway, any doubt you have about why I structured the project like this, I will be delighted to talk with you.

You can’t perform that action at this time.