- Fork the repository and clone it to your local machine.
- CD to
clientdirectory and runnpm install - Run
npm run devto start the development server. - CD to the
serverdirectory and runnpm install - Run
npm run devto start the server. It listens on port 9800 by default. - Open the browser and navigate to
http://localhost:5173to see the Client. - Complete the assignment.
Your goal is to build a fully interactive, reusable, and modular component that displays data fetched from a server with added functionalities.
- Data Fetching & Error Handling
- Fetch data from the backend API and handle loading, error states, and retries.
- Multiple Display Modes
- Implement two variants: horizontal and vertical display modes.
- Add a toggle button to switch between the display modes dynamically.
- Sorting & Filtering
- Allow sorting by at least one column (e.g., alphabetically or numerically).
- Provide a basic filtering feature that lets users search within the displayed data.
- Pagination
- If the fetched dataset is large, paginate results with a “Next” and “Previous” button.
- Allow setting page size (e.g., 5, 10, 20 items per page).
- Testing
- Write unit tests for at least one React hook and one core function in the component using Jest and React Testing Library.
Your goal is to write a reusable, modular component that displays some data that is fetched from a server.
This DisplayComponent should have two variants, one that displays data horizontally, one that displays data vertically. How you display the data is entirely up to you.
Please follow React best practices, use hooks where it makes sense, handle errors gracefully, comment liberally, etc. Commits are free so commit early and often!
In addition to developing the React component, you'll implement a simple CI/CD pipeline to automate testing and deployment.
Requirements:
- Set Up a GitHub Actions Workflow
- Create a .github/workflows/ci.yml file in the repository.
- The workflow should: 1. Install dependencies for both client/ and server/, 2. Run linting and unit tests for both frontend and backend, and 3. Build the frontend and backend if tests pass.
- Dockerize the Application
- Write a Dockerfile for both the frontend and backend.
- Create a docker-compose.yml file that runs both services together.
- Deploy to a Cloud Platform
- Configure a GitHub Actions workflow to deploy the application to a cloud service of your choice (Vercel, Netlify, Render, or a free-tier AWS/Azure instance).
- Alternatively, deploy the app on a personal VPS using Docker Compose.
- Provide Documentation
- In the README.md, add a section explaining how to: 1. Run the application locally with Docker and 2. Deploy using the GitHub Actions workflow.