<aside> ⏱️

Once you received this brief, you have 7 days to implement it and send it back to our team.

</aside>

At Mergify, we think the best way to understand your capabilities is to give you the opportunity to solve a problem similar to the ones we solve on a daily basis. As the next step in our process, we want you to build a tiny project. Treat this as an opportunity to show us how you would write something efficient, scalable, well-structured and maintainable.

We will primarily be looking at the following criteria:

We ask that you submit what you've completed – we promise we will read it carefully, even if it is incomplete! We also recommend spending some time to write instructions and how you would improve the program.

This project should be written in Python, with any framework or library you want.

<aside> 💡 Use GitHub to share the resulting code and add jd and sileht to your repository with read access.

</aside>

1. Building our API ✨

GitHub provides a feature allowing a user to save a repository with a star. Those users are called stargazers.

Untitled

This feature is great for users to bookmark repositories. It is also quite interesting for maintainers as they can know the number of people that are interested in their project.

It is said that the more stars a repository gets, the more popular the project is! 🚀

Analysis

We would like to leverage those stars to find neighbours of a repository.

We define a neighbour of a repository A as a repository B that has been starred by a same user.

For example, if joe adds a star to the repository projectA and projectB, we define those repositories projectA and projectB as being neighbours.

Of course, the more users two projects have in common the closer they are.

API endpoint

The goal of this project is to have a web service that can receive such a request:

GET /repos/<user>/<repo>/starneighbours

This endpoint must return the list of neighbours repositories, meaning repositories where at least one stargazer is found in common.

The returned JSON format should look like:

[
 {
   "repo": <repoA>,
    "stargazers": [<stargazers in common>, ...],
 },
 {
   "repo": <repo>,
    "stargazers": [<stargazers in common>, ...],
 },
 ...
]