/adb_test

Primary LanguagePython

NOTE: DO NOT FORK THIS REPOSITORY. CLONE AND SETUP A STANDALONE REPOSITORY.

Adbrew Test!

Hello! This test is designed to specifically test your Python, React and web development skills. The task is unconventional and has a slightly contrived setup on purpose and requires you to learn basic concepts of Docker on the fly.

Structure

This repository includes code for a Docker setup with 3 containers:

  • App: This is the React dev server and runs on http://localhost:3000. The code for this resides in src/app directory.
  • API: This is the backend container that run a Django instance on http://localhost:8000.
  • Mongo: This is a DB instance running on port 27017. Django views already have code written to connect to this instance of Mongo.

We highly recommend you go through the setup in Dockerfile and docker-compose.yml. If you are able to understand and explain the setup, that will be a huge differentiator.

Setup

  1. Clone this repository (DO NOT FORK)
git clone https://github.com/Doma-byte/adb_test.git
  1. Change into the cloned directory and set the environment variable for the code path. Replace path_to_repository appropriately.
export ADBREW_CODEBASE_PATH="{path_to_repository}/src"
  1. Build container (you only need to build containers for the first time or if you change image definition, i.e., Dockerfile). This step will take a good amount of time.
docker-compose build
  1. Once the build is completed, start the containers:
docker-compose up -d
  1. Once complete, docker ps should output something like this:
CONTAINER ID   IMAGE               COMMAND                  CREATED         STATUS         PORTS                      NAMES
e445be7efa61   adbrew_test_api     "bash -c 'cd /src/re…"   3 minutes ago   Up 2 seconds   0.0.0.0:8000->8000/tcp     api
0fd203f12d8a   adbrew_test_app     "bash -c 'cd /src/ap…"   4 minutes ago   Up 3 minutes   0.0.0.0:3000->3000/tcp     app
884cb9296791   adbrew_test_mongo   "/usr/bin/mongod --b…"   4 minutes ago   Up 3 minutes   0.0.0.0:27017->27017/tcp   mongo
  1. Check that you are able to access http://localhost:3000 and http://localhost:8000/todos
  2. If the containers in #5 or #6 are not up, we would like you to use your debugging skills to figure out the issue. Only reach out to us if you've exhausted all possible options. The app container may take a good amount of time to start since it will download all package dependencies.

Tips

  1. Once containers are up and running, you can view container logs by executing docker logs -f --tail=100 {container_name} Replace container_name with app or api(output of docker ps)
  2. You can enter the container and inspect it by executing docker exec -it {container_name} bash Replace {container_name} with app or api (output of docker ps)
  3. Shut all containers using docker-compose down
  4. Restart a container using docker restart {container_name}

Task

When you run localhost:3000, you would see 2 things:

  1. A form with a TODO description textbox and a submit button. On this form submission, the app should interact with the Django backend (POST http://localhost:8000/todos) and create a TODO in MongoDB.
  2. A list with hardcoded TODOs. This should be changed to reflect TODOs in the backend (GET http://localhost:8000/todos).
  3. When the form is submitted, the TODO list should refresh again and fetch latest list of TODOs from MongoDB.

Instructions

  1. All React code should be implemented using React hooks and should not use traditional stateful React components and component lifecycle method.
  2. Do not use Django's model or SQLite DB. Persist and retrieve all data from the mongo instance. A db instance is already present in views.py.
  3. We are looking for developers who have strong fundamentals and can ramp up fast. We expect you to learn and grasp basic React Hooks/Mongo/Docker concepts on the fly.
  4. Do not submit your solution as a PR since this is a public repo and there are other candidates taking the same test. Send us a link to your repo privately.
  5. If you are able to complete the test, we will have a live walkthrough of your code and ask questions to check your understanding.
  6. The code for the actual solution is pretty easy. The code quality in your solution should be production-ready - error handling, abstractions, well-maintainable and modular code.