Back-end Engineering challenge

Demonstrate your skills and overall approach to Back-end Engineering


The Back-end Engineering challenge is a way for applicants to roles within the Q-CTRL Back-end Engineering team to demonstrate their skills and overall approach to solving a challenge based upon a set of requirements.

The requirements are intentionally sparse (the devil is in the details). We don’t want you to do a lot, but what you do should be your best work and should clearly demonstrate you embody the three virtues.

The rules

  1. Read and understand the challenge.
  2. Create a solution that satisfies the requirements.
  3. Send a link to the repository containing your solution to the person who contacted you.

IMPORTANT: The repository containing your solution MUST be public, MUST contain a README.md file, and MUST NOT make any reference to “Q-CTRL” in the repository name, description, or code.

NOTE: You should spend no more than three hours on this challenge.

The challenge

There’s a new product feature being planned for whereby a customer will be able to browse a list of people, and associated information, in their organization. The feature is being built by the Front-end Engineering team and they’ve asked the Back-end Engineering team for a new service that exposes an API endpoint to provide the required data.

The requirements

  • Create a new service using Django.
  • The service must be deployed as a Docker container and use a docker-compose.yaml file to standardize the local development environment. If you are not very familiar with Docker, see the examples below for a quick start.
  • All dependencies should be captured in a requirements.txt file in the root of the repository.
  • The service should expose a GraphQL endpoint at /graphql.
  • The GraphQL implementation must follow a schema-first approach.
  • The GraphQL schema should consist of a single query, people, which must return a list of Person objects.
  • The people query must implement pagination.
  • The Person object should have the following fields:
    • email (string).
    • name (string).
    • address (Address).
  • The Address object should have the following fields:
    • number (integer).
    • street (string).
    • city (string).
    • state (enum).
  • All data should be persisted on a database. You can use Django Admin if you like but include a self loading sample data.
  • The service must include one unit test (you are not marked on code coverage, just test one thing that you think is meaningful and shows your approach to testing).

Examples

Dockerfile

FROM python
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

docker-compose.yaml

version: "3.6"
services:
  django:
    build: .
    environment:
      PYTHONDONTWRITEBYTECODE: 1
    ports:
      - "8000:8000"
    volumes:
      - .:/usr/src/app

Validation

The following query will be used to validate your implementation:

query {
  people {
    email
    name
    address {
      number
      street
      city
      state
    }
  }
}