This challenge is designed to evaluate your React skills in state management, application structure, separation of concerns, API integration, and logical reasoning. You will build a simplified product management application for an e-commerce store.
Build a Product Management Dashboard where users can:
- View a list of products.
- Search and filter products.
- Edit product details.
- Add a new product.
- Delete a product.
You will interact with a provided API for managing the product data.
Duration: Duration: We estimate this task should take approximately 8 hours. Please provide an estimation of the total time you spent on this challenge if it is not evident from your commit history. Technology: React with Typescript Testing: Write at least one unit test for a critical function/component.
- State Management: Effective handling of state (local/global).
- Code Structure: Modular, readable, and reusable components.
- Separation of Concerns: Clear delineation between presentation, business logic, and API communication layers.
- API Interaction: Handling API calls, errors (you can limit this to some common errors), and loading states.
- Logical Reasoning: Correct implementation of filtering, searching, and other business logic.
- Design: Clean and functional UI. You can use any UI framework or custom styling.
- Best Practices: Type definitions, code comments, accessibility considerations, etc.
- Optional: Showcase of architectural patterns like Backend for Frontend (BFF) (not mandatory).
- Product List
- Fetch and display a list of products from the API.
- Include the following columns:
- Product Name
- Price
- Category
- Stock Quantity
- Actions (Edit/Delete)
- Search and Filter
- Add a search input to filter products by name.
- Add a filter dropdown for category.
- Add Product
- Clicking "Add Product" should open a form to add a new product.
OPTIONAL: 4. Edit Product
- Clicking "Edit" in the product list should allow users to edit the product's details.
- Delete Product
- Allow users to delete a product with a confirmation dialog.
- Mock API
- Use the provided API definition to Mock the interactions for all data operations (GET, POST, DELETE). - This can be handled via any Mock Solution like the one here https://github.com/alan2207/bulletproof-react or with Next.JS
- Error Handling: Gracefully handle API errors with appropriate feedback to users.
- Loading States: Show loading indicators while fetching data.
- Responsiveness: The application should be mobile-friendly.
- Scalability: Design components and the architecture to be extendable for future features.
Please mock the following API endpoints
Method | Endpoint | Description |
---|---|---|
GET | / | Get a list of all products. |
POST | / | Add a new product. |
Opt: PATCH | /:id | Update an existing product. |
DELETE | /:id | Delete a product. |
[
{
"id": 1,
"name": "Sample Product 1",
"price": 10.99,
"category": "Electronics",
"stock": 15
},
{
"id": 2,
"name": "Sample Product 2",
"price": 29.99,
"category": "Books",
"stock": 10
}
]
{
"name": "New Product",
"price": 19.99,
"category": "Home",
"stock": 20
}
{
"price": 25.99, // updated value
}
Response: 204 No Content
If time allows, consider adding:
- Pagination: Add pagination for the product list.
- Sort Functionality: Allow sorting by price, name, or stock.
- BFF Architecture: Use Next.js API routes to act as a backend proxy for the frontend. This adds a layer of abstraction for managing API requests.
- Repository: Provide a link to a GitHub repository with your code in a private repository.
- Access: Invite the user @FloHiwg to your repository. Ensure the username is correct and that access is granted.
- Instructions: Include clear instructions in the
README.md
for setting up and running the application. - Time Spent: Please give an estimation of the total time you needed to complete the challenge if the commit history does not clearly reflect it.
- Testing: Ensure the app can be run locally, and include instructions on how to run.
This challenge aims to simulate a real-world task with an emphasis on clean architecture and maintainable code. Focus on delivering a high-quality solution rather than rushing to complete all features. Good luck! 🚀