This coding challenge involves creating a full-stack MERN (MongoDB, Express, React, Node.js) application that interacts with a third-party API to fetch transaction data, initializes a database, and provides several APIs for data manipulation and visualization. The frontend will use these APIs to display the data in tables and charts.
- Third Party API URL:
https://s3.amazonaws.com/roxiler.com/product_transaction.json
- Request Method: GET
- Response Format: JSON
-
Initialize Database
- Endpoint:
/api/init
- Method: GET
- Description: Fetches JSON data from the third-party API and initializes the database with seed data.
- Endpoint:
-
List Transactions
- Endpoint:
/api/transactions
- Method: GET
- Description: Lists all transactions with support for search and pagination.
- Query Parameters:
month
(required)search
(optional)page
(default: 1)perPage
(default: 10)
- Endpoint:
-
Statistics
- Endpoint:
/api/statistics
- Method: GET
- Description: Provides statistics for the selected month.
- Query Parameters:
month
(required)
- Endpoint:
-
Bar Chart Data
- Endpoint:
/api/barchart
- Method: GET
- Description: Provides data for a bar chart based on price ranges for the selected month.
- Query Parameters:
month
(required)
- Endpoint:
-
Pie Chart Data
- Endpoint:
/api/piechart
- Method: GET
- Description: Provides data for a pie chart with unique categories and item counts for the selected month.
- Query Parameters:
month
(required)
- Endpoint:
-
Combined Data
- Endpoint:
/api/combined
- Method: GET
- Description: Fetches and combines data from the statistics, bar chart, and pie chart APIs.
- Query Parameters:
month
(required)
- Endpoint:
-
Transactions Table
- Lists transactions based on the selected month.
- Includes a search box to filter transactions by title, description, or price.
- Supports pagination with "Next" and "Previous" buttons.
-
Transactions Statistics
- Displays total sale amount, total sold items, and total unsold items for the selected month.
-
Transactions Bar Chart
- Displays a bar chart with price ranges and the number of items in each range for the selected month.
-
Transactions Pie Chart
- Displays a pie chart with unique categories and item counts for the selected month.
- Month Dropdown: Allows users to select a month from January to December.
- Default Selection: March is selected by default.
- Search Box: Filters transactions based on the input text.
- Pagination: "Next" and "Previous" buttons navigate through pages of transactions.
- Node.js and npm installed on your system
- MongoDB installed and running
-
Clone the repository:
git clone https://github.com/ShivanshTiwari01/Roxiler-Systems-Coding-Challenge cd Roxiler-Systems-Coding-Challenge/backend
-
Install dependencies
npm install
-
Run the server
npm start
-
Clone the repository:
git clone https://github.com/ShivanshTiwari01/Roxiler-Systems-Coding-Challenge cd Roxiler-Systems-Coding-Challenge/frontend
-
Install dependencies
npm install
-
Run the server
npm start
This project is licensed under the MIT License. See the LICENSE file for more details.