├── .github
├── lockdown.yml
└── workflows
│ └── sast.yaml
├── README.md
└── sonar-project.properties
/.github/lockdown.yml:
--------------------------------------------------------------------------------
1 | # Lock issues and pull requests
2 | lock: true
3 |
4 | # Limit to only `issues` or `pulls`
5 | # only: pull
6 |
--------------------------------------------------------------------------------
/.github/workflows/sast.yaml:
--------------------------------------------------------------------------------
1 | name: SAST and Linting
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | - master
8 |
9 | jobs:
10 | huskyci:
11 | name: HuskyCI Security Check
12 | runs-on: [self-hosted]
13 | env:
14 | HUSKYCI_CLIENT_API_ADDR: "${{ secrets.HUSKYCI_CLIENT_API_ADDR }}"
15 | HUSKYCI_CLIENT_API_USE_HTTPS: false
16 | HUSKYCI_CLIENT_REPO_URL: git@github.com:${{ github.repository }}.git
17 | HUSKYCI_CLIENT_REPO_BRANCH: "master"
18 | HUSKYCI_CLIENT_TOKEN: "${{ secrets.HUSKYCI_CLIENT_TOKEN }}"
19 | HUSKYCI_CLIENT_URL: "git@github.com/githubanotaai/huskyci-api.git"
20 |
21 | steps:
22 | - name: Checkout repository
23 | uses: actions/checkout@v4
24 | with:
25 | fetch-depth: 0
26 |
27 | - name: Set up Go
28 | uses: actions/setup-go@v5
29 | with:
30 | go-version: '^1.19'
31 |
32 | - run: go version
33 |
34 | - name: Downloading and installing tools
35 | run: |
36 | sudo apt-get update && sudo apt-get install -y --no-install-recommends make tcl-dev gettext libcurl4-openssl-dev openssh-client git
37 | sudo curl -SL https://github.com/docker/compose/releases/download/v2.32.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
38 | sudo chmod +x /usr/local/bin/docker-compose
39 |
40 | - name: HuskyCI Client Download, Build and Run
41 | run: |
42 | wget -O - https://github.com/githubanotaai/huskyci-api/archive/main.tar.gz | tar xz --strip=1
43 | cd client/cmd
44 | go build -ldflags "-s -w" -o huskyci-client main.go
45 | git config --global --add safe.directory /__w/huskyci-api/huskyci-api
46 | chmod +x huskyci-client
47 | ./huskyci-client
48 |
49 | - name: Debug SonarQube JSON File
50 | if: ${{ !cancelled() }}
51 | run: cat client/cmd/huskyCI/sonarqube.json
52 |
53 | - name: Upload SonarQube Artifact
54 | if: ${{ !cancelled() }}
55 | uses: actions/upload-artifact@v4
56 | with:
57 | name: sonarqube
58 | path: client/cmd/huskyCI/sonarqube.json
59 |
60 | sonarqube:
61 | name: Sonarqube Check
62 | if: ${{ !cancelled() }}
63 | needs: huskyci
64 | runs-on: [self-hosted]
65 | env: {}
66 |
67 | steps:
68 | - name: Checkout repository
69 | uses: actions/checkout@v4
70 | with:
71 | fetch-depth: 0
72 |
73 | - name: Download SonarQube Artifact
74 | uses: actions/download-artifact@v4
75 | with:
76 | name: sonarqube
77 |
78 | - name: Debug SonarQube JSON File
79 | if: ${{ !cancelled() }}
80 | run: cat ./sonarqube.json
81 |
82 | - name: Run SonarQube Scan
83 | uses: sonarsource/sonarqube-scan-action@v3
84 | env:
85 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
86 | SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
87 | with:
88 | args: >
89 | -Dsonar.externalIssuesReportPaths=sonarqube.json
90 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
Backend Analyst Candidate Test
3 | Dear developer,
4 |
5 | Welcome to the Backend Analyst Candidate Test. This test aims to assess your general knowledge and development speed. Below, you will find the details and requirements for this test.
6 |
7 |
8 | The Challenge
9 |
10 | Your task is to develop an API using Node.js for a product catalog management system in a marketplace application. You should analyze and convert the following user stories into routes for the application:
11 |
12 | User Stories:
13 |
14 | - As a user, I want to register a product with its owner, so that I can access its data in the future (title, description, price, category, owner ID).
15 | - As a user, I want to register a category with its owner, so that I can access its data in the future (title, description, owner ID).
16 | - As a user, I want to associate a product with a category.
17 | - As a user, I want to update the data of a product or category.
18 | - As a user, I want to delete a product or category from my catalog.
19 | - A product can only be associated with one category at a time.
20 | - Assume that products and categories belong only to one owner.
21 |
22 | - Keep in mind that this is an online product catalog, which means there will be multiple requests for editing items/categories per second, as well as accessing the catalog search endpoint.
23 | - Consider the product catalog as a JSON compilation of all available categories and items owned by a user. This way, the catalog search endpoint does not need to fetch information from the database.
24 | - Whenever there is a change in the product catalog, publish this change to the "catalog-emit" topic in the AWS SQS service.
25 | - Implement a consumer that listens to catalog changes for a specific owner.
26 | - When the consumer receives a message, search the database for that owner's catalog, generate the catalog JSON, and publish it to an AWS S3 service bucket.
27 |
28 | You need to develop this test using the following technologies:
29 |
30 | - MongoDB for the database.
31 | - AWS SQS for the catalog change notifications.
32 | - AWS S3 for storing the catalog JSON.
33 | - Node.js for the backend.
34 | - Express.js as the web framework.
35 |
36 |
37 | Diagram representing the final structure of the project:
38 | 
39 |
40 |
41 |
42 |
43 | Instructions
44 |
45 | To begin the test, fork this repository, create a branch with your full name, and send us the link to your completed test (link to your repository). If you only clone the repository, you won't be able to push changes, making the pull request more complicated.
46 | - Use your own AWS account to set up the required services.
47 | - Update the README file with instructions on how to run your application.
48 | - Paste the branch name into the GUPY system and indicate the completion of the test.
49 | - Feel free to provide us with feedback regarding the test.
50 |
51 | Our Evaluation Criteria
52 | We will assess the following aspects of your solution:
53 |
54 | - Knowledge of JavaScript, Node.js, and Express.js.
55 | - Proper structure of the application layers.
56 | - Handling of outgoing calls.
57 | - Effective use of environment variables.
58 | - Implementation of unit tests.
59 | - Logging mechanisms.
60 | - Error handling strategies.
61 | - Documentation quality.
62 | - Code organization, module separation, readability, and comments.
63 | - Commit history.
64 |
--------------------------------------------------------------------------------
/sonar-project.properties:
--------------------------------------------------------------------------------
1 | sonar.projectKey=githubanotaai_new-test-backend-nodejs_960c2fdd-ee75-48da-9219-6a14e43c0587
2 | sonar.externalIssuesReportPaths=./huskyCI/sonarqube.json
3 | # sonar.python.version=3.10
4 |
--------------------------------------------------------------------------------